Skip to content

Commit

Permalink
Switch back to time.Sleep
Browse files Browse the repository at this point in the history
I thought time.After would speed up the test case execution.
As far as I can tell, this is not the case. Therefore, switch back to
time.Sleep since I feel it is more readable.
  • Loading branch information
tho committed Apr 20, 2023
1 parent 1e55af6 commit e57609a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestJWKS_RefreshCancelCtx(t *testing.T) {

// Wait for the first refresh to occur to ensure the
// JWKS gets refreshed at least once.
<-time.After(1100 * time.Millisecond)
time.Sleep(1100 * time.Millisecond)

if tc.cancelOptionsCtx {
cancel()
Expand All @@ -146,14 +146,14 @@ func TestJWKS_RefreshCancelCtx(t *testing.T) {
// Wait for another refresh cycle to occur to ensure the
// JWKS either did or did not get refreshed depending on
// whether the passed Options.Ctx has been canceled.
<-time.After(1100 * time.Millisecond)
time.Sleep(1101 * time.Millisecond)

jwks.EndBackground()

// Wait for another refresh cycle to occur to verify that
// the JWKS did not get refreshed after EndBackground()
// has been called.
<-time.After(1100 * time.Millisecond)
time.Sleep(1100 * time.Millisecond)

count := atomic.LoadUint64(&counter)
if count != uint64(tc.expectedRefreshes) {
Expand Down

0 comments on commit e57609a

Please sign in to comment.