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
ecce9492
Commit
ecce9492
authored
Feb 22, 2016
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait for pods to become available before rolling over in deployment e2e test
parent
6cecf2b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
deployment.go
test/e2e/deployment.go
+3
-1
util.go
test/e2e/util.go
+17
-0
No files found.
test/e2e/deployment.go
View file @
ecce9492
...
...
@@ -454,12 +454,14 @@ func testRolloverDeployment(f *Framework) {
Logf
(
"error in waiting for pods to come up: %s"
,
err
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
deploymentMinReadySeconds
:=
5
err
=
waitForPodsReady
(
c
,
ns
,
podName
,
deploymentMinReadySeconds
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
// Create a deployment to delete nginx pods and instead bring up redis-slave pods.
deploymentName
,
deploymentImageName
:=
"redis-deployment"
,
"redis-slave"
deploymentReplicas
:=
4
deploymentImage
:=
"gcr.io/google_samples/gb-redisslave:v1"
deploymentMinReadySeconds
:=
5
deploymentStrategyType
:=
extensions
.
RollingUpdateDeploymentStrategyType
Logf
(
"Creating deployment %s"
,
deploymentName
)
newDeployment
:=
newDeployment
(
deploymentName
,
deploymentReplicas
,
deploymentPodLabels
,
deploymentImageName
,
deploymentImage
,
deploymentStrategyType
,
nil
)
...
...
test/e2e/util.go
View file @
ecce9492
...
...
@@ -2144,6 +2144,23 @@ func waitForDeploymentStatus(c clientset.Interface, ns, deploymentName string, d
})
}
func
waitForPodsReady
(
c
*
clientset
.
Clientset
,
ns
,
name
string
,
minReadySeconds
int
)
error
{
label
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"name"
:
name
}))
options
:=
api
.
ListOptions
{
LabelSelector
:
label
}
return
wait
.
Poll
(
poll
,
5
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
pods
,
err
:=
c
.
Pods
(
ns
)
.
List
(
options
)
if
err
!=
nil
{
return
false
,
nil
}
for
_
,
pod
:=
range
pods
.
Items
{
if
!
deploymentutil
.
IsPodAvailable
(
&
pod
,
minReadySeconds
)
{
return
false
,
nil
}
}
return
true
,
nil
})
}
// Waits for the deployment to clean up old rcs.
func
waitForDeploymentOldRSsNum
(
c
*
clientset
.
Clientset
,
ns
,
deploymentName
string
,
desiredRSNum
int
)
error
{
return
wait
.
Poll
(
poll
,
5
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
...
...
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