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
98d26aeb
Commit
98d26aeb
authored
Nov 02, 2017
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait for markPodsReady goroutine to finish
parent
3233a07e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
util.go
test/integration/deployment/util.go
+20
-3
No files found.
test/integration/deployment/util.go
View file @
98d26aeb
...
...
@@ -19,6 +19,7 @@ package deployment
import
(
"fmt"
"net/http/httptest"
"sync"
"testing"
"time"
...
...
@@ -208,7 +209,9 @@ func markPodReady(c clientset.Interface, ns string, pod *v1.Pod) error {
// markUpdatedPodsReady manually marks updated Deployment pods status to ready,
// until the deployment is complete
func
(
d
*
deploymentTester
)
markUpdatedPodsReady
()
{
func
(
d
*
deploymentTester
)
markUpdatedPodsReady
(
wg
*
sync
.
WaitGroup
)
{
defer
wg
.
Done
()
ns
:=
d
.
deployment
.
Namespace
err
:=
wait
.
PollImmediate
(
pollInterval
,
pollTimeout
,
func
()
(
bool
,
error
)
{
// We're done when the deployment is complete
...
...
@@ -265,28 +268,42 @@ func (d *deploymentTester) waitForDeploymentComplete() error {
// while marking updated Deployment pods as ready at the same time.
// Uses hard check to make sure rolling update strategy is not violated at any times.
func
(
d
*
deploymentTester
)
waitForDeploymentCompleteAndCheckRollingAndMarkPodsReady
()
error
{
var
wg
sync
.
WaitGroup
// Manually mark updated Deployment pods as ready in a separate goroutine
go
d
.
markUpdatedPodsReady
()
wg
.
Add
(
1
)
go
d
.
markUpdatedPodsReady
(
&
wg
)
// Wait for the Deployment status to complete while Deployment pods are becoming ready
err
:=
d
.
waitForDeploymentCompleteAndCheckRolling
()
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to wait for Deployment %s to complete: %v"
,
d
.
deployment
.
Name
,
err
)
}
// Wait for goroutine to finish
wg
.
Wait
()
return
nil
}
// waitForDeploymentCompleteAndMarkPodsReady waits for the Deployment to complete
// while marking updated Deployment pods as ready at the same time.
func
(
d
*
deploymentTester
)
waitForDeploymentCompleteAndMarkPodsReady
()
error
{
var
wg
sync
.
WaitGroup
// Manually mark updated Deployment pods as ready in a separate goroutine
go
d
.
markUpdatedPodsReady
()
wg
.
Add
(
1
)
go
d
.
markUpdatedPodsReady
(
&
wg
)
// Wait for the Deployment status to complete using soft check, while Deployment pods are becoming ready
err
:=
d
.
waitForDeploymentComplete
()
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to wait for Deployment status %s: %v"
,
d
.
deployment
.
Name
,
err
)
}
// Wait for goroutine to finish
wg
.
Wait
()
return
nil
}
...
...
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