From e8b8446298d19d05812c9009896c1bab34eef90b Mon Sep 17 00:00:00 2001 From: Alexandros Filios Date: Tue, 21 Jan 2025 16:17:46 +0100 Subject: [PATCH] Fix events test Signed-off-by: Alexandros Filios --- platform/fabric/events_test.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/platform/fabric/events_test.go b/platform/fabric/events_test.go index 070061ae3..a62c0c4f4 100644 --- a/platform/fabric/events_test.go +++ b/platform/fabric/events_test.go @@ -66,21 +66,18 @@ func TestEventListener(t *testing.T) { defer cancel() go func() { defer wg.Done() - stop := false for { select { case event := <-eventChannel: assert.NotNil(t, event) case <-ctx.Done(): - stop = true - } - if stop { listener.CloseChaincodeEvents() - break + return } } }() wg.Wait() + time.Sleep(100 * time.Millisecond) // Ensure the channel is closed select {