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

Update timers for go1.23 #2663

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
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
31 changes: 7 additions & 24 deletions assigner/core/assigner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ func TestAssignerAll(t *testing.T) {
t.Fatal("timed out waiting for assignment")
}
}
if !timeout.Stop() {
<-timeout.C
}
timeout.Stop()
require.Equal(t, 1, len(assigns))
require.Equal(t, 0, assigns[0])

Expand Down Expand Up @@ -178,9 +176,7 @@ func TestAssignerAll(t *testing.T) {
t.Fatal("timed out waiting for assignment")
}
}
if !timeout.Stop() {
<-timeout.C
}
timeout.Stop()
sort.Ints(assigns)
require.Equal(t, []int{0, 1}, assigns)

Expand Down Expand Up @@ -271,9 +267,7 @@ func TestAssignerOne(t *testing.T) {
t.Fatal("timed out waiting for assignment")
}
}
if !timeout.Stop() {
<-timeout.C
}
timeout.Stop()
require.Equal(t, 1, len(assigns))
require.Equal(t, 0, assigns[0])

Expand Down Expand Up @@ -306,9 +300,7 @@ func TestAssignerOne(t *testing.T) {
t.Fatal("timed out waiting for assignment")
}
}
if !timeout.Stop() {
<-timeout.C
}
timeout.Stop()
require.Equal(t, 1, len(assigns))
require.Equal(t, 1, assigns[0])

Expand Down Expand Up @@ -431,9 +423,7 @@ func TestAssignerPreferred(t *testing.T) {
t.Fatal("timed out waiting for assignment")
}
}
if !timeout.Stop() {
<-timeout.C
}
timeout.Stop()
require.Equal(t, 1, len(assigns))
require.Equal(t, 1, assigns[0], "expected assignment to indexer 1")

Expand Down Expand Up @@ -466,9 +456,7 @@ func TestAssignerPreferred(t *testing.T) {
t.Fatal("timed out waiting for assignment")
}
}
if !timeout.Stop() {
<-timeout.C
}
timeout.Stop()
require.Equal(t, 1, len(assigns))
require.Equal(t, 1, assigns[0], "expected assignment to indexer 1")

Expand Down Expand Up @@ -743,9 +731,7 @@ func TestFreezeHandoff(t *testing.T) {
t.Fatal("timed out waiting for assignment")
}
}
if !timeout.Stop() {
<-timeout.C
}
timeout.Stop()
require.Equal(t, 1, len(assigns))
require.Equal(t, 0, assigns[0])

Expand All @@ -771,9 +757,6 @@ func TestFreezeHandoff(t *testing.T) {
t.Fatal("timed out waiting for handoff")
}
}
if !timeout.Stop() {
<-timeout.C
}

timeout.Reset(time.Second)
select {
Expand Down
4 changes: 1 addition & 3 deletions internal/registry/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,7 @@ func TestPollProvider(t *testing.T) {
case <-timeout.C:
t.Fatal("Expected sync channel to be written")
}
if !timeout.Stop() {
<-timeout.C
}
timeout.Stop()

// Check that registry is not blocked by unread auto-sync channel.
poll.retryAfter = 0
Expand Down
Loading