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
473c5159
Commit
473c5159
authored
Sep 03, 2015
by
Abhi Shah
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13502 from jszczepkowski/e2e-clustersize
e2e test function waitForClusterSize waits for not-ready nodes to go out.
parents
9b70b9d8
1d450ad3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
21 deletions
+25
-21
resize_nodes.go
test/e2e/resize_nodes.go
+0
-21
util.go
test/e2e/util.go
+25
-0
No files found.
test/e2e/resize_nodes.go
View file @
473c5159
...
@@ -110,27 +110,6 @@ func waitForGroupSize(size int) error {
...
@@ -110,27 +110,6 @@ func waitForGroupSize(size int) error {
return
fmt
.
Errorf
(
"timeout waiting %v for node instance group size to be %d"
,
timeout
,
size
)
return
fmt
.
Errorf
(
"timeout waiting %v for node instance group size to be %d"
,
timeout
,
size
)
}
}
func
waitForClusterSize
(
c
*
client
.
Client
,
size
int
,
timeout
time
.
Duration
)
error
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
timeout
;
time
.
Sleep
(
20
*
time
.
Second
)
{
nodes
,
err
:=
c
.
Nodes
()
.
List
(
labels
.
Everything
(),
fields
.
Everything
())
if
err
!=
nil
{
Logf
(
"Failed to list nodes: %v"
,
err
)
continue
}
// Filter out not-ready nodes.
filterNodes
(
nodes
,
func
(
node
api
.
Node
)
bool
{
return
isNodeReadySetAsExpected
(
&
node
,
true
)
})
if
len
(
nodes
.
Items
)
==
size
{
Logf
(
"Cluster has reached the desired size %d"
,
size
)
return
nil
}
Logf
(
"Waiting for cluster size %d, current size %d"
,
size
,
len
(
nodes
.
Items
))
}
return
fmt
.
Errorf
(
"timeout waiting %v for cluster size to be %d"
,
timeout
,
size
)
}
func
svcByName
(
name
string
)
*
api
.
Service
{
func
svcByName
(
name
string
)
*
api
.
Service
{
return
&
api
.
Service
{
return
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
...
...
test/e2e/util.go
View file @
473c5159
...
@@ -2048,3 +2048,28 @@ func waitForApiserverUp(c *client.Client) error {
...
@@ -2048,3 +2048,28 @@ func waitForApiserverUp(c *client.Client) error {
}
}
return
fmt
.
Errorf
(
"waiting for apiserver timed out"
)
return
fmt
.
Errorf
(
"waiting for apiserver timed out"
)
}
}
// waitForClusterSize waits until the cluster has desired size and there is no not-ready nodes in it.
func
waitForClusterSize
(
c
*
client
.
Client
,
size
int
,
timeout
time
.
Duration
)
error
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
timeout
;
time
.
Sleep
(
20
*
time
.
Second
)
{
nodes
,
err
:=
c
.
Nodes
()
.
List
(
labels
.
Everything
(),
fields
.
Everything
())
if
err
!=
nil
{
Logf
(
"Failed to list nodes: %v"
,
err
)
continue
}
numNodes
:=
len
(
nodes
.
Items
)
// Filter out not-ready nodes.
filterNodes
(
nodes
,
func
(
node
api
.
Node
)
bool
{
return
isNodeReadySetAsExpected
(
&
node
,
true
)
})
numReady
:=
len
(
nodes
.
Items
)
if
numNodes
==
size
&&
numReady
==
size
{
Logf
(
"Cluster has reached the desired size %d"
,
size
)
return
nil
}
Logf
(
"Waiting for cluster size %d, current size %d, not ready nodes %d"
,
size
,
numNodes
,
numNodes
-
numReady
)
}
return
fmt
.
Errorf
(
"timeout waiting %v for cluster size to be %d"
,
timeout
,
size
)
}
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