diff --git a/debounce/simple_debouncer_test.go b/debounce/simple_debouncer_test.go index fe8a0a0da..7e145bed0 100644 --- a/debounce/simple_debouncer_test.go +++ b/debounce/simple_debouncer_test.go @@ -1,9 +1,9 @@ package debounce import ( - "runtime" "sync/atomic" "testing" + "time" ) // TestDebouncer tests that the debouncer allows only one function to execute at a time @@ -52,11 +52,12 @@ func TestSimpleDebouncer(t *testing.T) { } }) } + func waitTillChannelIsEmpty(ch chan struct{}) { for { if len(ch) == 0 { return } - runtime.Gosched() + time.Sleep(100 * time.Millisecond) } }