From ace94917da7948a8d30758862c3e843f5341fbf3 Mon Sep 17 00:00:00 2001 From: Livio Spring Date: Tue, 7 Jun 2022 13:40:46 +0200 Subject: [PATCH] test: ensure consistency of TestSpooler_awaitError (#3750) --- internal/eventstore/v1/spooler/spooler_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/eventstore/v1/spooler/spooler_test.go b/internal/eventstore/v1/spooler/spooler_test.go index bca8e374de..57934fba60 100644 --- a/internal/eventstore/v1/spooler/spooler_test.go +++ b/internal/eventstore/v1/spooler/spooler_test.go @@ -224,12 +224,17 @@ func TestSpooler_awaitError(t *testing.T) { s := &spooledHandler{ Handler: tt.fields.currentHandler, } + c := make(chan interface{}) errs := make(chan error) ctx, cancel := context.WithCancel(context.Background()) - go s.awaitError(cancel, errs, "test") + go func() { + s.awaitError(cancel, errs, "test") + c <- nil + }() errs <- tt.fields.err + <-c if ctx.Err() == nil { t.Error("cancel function was not called") }