Skip to content

Commit 64b40bd

Browse files
wait for gc in lock tracker test (#934)
* wait for gc in lock tracker test * cleanup * generated protobuf --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 69cf309 commit 64b40bd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

utils/lock_tracker_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,21 @@ func TestMutexFinalizer(t *testing.T) {
9696
cleanupTest()
9797
require.Equal(t, 0, utils.NumMutexes())
9898

99-
go func() {
99+
{
100100
m := &utils.Mutex{}
101101
m.Lock()
102102
go func() {
103103
m.Unlock()
104104
}()
105105
require.Equal(t, 1, utils.NumMutexes())
106-
}()
106+
}
107107

108-
time.Sleep(time.Millisecond)
109-
cleanupTest()
108+
for range 100 {
109+
cleanupTest()
110+
if utils.NumMutexes() == 0 {
111+
break
112+
}
113+
}
110114

111115
require.Equal(t, 0, utils.NumMutexes())
112116
}

0 commit comments

Comments
 (0)