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
88663fc5
Commit
88663fc5
authored
May 23, 2016
by
Brendan Burns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some extra checking in the tests to prevent flakes.
parent
51e30841
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
controller_test.go
pkg/controller/persistentvolume/controller_test.go
+7
-2
No files found.
pkg/controller/persistentvolume/controller_test.go
View file @
88663fc5
...
@@ -33,6 +33,7 @@ import (
...
@@ -33,6 +33,7 @@ import (
// can't reliably simulate periodic sync of volumes/claims - it would be
// can't reliably simulate periodic sync of volumes/claims - it would be
// either very timing-sensitive or slow to wait for real periodic sync.
// either very timing-sensitive or slow to wait for real periodic sync.
func
TestControllerSync
(
t
*
testing
.
T
)
{
func
TestControllerSync
(
t
*
testing
.
T
)
{
expectedChanges
:=
[]
int
{
1
,
4
,
1
,
1
}
tests
:=
[]
controllerTest
{
tests
:=
[]
controllerTest
{
// [Unit test set 5] - controller tests.
// [Unit test set 5] - controller tests.
// We test the controller as if
// We test the controller as if
...
@@ -121,7 +122,7 @@ func TestControllerSync(t *testing.T) {
...
@@ -121,7 +122,7 @@ func TestControllerSync(t *testing.T) {
},
},
}
}
for
_
,
test
:=
range
tests
{
for
ix
,
test
:=
range
tests
{
glog
.
V
(
4
)
.
Infof
(
"starting test %q"
,
test
.
name
)
glog
.
V
(
4
)
.
Infof
(
"starting test %q"
,
test
.
name
)
// Initialize the controller
// Initialize the controller
...
@@ -148,13 +149,17 @@ func TestControllerSync(t *testing.T) {
...
@@ -148,13 +149,17 @@ func TestControllerSync(t *testing.T) {
time
.
Sleep
(
10
*
time
.
Millisecond
)
time
.
Sleep
(
10
*
time
.
Millisecond
)
}
}
count
:=
reactor
.
getChangeCount
()
// Call the tested function
// Call the tested function
err
:=
test
.
test
(
ctrl
,
reactor
,
test
)
err
:=
test
.
test
(
ctrl
,
reactor
,
test
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Test %q initial test call failed: %v"
,
test
.
name
,
err
)
t
.
Errorf
(
"Test %q initial test call failed: %v"
,
test
.
name
,
err
)
}
}
reactor
.
waitTest
()
for
reactor
.
getChangeCount
()
<
count
+
expectedChanges
[
ix
]
{
reactor
.
waitTest
()
}
evaluateTestResults
(
ctrl
,
reactor
,
test
,
t
)
evaluateTestResults
(
ctrl
,
reactor
,
test
,
t
)
}
}
...
...
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