Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give TestCloseChannel more time to close the channel #4422

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions internal/pkg/core/backoff/backoff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
type factory func(<-chan struct{}) Backoff

func TestCloseChannel(t *testing.T) {
init := 2 * time.Millisecond
init := time.Second
max := 5 * time.Second

tests := map[string]factory{
Expand All @@ -32,7 +32,7 @@ func TestCloseChannel(t *testing.T) {
c := make(chan struct{})
b := f(c)
close(c)
assert.False(t, b.Wait())
assert.False(t, b.Wait(), "should return false because the channel shuld get closed faster than the next wait duration")
})
}
}
Expand All @@ -59,7 +59,7 @@ func TestUnblockAfterInit(t *testing.T) {

startedAt := time.Now()
assert.True(t, WaitOnError(b, errors.New("bad bad")))
assert.True(t, time.Now().Sub(startedAt) >= init)
assert.True(t, time.Since(startedAt) >= init)
})
}
}
Expand Down Expand Up @@ -87,7 +87,7 @@ func TestNextWait(t *testing.T) {

startedAt := time.Now()
b.Wait()
waitDuration := time.Now().Sub(startedAt)
waitDuration := time.Since(startedAt)
nextWait := b.NextWait()

t.Logf("actualWait: %s startWait: %s nextWait: %s", waitDuration, startWait, nextWait)
Expand Down
Loading