diff --git a/lib/srv/git/forward_test.go b/lib/srv/git/forward_test.go index 5ca51bcef8261..6275be7841be5 100644 --- a/lib/srv/git/forward_test.go +++ b/lib/srv/git/forward_test.go @@ -258,6 +258,10 @@ func TestForwardServer(t *testing.T) { test.verifyWithClient(t, ctx, client, mockGitService) if test.verifyEvent != nil { + // Server emits exec event after sending result to client. + require.EventuallyWithT(t, func(t *assert.CollectT) { + assert.NotNil(t, mockEmitter.LastEvent()) + }, time.Second*2, time.Millisecond*100, "Timeout waiting for audit event.") test.verifyEvent(t, mockEmitter.LastEvent()) } })