Skip to content

Commit

Permalink
Revert "Third time is the charm: fix flaky test"
Browse files Browse the repository at this point in the history
This reverts commit 24b9a0f.
  • Loading branch information
thiagokokada committed Mar 5, 2024
1 parent ac54d84 commit 1e66e8d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/core/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ func TestPause(t *testing.T) {
func TestPauseCancel(t *testing.T) {
resetCounters()

ctx, cancelCtx := context.WithCancel(context.Background())
cancelCtx()
const timeout = time.Second
// will be cancelled before the timeout
ctx, cancelCtx := context.WithTimeout(context.Background(), timeout/10)
defer cancelCtx()

callbackPreCalled := false
callbackPosCalled := false
Expand All @@ -118,7 +120,9 @@ func TestPauseCancel(t *testing.T) {
assert.Equal(t, callbackPreCalled, false)
assert.Equal(t, callbackPosCalled, false)
assert.Equal(t, notifier.notificationCount.Load(), 0)
assert.Equal(t, notifier.notificationCancelCount.Load(), 0)
// this may be called or not, because we are using the same ctx for the main
// loop and the pause
assert.GreaterOrEqual(t, notifier.notificationCancelCount.Load(), 0)
}

func TestPauseNilCallbacks(t *testing.T) {
Expand Down

0 comments on commit 1e66e8d

Please sign in to comment.