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
28a60157
Commit
28a60157
authored
May 25, 2016
by
Alex Mohr
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #26272 from yujuhong/fix_reboot_tests
e2e: fix tests that are broken because of the image prepull pod
parents
4e8e4a57
cd82c543
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
14 deletions
+36
-14
util.go
test/e2e/framework/util.go
+26
-4
reboot.go
test/e2e/reboot.go
+5
-5
resize_nodes.go
test/e2e/resize_nodes.go
+1
-1
restart.go
test/e2e/restart.go
+3
-3
scheduler_predicates.go
test/e2e/scheduler_predicates.go
+1
-1
No files found.
test/e2e/framework/util.go
View file @
28a60157
...
@@ -396,6 +396,14 @@ func PodRunningReady(p *api.Pod) (bool, error) {
...
@@ -396,6 +396,14 @@ func PodRunningReady(p *api.Pod) (bool, error) {
return
true
,
nil
return
true
,
nil
}
}
func
PodRunningReadyOrSucceeded
(
p
*
api
.
Pod
)
(
bool
,
error
)
{
// Check if the phase is succeeded.
if
p
.
Status
.
Phase
==
api
.
PodSucceeded
{
return
true
,
nil
}
return
PodRunningReady
(
p
)
}
// PodNotReady checks whether pod p's has a ready condition of status false.
// PodNotReady checks whether pod p's has a ready condition of status false.
func
PodNotReady
(
p
*
api
.
Pod
)
(
bool
,
error
)
{
func
PodNotReady
(
p
*
api
.
Pod
)
(
bool
,
error
)
{
// Check the ready condition is false.
// Check the ready condition is false.
...
@@ -3217,16 +3225,30 @@ func GetSigner(provider string) (ssh.Signer, error) {
...
@@ -3217,16 +3225,30 @@ func GetSigner(provider string) (ssh.Signer, error) {
return
sshutil
.
MakePrivateKeySignerFromFile
(
key
)
return
sshutil
.
MakePrivateKeySignerFromFile
(
key
)
}
}
// checkPodsRunning returns whether all pods whose names are listed in podNames
// CheckPodsRunningReady returns whether all pods whose names are listed in
// in namespace ns are running and ready, using c and waiting at most timeout.
// podNames in namespace ns are running and ready, using c and waiting at most
// timeout.
func
CheckPodsRunningReady
(
c
*
client
.
Client
,
ns
string
,
podNames
[]
string
,
timeout
time
.
Duration
)
bool
{
func
CheckPodsRunningReady
(
c
*
client
.
Client
,
ns
string
,
podNames
[]
string
,
timeout
time
.
Duration
)
bool
{
np
,
desc
:=
len
(
podNames
),
"running and ready"
return
CheckPodsCondition
(
c
,
ns
,
podNames
,
timeout
,
PodRunningReady
,
"running and ready"
)
}
// CheckPodsRunningReadyOrSucceeded returns whether all pods whose names are
// listed in podNames in namespace ns are running and ready, or succeeded; use
// c and waiting at most timeout.
func
CheckPodsRunningReadyOrSucceeded
(
c
*
client
.
Client
,
ns
string
,
podNames
[]
string
,
timeout
time
.
Duration
)
bool
{
return
CheckPodsCondition
(
c
,
ns
,
podNames
,
timeout
,
PodRunningReadyOrSucceeded
,
"running and ready, or succeeded"
)
}
// CheckPodsCondition returns whether all pods whose names are listed in podNames
// in namespace ns are in the condition, using c and waiting at most timeout.
func
CheckPodsCondition
(
c
*
client
.
Client
,
ns
string
,
podNames
[]
string
,
timeout
time
.
Duration
,
condition
podCondition
,
desc
string
)
bool
{
np
:=
len
(
podNames
)
Logf
(
"Waiting up to %v for %d pods to be %s: %s"
,
timeout
,
np
,
desc
,
podNames
)
Logf
(
"Waiting up to %v for %d pods to be %s: %s"
,
timeout
,
np
,
desc
,
podNames
)
result
:=
make
(
chan
bool
,
len
(
podNames
))
result
:=
make
(
chan
bool
,
len
(
podNames
))
for
ix
:=
range
podNames
{
for
ix
:=
range
podNames
{
// Launch off pod readiness checkers.
// Launch off pod readiness checkers.
go
func
(
name
string
)
{
go
func
(
name
string
)
{
err
:=
waitForPodCondition
(
c
,
ns
,
name
,
desc
,
timeout
,
PodRunningReady
)
err
:=
waitForPodCondition
(
c
,
ns
,
name
,
desc
,
timeout
,
condition
)
result
<-
err
==
nil
result
<-
err
==
nil
}(
podNames
[
ix
])
}(
podNames
[
ix
])
}
}
...
...
test/e2e/reboot.go
View file @
28a60157
...
@@ -241,11 +241,11 @@ func rebootNode(c *client.Client, provider, name, rebootCmd string) bool {
...
@@ -241,11 +241,11 @@ func rebootNode(c *client.Client, provider, name, rebootCmd string) bool {
podNames
=
append
(
podNames
,
p
.
ObjectMeta
.
Name
)
podNames
=
append
(
podNames
,
p
.
ObjectMeta
.
Name
)
}
}
}
}
framework
.
Logf
(
"Node %s has %d
pod
s: %v"
,
name
,
len
(
podNames
),
podNames
)
framework
.
Logf
(
"Node %s has %d
assigned pods with no liveness probe
s: %v"
,
name
,
len
(
podNames
),
podNames
)
// For each pod, we do a sanity check to ensure it's running / healthy
// For each pod, we do a sanity check to ensure it's running / healthy
// now, as that's what we'll be checking later.
//
or succeeded
now, as that's what we'll be checking later.
if
!
framework
.
CheckPodsRunningReady
(
c
,
ns
,
podNames
,
framework
.
PodReadyBeforeTimeout
)
{
if
!
framework
.
CheckPodsRunningReady
OrSucceeded
(
c
,
ns
,
podNames
,
framework
.
PodReadyBeforeTimeout
)
{
printStatusAndLogsForNotReadyPods
(
c
,
ns
,
podNames
,
pods
)
printStatusAndLogsForNotReadyPods
(
c
,
ns
,
podNames
,
pods
)
return
false
return
false
}
}
...
@@ -267,8 +267,8 @@ func rebootNode(c *client.Client, provider, name, rebootCmd string) bool {
...
@@ -267,8 +267,8 @@ func rebootNode(c *client.Client, provider, name, rebootCmd string) bool {
}
}
// Ensure all of the pods that we found on this node before the reboot are
// Ensure all of the pods that we found on this node before the reboot are
// running / healthy.
// running / healthy
, or succeeded
.
if
!
framework
.
CheckPodsRunningReady
(
c
,
ns
,
podNames
,
rebootPodReadyAgainTimeout
)
{
if
!
framework
.
CheckPodsRunningReady
OrSucceeded
(
c
,
ns
,
podNames
,
rebootPodReadyAgainTimeout
)
{
newPods
:=
ps
.
List
()
newPods
:=
ps
.
List
()
printStatusAndLogsForNotReadyPods
(
c
,
ns
,
podNames
,
newPods
)
printStatusAndLogsForNotReadyPods
(
c
,
ns
,
podNames
,
newPods
)
return
false
return
false
...
...
test/e2e/resize_nodes.go
View file @
28a60157
...
@@ -396,7 +396,7 @@ var _ = framework.KubeDescribe("Nodes [Disruptive]", func() {
...
@@ -396,7 +396,7 @@ var _ = framework.KubeDescribe("Nodes [Disruptive]", func() {
// the cluster is restored to health.
// the cluster is restored to health.
By
(
"waiting for system pods to successfully restart"
)
By
(
"waiting for system pods to successfully restart"
)
err
:=
framework
.
WaitForPodsRunningReady
(
api
.
NamespaceSystem
,
systemPodsNo
,
framework
.
PodReadyBeforeTimeout
,
map
[
string
]
string
{}
)
err
:=
framework
.
WaitForPodsRunningReady
(
api
.
NamespaceSystem
,
systemPodsNo
,
framework
.
PodReadyBeforeTimeout
,
framework
.
ImagePullerLabels
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
})
})
...
...
test/e2e/restart.go
View file @
28a60157
...
@@ -82,8 +82,8 @@ var _ = framework.KubeDescribe("Restart [Disruptive]", func() {
...
@@ -82,8 +82,8 @@ var _ = framework.KubeDescribe("Restart [Disruptive]", func() {
podNamesBefore
[
i
]
=
p
.
ObjectMeta
.
Name
podNamesBefore
[
i
]
=
p
.
ObjectMeta
.
Name
}
}
ns
:=
api
.
NamespaceSystem
ns
:=
api
.
NamespaceSystem
if
!
framework
.
CheckPodsRunningReady
(
f
.
Client
,
ns
,
podNamesBefore
,
framework
.
PodReadyBeforeTimeout
)
{
if
!
framework
.
CheckPodsRunningReady
OrSucceeded
(
f
.
Client
,
ns
,
podNamesBefore
,
framework
.
PodReadyBeforeTimeout
)
{
framework
.
Failf
(
"At least one pod wasn't running and ready at test start."
)
framework
.
Failf
(
"At least one pod wasn't running and ready
or succeeded
at test start."
)
}
}
By
(
"restarting all of the nodes"
)
By
(
"restarting all of the nodes"
)
...
@@ -111,7 +111,7 @@ var _ = framework.KubeDescribe("Restart [Disruptive]", func() {
...
@@ -111,7 +111,7 @@ var _ = framework.KubeDescribe("Restart [Disruptive]", func() {
podNamesAfter
,
err
:=
waitForNPods
(
ps
,
len
(
podNamesBefore
),
restartPodReadyAgainTimeout
)
podNamesAfter
,
err
:=
waitForNPods
(
ps
,
len
(
podNamesBefore
),
restartPodReadyAgainTimeout
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
remaining
:=
restartPodReadyAgainTimeout
-
time
.
Since
(
podCheckStart
)
remaining
:=
restartPodReadyAgainTimeout
-
time
.
Since
(
podCheckStart
)
if
!
framework
.
CheckPodsRunningReady
(
f
.
Client
,
ns
,
podNamesAfter
,
remaining
)
{
if
!
framework
.
CheckPodsRunningReady
OrSucceeded
(
f
.
Client
,
ns
,
podNamesAfter
,
remaining
)
{
framework
.
Failf
(
"At least one pod wasn't running and ready after the restart."
)
framework
.
Failf
(
"At least one pod wasn't running and ready after the restart."
)
}
}
})
})
...
...
test/e2e/scheduler_predicates.go
View file @
28a60157
...
@@ -196,7 +196,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
...
@@ -196,7 +196,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
}
}
}
}
err
=
framework
.
WaitForPodsRunningReady
(
api
.
NamespaceSystem
,
int32
(
systemPodsNo
),
framework
.
PodReadyBeforeTimeout
,
map
[
string
]
string
{}
)
err
=
framework
.
WaitForPodsRunningReady
(
api
.
NamespaceSystem
,
int32
(
systemPodsNo
),
framework
.
PodReadyBeforeTimeout
,
framework
.
ImagePullerLabels
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
for
_
,
node
:=
range
nodeList
.
Items
{
for
_
,
node
:=
range
nodeList
.
Items
{
...
...
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