Skip to content

`lib/group`: fix race condition in test

Warren Gifford requested to merge cc/fix-flaky-test into main

Created by: camdencheek

This test has a race condition. It can be triggered consistently by adding a defer func() { time.Sleep(100 * time.Millisecond) }() before the defer close(synchronizer). Unfortunately, I don't think it's possible to completely remove the race condition without extending the API of the group, so in this commit I resort to adding a sleep that makes hitting the race condition vanishingly unlikely.

Test plan

Tested that the race condition is not hit with an added sleep.

Merge request reports

Loading