Skip to content

Commit

Permalink
[v16] Fix TestInitDatabaseService/enabled_invalid_databases flakine…
Browse files Browse the repository at this point in the history
…ss (#43204)

* test(service): assert teleport ready event instead of context deadline

* test(service): remove loop variable
  • Loading branch information
gabrielcorado authored Jun 18, 2024
1 parent dac58a2 commit 8e9e05c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1793,17 +1793,16 @@ func TestInitDatabaseService(t *testing.T) {
})
require.NoError(t, process.Start())

ctx, cancel := context.WithTimeout(context.Background(), time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

event, err := process.WaitForEvent(ctx, ServiceExitedWithErrorEvent)
if !test.expectErr {
// should timeout without the process exit event.
require.Error(t, err)
require.ErrorIs(t, err, context.DeadlineExceeded)
_, err := process.WaitForEvent(ctx, TeleportReadyEvent)
require.NoError(t, err)
return
}

event, err := process.WaitForEvent(ctx, ServiceExitedWithErrorEvent)
require.NoError(t, err)
require.NotNil(t, event)
exitPayload, ok := event.Payload.(ExitEventPayload)
Expand Down

0 comments on commit 8e9e05c

Please sign in to comment.