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
8b72fff9
Commit
8b72fff9
authored
Jan 05, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19259 from gmarek/small-fix
Auto commit by PR queue bot
parents
e663dbc3
93b180e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
wait_test.go
pkg/util/wait/wait_test.go
+6
-4
No files found.
pkg/util/wait/wait_test.go
View file @
8b72fff9
...
@@ -87,7 +87,7 @@ func TestPoll(t *testing.T) {
...
@@ -87,7 +87,7 @@ func TestPoll(t *testing.T) {
invocations
++
invocations
++
return
true
,
nil
return
true
,
nil
})
})
fp
:=
fakePoller
{
max
:
1
,
wg
:
sync
.
WaitGroup
{}
}
fp
:=
fakePoller
{
max
:
1
}
if
err
:=
pollInternal
(
fp
.
GetWaitFunc
(),
f
);
err
!=
nil
{
if
err
:=
pollInternal
(
fp
.
GetWaitFunc
(),
f
);
err
!=
nil
{
t
.
Fatalf
(
"unexpected error %v"
,
err
)
t
.
Fatalf
(
"unexpected error %v"
,
err
)
}
}
...
@@ -106,7 +106,7 @@ func TestPollError(t *testing.T) {
...
@@ -106,7 +106,7 @@ func TestPollError(t *testing.T) {
f
:=
ConditionFunc
(
func
()
(
bool
,
error
)
{
f
:=
ConditionFunc
(
func
()
(
bool
,
error
)
{
return
false
,
expectedError
return
false
,
expectedError
})
})
fp
:=
fakePoller
{
max
:
1
,
wg
:
sync
.
WaitGroup
{}
}
fp
:=
fakePoller
{
max
:
1
}
if
err
:=
pollInternal
(
fp
.
GetWaitFunc
(),
f
);
err
==
nil
||
err
!=
expectedError
{
if
err
:=
pollInternal
(
fp
.
GetWaitFunc
(),
f
);
err
==
nil
||
err
!=
expectedError
{
t
.
Fatalf
(
"Expected error %v, got none %v"
,
expectedError
,
err
)
t
.
Fatalf
(
"Expected error %v, got none %v"
,
expectedError
,
err
)
}
}
...
@@ -123,10 +123,11 @@ func TestPollImmediate(t *testing.T) {
...
@@ -123,10 +123,11 @@ func TestPollImmediate(t *testing.T) {
invocations
++
invocations
++
return
true
,
nil
return
true
,
nil
})
})
fp
:=
fakePoller
{
max
:
0
,
wg
:
sync
.
WaitGroup
{}
}
fp
:=
fakePoller
{
max
:
0
}
if
err
:=
pollImmediateInternal
(
fp
.
GetWaitFunc
(),
f
);
err
!=
nil
{
if
err
:=
pollImmediateInternal
(
fp
.
GetWaitFunc
(),
f
);
err
!=
nil
{
t
.
Fatalf
(
"unexpected error %v"
,
err
)
t
.
Fatalf
(
"unexpected error %v"
,
err
)
}
}
// We don't need to wait for fp.wg, as pollImmediate shouldn't call WaitFunc at all.
if
invocations
!=
1
{
if
invocations
!=
1
{
t
.
Errorf
(
"Expected exactly one invocation, got %d"
,
invocations
)
t
.
Errorf
(
"Expected exactly one invocation, got %d"
,
invocations
)
}
}
...
@@ -141,10 +142,11 @@ func TestPollImmediateError(t *testing.T) {
...
@@ -141,10 +142,11 @@ func TestPollImmediateError(t *testing.T) {
f
:=
ConditionFunc
(
func
()
(
bool
,
error
)
{
f
:=
ConditionFunc
(
func
()
(
bool
,
error
)
{
return
false
,
expectedError
return
false
,
expectedError
})
})
fp
:=
fakePoller
{
max
:
0
,
wg
:
sync
.
WaitGroup
{}
}
fp
:=
fakePoller
{
max
:
0
}
if
err
:=
pollImmediateInternal
(
fp
.
GetWaitFunc
(),
f
);
err
==
nil
||
err
!=
expectedError
{
if
err
:=
pollImmediateInternal
(
fp
.
GetWaitFunc
(),
f
);
err
==
nil
||
err
!=
expectedError
{
t
.
Fatalf
(
"Expected error %v, got none %v"
,
expectedError
,
err
)
t
.
Fatalf
(
"Expected error %v, got none %v"
,
expectedError
,
err
)
}
}
// We don't need to wait for fp.wg, as pollImmediate shouldn't call WaitFunc at all.
used
:=
atomic
.
LoadInt32
(
&
fp
.
used
)
used
:=
atomic
.
LoadInt32
(
&
fp
.
used
)
if
used
!=
0
{
if
used
!=
0
{
t
.
Errorf
(
"Expected exactly zero ticks, got %d"
,
used
)
t
.
Errorf
(
"Expected exactly zero ticks, got %d"
,
used
)
...
...
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