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
d11baea6
Unverified
Commit
d11baea6
authored
Feb 27, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 27, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74663 from tnozicka/fix-retrywatcher-unit-flake
Fix race in RetryWatcher's unit tests
parents
e2b3982d
b39d079b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
retrywatcher_test.go
...ing/src/k8s.io/client-go/tools/watch/retrywatcher_test.go
+11
-2
No files found.
staging/src/k8s.io/client-go/tools/watch/retrywatcher_test.go
View file @
d11baea6
...
...
@@ -33,6 +33,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/diff"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
"k8s.io/klog"
...
...
@@ -549,9 +550,17 @@ func TestRetryWatcher(t *testing.T) {
break
}
counter
:=
atomic
.
LoadUint32
(
atomicCounter
)
if
counter
!=
tc
.
watchCount
{
var
counter
uint32
// We always count with the last watch reestablishing which is imminent but still a race.
// We will wait for the last watch to reestablish to avoid it.
err
=
wait
.
PollImmediate
(
10
*
time
.
Millisecond
,
10
*
time
.
Second
,
func
()
(
done
bool
,
err
error
)
{
counter
=
atomic
.
LoadUint32
(
atomicCounter
)
return
counter
==
tc
.
watchCount
,
nil
})
if
err
==
wait
.
ErrWaitTimeout
{
t
.
Errorf
(
"expected %d watcher starts, but it has started %d times"
,
tc
.
watchCount
,
counter
)
}
else
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
!
reflect
.
DeepEqual
(
tc
.
expected
,
got
)
{
...
...
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