Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
cb760a6e
Commit
cb760a6e
authored
Aug 16, 2016
by
Random-Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait for node ready before the node e2e test started.
parent
1de85829
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
e2e_node_suite_test.go
test/e2e_node/e2e_node_suite_test.go
+34
-0
No files found.
test/e2e_node/e2e_node_suite_test.go
View file @
cb760a6e
...
@@ -31,6 +31,8 @@ import (
...
@@ -31,6 +31,8 @@ import (
"testing"
"testing"
"time"
"time"
"k8s.io/kubernetes/pkg/api"
clientset
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
commontest
"k8s.io/kubernetes/test/e2e/common"
commontest
"k8s.io/kubernetes/test/e2e/common"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework"
...
@@ -118,6 +120,9 @@ var _ = SynchronizedBeforeSuite(func() []byte {
...
@@ -118,6 +120,9 @@ var _ = SynchronizedBeforeSuite(func() []byte {
glog
.
Infof
(
"Running tests without starting services."
)
glog
.
Infof
(
"Running tests without starting services."
)
}
}
glog
.
Infof
(
"Wait for the node to be ready"
)
waitForNodeReady
()
// Reference common test to make the import valid.
// Reference common test to make the import valid.
commontest
.
CurrentSuite
=
commontest
.
NodeE2E
commontest
.
CurrentSuite
=
commontest
.
NodeE2E
...
@@ -160,3 +165,32 @@ func maskLocksmithdOnCoreos() {
...
@@ -160,3 +165,32 @@ func maskLocksmithdOnCoreos() {
glog
.
Infof
(
"Locksmithd is masked successfully"
)
glog
.
Infof
(
"Locksmithd is masked successfully"
)
}
}
}
}
func
waitForNodeReady
()
{
const
(
// nodeReadyTimeout is the time to wait for node to become ready.
nodeReadyTimeout
=
2
*
time
.
Minute
// nodeReadyPollInterval is the interval to check node ready.
nodeReadyPollInterval
=
1
*
time
.
Second
)
config
,
err
:=
framework
.
LoadConfig
()
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
client
,
err
:=
clientset
.
NewForConfig
(
config
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Eventually
(
func
()
error
{
nodes
,
err
:=
client
.
Nodes
()
.
List
(
api
.
ListOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
if
nodes
==
nil
{
return
fmt
.
Errorf
(
"the node list is nil."
)
}
Expect
(
len
(
nodes
.
Items
)
>
1
)
.
NotTo
(
BeTrue
())
if
len
(
nodes
.
Items
)
==
0
{
return
fmt
.
Errorf
(
"empty node list: %+v"
,
nodes
)
}
node
:=
nodes
.
Items
[
0
]
if
!
api
.
IsNodeReady
(
&
node
)
{
return
fmt
.
Errorf
(
"node is not ready: %+v"
,
node
)
}
return
nil
},
nodeReadyTimeout
,
nodeReadyPollInterval
)
.
Should
(
Succeed
())
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment