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
e5dc6c88
Commit
e5dc6c88
authored
Mar 19, 2018
by
Shyam Jeedigunta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait for only enough no. of RC replicas to be running in testutil
parent
ebae09e7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
5 deletions
+18
-5
util.go
test/e2e/framework/util.go
+5
-1
runners.go
test/utils/runners.go
+13
-4
No files found.
test/e2e/framework/util.go
View file @
e5dc6c88
...
@@ -2811,7 +2811,11 @@ func WaitForControlledPodsRunning(c clientset.Interface, ns, name string, kind s
...
@@ -2811,7 +2811,11 @@ func WaitForControlledPodsRunning(c clientset.Interface, ns, name string, kind s
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
err
=
testutils
.
WaitForPodsWithLabelRunning
(
c
,
ns
,
selector
)
replicas
,
err
:=
getReplicasFromRuntimeObject
(
rtObject
)
if
err
!=
nil
{
return
err
}
err
=
testutils
.
WaitForEnoughPodsWithLabelRunning
(
c
,
ns
,
selector
,
int
(
replicas
))
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Error while waiting for replication controller %s pods to be running: %v"
,
name
,
err
)
return
fmt
.
Errorf
(
"Error while waiting for replication controller %s pods to be running: %v"
,
name
,
err
)
}
}
...
...
test/utils/runners.go
View file @
e5dc6c88
...
@@ -828,20 +828,29 @@ func StartPods(c clientset.Interface, replicas int, namespace string, podNamePre
...
@@ -828,20 +828,29 @@ func StartPods(c clientset.Interface, replicas int, namespace string, podNamePre
// Wait up to 10 minutes for all matching pods to become Running and at least one
// Wait up to 10 minutes for all matching pods to become Running and at least one
// matching pod exists.
// matching pod exists.
func
WaitForPodsWithLabelRunning
(
c
clientset
.
Interface
,
ns
string
,
label
labels
.
Selector
)
error
{
func
WaitForPodsWithLabelRunning
(
c
clientset
.
Interface
,
ns
string
,
label
labels
.
Selector
)
error
{
return
WaitForEnoughPodsWithLabelRunning
(
c
,
ns
,
label
,
-
1
)
}
// Wait up to 10 minutes for at least 'replicas' many pods to be Running and at least
// one matching pod exists. If 'replicas' is < 0, wait for all matching pods running.
func
WaitForEnoughPodsWithLabelRunning
(
c
clientset
.
Interface
,
ns
string
,
label
labels
.
Selector
,
replicas
int
)
error
{
running
:=
false
running
:=
false
PodStore
:=
NewPodStore
(
c
,
ns
,
label
,
fields
.
Everything
())
PodStore
:=
NewPodStore
(
c
,
ns
,
label
,
fields
.
Everything
())
defer
PodStore
.
Stop
()
defer
PodStore
.
Stop
()
waitLoop
:
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
10
*
time
.
Minute
;
time
.
Sleep
(
5
*
time
.
Second
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
10
*
time
.
Minute
;
time
.
Sleep
(
5
*
time
.
Second
)
{
pods
:=
PodStore
.
List
()
pods
:=
PodStore
.
List
()
if
len
(
pods
)
==
0
{
if
len
(
pods
)
==
0
{
continue
waitLoop
continue
}
}
runningPodsCount
:=
0
for
_
,
p
:=
range
pods
{
for
_
,
p
:=
range
pods
{
if
p
.
Status
.
Phase
!
=
v1
.
PodRunning
{
if
p
.
Status
.
Phase
=
=
v1
.
PodRunning
{
continue
waitLoop
runningPodsCount
++
}
}
}
}
if
(
replicas
<
0
&&
runningPodsCount
<
len
(
pods
))
||
(
runningPodsCount
<
replicas
)
{
continue
}
running
=
true
running
=
true
break
break
}
}
...
...
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