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
a4112ded
Commit
a4112ded
authored
Jul 17, 2015
by
Max Forbes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make liveness test faster
parent
cc326c71
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
pods.go
test/e2e/pods.go
+9
-8
No files found.
test/e2e/pods.go
View file @
a4112ded
...
@@ -60,24 +60,25 @@ func runLivenessTest(c *client.Client, ns string, podDescr *api.Pod, expectResta
...
@@ -60,24 +60,25 @@ func runLivenessTest(c *client.Client, ns string, podDescr *api.Pod, expectResta
initialRestartCount
:=
api
.
GetExistingContainerStatus
(
pod
.
Status
.
ContainerStatuses
,
"liveness"
)
.
RestartCount
initialRestartCount
:=
api
.
GetExistingContainerStatus
(
pod
.
Status
.
ContainerStatuses
,
"liveness"
)
.
RestartCount
By
(
fmt
.
Sprintf
(
"Initial restart count of pod %s is %d"
,
podDescr
.
Name
,
initialRestartCount
))
By
(
fmt
.
Sprintf
(
"Initial restart count of pod %s is %d"
,
podDescr
.
Name
,
initialRestartCount
))
// Wait for at most 48 * 5 = 240s = 4 minutes until restartCount is incremented
// Wait for the restart state to be as desired.
restarts
:=
false
restarts
,
deadline
:=
false
,
time
.
Now
()
.
Add
(
2
*
time
.
Minute
)
for
i
:=
0
;
i
<
48
;
i
++
{
for
start
:=
time
.
Now
();
time
.
Now
()
.
Before
(
deadline
);
time
.
Sleep
(
2
*
time
.
Second
)
{
// Wait until restartCount is incremented.
time
.
Sleep
(
5
*
time
.
Second
)
pod
,
err
=
c
.
Pods
(
ns
)
.
Get
(
podDescr
.
Name
)
pod
,
err
=
c
.
Pods
(
ns
)
.
Get
(
podDescr
.
Name
)
expectNoError
(
err
,
fmt
.
Sprintf
(
"getting pod %s"
,
podDescr
.
Name
))
expectNoError
(
err
,
fmt
.
Sprintf
(
"getting pod %s"
,
podDescr
.
Name
))
restartCount
:=
api
.
GetExistingContainerStatus
(
pod
.
Status
.
ContainerStatuses
,
"liveness"
)
.
RestartCount
restartCount
:=
api
.
GetExistingContainerStatus
(
pod
.
Status
.
ContainerStatuses
,
"liveness"
)
.
RestartCount
By
(
fmt
.
Sprintf
(
"Restart count of pod %s in namespace %s is now %d"
,
podDescr
.
Name
,
ns
,
restartCount
))
By
(
fmt
.
Sprintf
(
"Restart count of pod %s/%s is now %d (%v elapsed)"
,
ns
,
podDescr
.
Name
,
restartCount
,
time
.
Since
(
start
)))
if
restartCount
>
initialRestartCount
{
if
restartCount
>
initialRestartCount
{
By
(
fmt
.
Sprintf
(
"Restart count of pod %s in namespace %s increased from %d to %d during the test"
,
podDescr
.
Name
,
ns
,
initialRestartCount
,
restartCount
))
By
(
fmt
.
Sprintf
(
"Restart count of pod %s/%s changed from %d to %d"
,
ns
,
podDescr
.
Name
,
initialRestartCount
,
restartCount
))
restarts
=
true
restarts
=
true
break
break
}
}
}
}
if
restarts
!=
expectRestart
{
if
restarts
!=
expectRestart
{
Fail
(
fmt
.
Sprintf
(
"pod %s in namespace %s - expected restarts: %v, found restarts: %v"
,
podDescr
.
Name
,
ns
,
expectRestart
,
restarts
))
Fail
(
fmt
.
Sprintf
(
"pod %s/%s - expected restarts: %t, found restarts: %t"
,
ns
,
podDescr
.
Name
,
expectRestart
,
restarts
))
}
}
}
}
...
...
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