We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2439d67 commit 83ae6a7Copy full SHA for 83ae6a7
internal/xtest/leak_test.go
@@ -30,24 +30,15 @@ func TestCheckGoroutinesLeak(t *testing.T) {
30
})
31
t.Run("NoLeak", func(t *testing.T) {
32
TestManyTimes(t, func(t testing.TB) {
33
- var (
34
- leakDetected atomic.Bool
35
- ch = make(chan struct{})
36
- )
37
- func() {
38
- defer func() {
39
- if err := findGoroutinesLeak(); err != nil {
40
- leakDetected.Store(true)
41
- }
42
- }()
43
44
- <-ch
45
46
- go func() {
47
- close(ch)
48
+ defer func() {
+ require.NoError(t, findGoroutinesLeak())
+ }()
+
+ ch := make(chan struct{})
+ go func() {
+ close(ch)
49
}()
50
- require.False(t, leakDetected.Load())
+ <-ch
51
52
53
}
0 commit comments