mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #19259 from gmarek/small-fix
Auto commit by PR queue bot
This commit is contained in:
commit
8b72fff9c0
@ -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) {
|
|||||||
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) {
|
|||||||
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) {
|
|||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user