Skip to content

Commit

Permalink
Fix flaky integrations tests (#47217)
Browse files Browse the repository at this point in the history
In these tests, the events and error channels are closed at
approximately the same time. If the test's select statement
sees the closure of the error channel first, then it will see
a nil error. This should not be considered a test failure, as
there was no error.
  • Loading branch information
zmb3 authored Oct 4, 2024
1 parent 44b5311 commit eb38691
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions integrations/event-handler/teleport_events_watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func TestEvents(t *testing.T) {
return
}
case err := <-chErr:
t.Fatalf("Received unexpected error from error channel: %v", err)
require.NoError(t, err)
return
case <-time.After(2 * time.Second):
t.Fatalf("No events received within deadline")
Expand Down Expand Up @@ -313,7 +313,7 @@ func TestUpdatePage(t *testing.T) {
return
}
case err := <-chErr:
t.Fatalf("Received unexpected error from error channel: %v", err)
require.NoError(t, err)
return
case <-time.After(2 * time.Second):
t.Fatalf("No events received within deadline")
Expand All @@ -340,7 +340,7 @@ func TestUpdatePage(t *testing.T) {
return
}
case err := <-chErr:
t.Fatalf("Received unexpected error from error channel: %v", err)
require.NoError(t, err)
return
case <-time.After(2 * time.Second):
t.Fatalf("No events received within deadline")
Expand All @@ -367,7 +367,7 @@ func TestUpdatePage(t *testing.T) {
return
}
case err := <-chErr:
t.Fatalf("Received unexpected error from error channel: %v", err)
require.NoError(t, err)
return
case <-time.After(2 * time.Second):
t.Fatalf("No events received within deadline")
Expand Down Expand Up @@ -591,7 +591,7 @@ func TestEventsWithWindowSkip(t *testing.T) {
return
}
case err := <-chErr:
t.Fatalf("Received unexpected error from error channel: %v", err)
require.NoError(t, err)
return
case <-time.After(2 * time.Second):
t.Fatalf("No events received within deadline")
Expand All @@ -607,7 +607,7 @@ func TestEventsWithWindowSkip(t *testing.T) {
return
}
case err := <-chErr:
t.Fatalf("Received unexpected error from error channel: %v", err)
require.NoError(t, err)
return
case <-time.After(2 * time.Second):
t.Fatalf("No events received within deadline")
Expand Down

0 comments on commit eb38691

Please sign in to comment.