From 41eb2627aecd618b829c0457210ccae6ee84fda3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Pa=C3=9F?= <22845248+mpass99@users.noreply.github.com> Date: Wed, 15 Nov 2023 00:02:36 +0100 Subject: [PATCH] Handle stopping goroutines of the MemoryLeakTestSuite. We observed a race condition that sometimes goroutines are just closing but still measured by the goroutine Lookup of the following test. We try to avoid this by adding `runtime.Gosched()` at the start of each test. --- tests/util.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/util.go b/tests/util.go index c2d0ea4..5e99c4b 100644 --- a/tests/util.go +++ b/tests/util.go @@ -39,6 +39,8 @@ type MemoryLeakTestSuite struct { } func (s *MemoryLeakTestSuite) SetupTest() { + // Without this first line we observed some goroutines just closing. + runtime.Gosched() s.ExpectedGoroutingIncrease = 0 s.goroutinesBefore = &bytes.Buffer{}