From 673ab1a5d607f3047257777bf685d55b284c0398 Mon Sep 17 00:00:00 2001 From: Wassim DHIF Date: Mon, 16 Dec 2024 18:01:38 +0100 Subject: [PATCH] fix(kubernetes_admission_events): flush events after emitting them Signed-off-by: Wassim DHIF --- .../kubernetesadmissionevents/kubernetesadmissionevents_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/clusteragent/admission/validate/kubernetesadmissionevents/kubernetesadmissionevents_test.go b/pkg/clusteragent/admission/validate/kubernetesadmissionevents/kubernetesadmissionevents_test.go index 81d58c49a00ce..8f63153a2bc1f 100644 --- a/pkg/clusteragent/admission/validate/kubernetesadmissionevents/kubernetesadmissionevents_test.go +++ b/pkg/clusteragent/admission/validate/kubernetesadmissionevents/kubernetesadmissionevents_test.go @@ -251,9 +251,9 @@ func TestKubernetesAdmissionEvents(t *testing.T) { // Emit the event start := time.Now() mockSender.On("Event", mock.AnythingOfType("event.Event")).Return().Once() + validated, err := kubernetesAuditWebhook.emitEvent(&tt.request, "", nil) // Force flush to serializer to ensure the event is emitted and received. demultiplexerMock.ForceFlushToSerializer(start, true) - validated, err := kubernetesAuditWebhook.emitEvent(&tt.request, "", nil) assert.NoError(t, err) assert.True(t, validated) if tt.expectedEmitted {