From 865da9c525488b6bbb046a278567b4214d8ed7f5 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sat, 14 Dec 2024 00:43:11 -0300 Subject: [PATCH] fn/ContextGuard: test cancelling blocking context Make sure WgWait() doesn't block. --- fn/context_guard_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fn/context_guard_test.go b/fn/context_guard_test.go index e13cba5dc..76d63a50f 100644 --- a/fn/context_guard_test.go +++ b/fn/context_guard_test.go @@ -298,6 +298,12 @@ func TestContextGuard(t *testing.T) { case <-time.After(time.Second): t.Fatalf("timeout") } + + // Cancel the context. + cancel() + + // Make sure wg's counter gets to 0 eventually. + g.WgWait() }) // Test that if we add the CustomTimeoutCGOpt option, then the context