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
84e2d6c3
Commit
84e2d6c3
authored
Jan 02, 2016
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix TestPoll test
parent
e7b41f13
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
wait_test.go
pkg/util/wait/wait_test.go
+7
-8
No files found.
pkg/util/wait/wait_test.go
View file @
84e2d6c3
...
@@ -84,7 +84,7 @@ func TestPoll(t *testing.T) {
...
@@ -84,7 +84,7 @@ func TestPoll(t *testing.T) {
return
true
,
nil
return
true
,
nil
})
})
fp
:=
fakePoller
{
max
:
1
}
fp
:=
fakePoller
{
max
:
1
}
if
err
:=
pollInternal
(
fp
.
GetWaitFunc
(
time
.
Microsecond
,
time
.
Micros
econd
),
f
);
err
!=
nil
{
if
err
:=
pollInternal
(
fp
.
GetWaitFunc
(
time
.
Microsecond
,
time
.
S
econd
),
f
);
err
!=
nil
{
t
.
Fatalf
(
"unexpected error %v"
,
err
)
t
.
Fatalf
(
"unexpected error %v"
,
err
)
}
}
if
invocations
!=
1
{
if
invocations
!=
1
{
...
@@ -94,19 +94,18 @@ func TestPoll(t *testing.T) {
...
@@ -94,19 +94,18 @@ func TestPoll(t *testing.T) {
if
used
!=
1
{
if
used
!=
1
{
t
.
Errorf
(
"Expected exactly one tick, got %d"
,
used
)
t
.
Errorf
(
"Expected exactly one tick, got %d"
,
used
)
}
}
}
func
TestPollError
(
t
*
testing
.
T
)
{
expectedError
:=
errors
.
New
(
"Expected error"
)
expectedError
:=
errors
.
New
(
"Expected error"
)
f
=
ConditionFunc
(
func
()
(
bool
,
error
)
{
f
:
=
ConditionFunc
(
func
()
(
bool
,
error
)
{
return
false
,
expectedError
return
false
,
expectedError
})
})
fp
=
fakePoller
{
max
:
1
}
fp
:
=
fakePoller
{
max
:
1
}
if
err
:=
pollInternal
(
fp
.
GetWaitFunc
(
time
.
Microsecond
,
time
.
Micros
econd
),
f
);
err
==
nil
||
err
!=
expectedError
{
if
err
:=
pollInternal
(
fp
.
GetWaitFunc
(
time
.
Microsecond
,
time
.
S
econd
),
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
)
}
}
if
invocations
!=
1
{
used
:=
atomic
.
LoadInt32
(
&
fp
.
used
)
t
.
Errorf
(
"Expected exactly one invocation, got %d"
,
invocations
)
}
used
=
atomic
.
LoadInt32
(
&
fp
.
used
)
if
used
!=
1
{
if
used
!=
1
{
t
.
Errorf
(
"Expected exactly one tick, got %d"
,
used
)
t
.
Errorf
(
"Expected exactly one tick, 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