Skip to content

Commit 6c0bed0

Browse files
authored
chore: update to coder/quartz v0.2.0 (#18007)
Upgrade to coder/quartz v0.2.0 including fixing up a minor API breaking change.
1 parent 9ada123 commit 6c0bed0

File tree

17 files changed

+49
-50
lines changed

17 files changed

+49
-50
lines changed

agent/agentcontainers/api_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func TestAPI(t *testing.T) {
257257

258258
// Make sure the ticker function has been registered
259259
// before advancing the clock.
260-
tickerTrap.MustWait(ctx).Release()
260+
tickerTrap.MustWait(ctx).MustRelease(ctx)
261261
tickerTrap.Close()
262262

263263
// Initial request returns the initial data.
@@ -432,7 +432,7 @@ func TestAPI(t *testing.T) {
432432

433433
// Make sure the ticker function has been registered
434434
// before advancing the clock.
435-
tickerTrap.MustWait(ctx).Release()
435+
tickerTrap.MustWait(ctx).MustRelease(ctx)
436436
tickerTrap.Close()
437437

438438
for i := range tt.wantStatus {
@@ -486,7 +486,7 @@ func TestAPI(t *testing.T) {
486486
nowRecreateSuccessTrap.Close()
487487
// The timestamp for the error will be stored, which gives
488488
// us a good anchor point to know when to do our request.
489-
nowRecreateErrorTrap.MustWait(ctx).Release()
489+
nowRecreateErrorTrap.MustWait(ctx).MustRelease(ctx)
490490
nowRecreateErrorTrap.Close()
491491

492492
// Advance the clock to run the devcontainer state update routine.
@@ -507,7 +507,7 @@ func TestAPI(t *testing.T) {
507507
}
508508

509509
// Ensure the devcontainer ends up in success state.
510-
nowRecreateSuccessTrap.MustWait(ctx).Release()
510+
nowRecreateSuccessTrap.MustWait(ctx).MustRelease(ctx)
511511
nowRecreateSuccessTrap.Close()
512512

513513
// Advance the clock to run the devcontainer state update routine.
@@ -911,7 +911,7 @@ func TestAPI(t *testing.T) {
911911

912912
// Make sure the ticker function has been registered
913913
// before advancing any use of mClock.Advance.
914-
tickerTrap.MustWait(ctx).Release()
914+
tickerTrap.MustWait(ctx).MustRelease(ctx)
915915
tickerTrap.Close()
916916

917917
// Make sure the start loop has been called.
@@ -1007,7 +1007,7 @@ func TestAPI(t *testing.T) {
10071007

10081008
// Make sure the ticker function has been registered
10091009
// before advancing any use of mClock.Advance.
1010-
tickerTrap.MustWait(ctx).Release()
1010+
tickerTrap.MustWait(ctx).MustRelease(ctx)
10111011
tickerTrap.Close()
10121012

10131013
// Call the list endpoint first to ensure config files are

agent/apphealth_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func TestAppHealth_Healthy(t *testing.T) {
7878
healthchecksStarted := make([]string, 2)
7979
for i := 0; i < 2; i++ {
8080
c := healthcheckTrap.MustWait(ctx)
81-
c.Release()
81+
c.MustRelease(ctx)
8282
healthchecksStarted[i] = c.Tags[1]
8383
}
8484
slices.Sort(healthchecksStarted)
@@ -87,7 +87,7 @@ func TestAppHealth_Healthy(t *testing.T) {
8787
// advance the clock 1ms before the report ticker starts, so that it's not
8888
// simultaneous with the checks.
8989
mClock.Advance(time.Millisecond).MustWait(ctx)
90-
reportTrap.MustWait(ctx).Release()
90+
reportTrap.MustWait(ctx).MustRelease(ctx)
9191

9292
mClock.Advance(999 * time.Millisecond).MustWait(ctx) // app2 is now healthy
9393

@@ -143,11 +143,11 @@ func TestAppHealth_500(t *testing.T) {
143143

144144
fakeAPI, closeFn := setupAppReporter(ctx, t, slices.Clone(apps), handlers, mClock)
145145
defer closeFn()
146-
healthcheckTrap.MustWait(ctx).Release()
146+
healthcheckTrap.MustWait(ctx).MustRelease(ctx)
147147
// advance the clock 1ms before the report ticker starts, so that it's not
148148
// simultaneous with the checks.
149149
mClock.Advance(time.Millisecond).MustWait(ctx)
150-
reportTrap.MustWait(ctx).Release()
150+
reportTrap.MustWait(ctx).MustRelease(ctx)
151151

152152
mClock.Advance(999 * time.Millisecond).MustWait(ctx) // check gets triggered
153153
mClock.Advance(time.Millisecond).MustWait(ctx) // report gets triggered, but unsent since we are at the threshold
@@ -202,25 +202,25 @@ func TestAppHealth_Timeout(t *testing.T) {
202202

203203
fakeAPI, closeFn := setupAppReporter(ctx, t, apps, handlers, mClock)
204204
defer closeFn()
205-
healthcheckTrap.MustWait(ctx).Release()
205+
healthcheckTrap.MustWait(ctx).MustRelease(ctx)
206206
// advance the clock 1ms before the report ticker starts, so that it's not
207207
// simultaneous with the checks.
208208
mClock.Set(ms(1)).MustWait(ctx)
209-
reportTrap.MustWait(ctx).Release()
209+
reportTrap.MustWait(ctx).MustRelease(ctx)
210210

211211
w := mClock.Set(ms(1000)) // 1st check starts
212-
timeoutTrap.MustWait(ctx).Release()
212+
timeoutTrap.MustWait(ctx).MustRelease(ctx)
213213
mClock.Set(ms(1001)).MustWait(ctx) // report tick, no change
214214
mClock.Set(ms(1999)) // timeout pops
215215
w.MustWait(ctx) // 1st check finished
216216
w = mClock.Set(ms(2000)) // 2nd check starts
217-
timeoutTrap.MustWait(ctx).Release()
217+
timeoutTrap.MustWait(ctx).MustRelease(ctx)
218218
mClock.Set(ms(2001)).MustWait(ctx) // report tick, no change
219219
mClock.Set(ms(2999)) // timeout pops
220220
w.MustWait(ctx) // 2nd check finished
221221
// app is now unhealthy after 2 timeouts
222222
mClock.Set(ms(3000)) // 3rd check starts
223-
timeoutTrap.MustWait(ctx).Release()
223+
timeoutTrap.MustWait(ctx).MustRelease(ctx)
224224
mClock.Set(ms(3001)).MustWait(ctx) // report tick, sends changes
225225

226226
update := testutil.TryReceive(ctx, t, fakeAPI.AppHealthCh())

cli/ssh_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func TestCloserStack_Timeout(t *testing.T) {
206206
defer close(closed)
207207
uut.close(nil)
208208
}()
209-
trap.MustWait(ctx).Release()
209+
trap.MustWait(ctx).MustRelease(ctx)
210210
// top starts right away, but it hangs
211211
testutil.TryReceive(ctx, t, ac[2].started)
212212
// timer pops and we start the middle one

coderd/autobuild/notify/notifier_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func TestNotifier(t *testing.T) {
104104
n := notify.New(cond, testCase.PollInterval, testCase.Countdown, notify.WithTestClock(mClock))
105105
defer n.Close()
106106

107-
trap.MustWait(ctx).Release() // ensure ticker started
107+
trap.MustWait(ctx).MustRelease(ctx) // ensure ticker started
108108
for i := 0; i < testCase.NTicks; i++ {
109109
interval, w := mClock.AdvanceNext()
110110
w.MustWait(ctx)

coderd/cryptokeys/cache_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ func TestCryptoKeyCache(t *testing.T) {
423423
require.Equal(t, 2, ff.called)
424424
require.Equal(t, decodedSecret(t, newKey), key)
425425

426-
trapped.Release()
426+
trapped.MustRelease(ctx)
427427
wait.MustWait(ctx)
428428
require.Equal(t, 2, ff.called)
429429
trap.Close()

coderd/cryptokeys/rotate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func TestRotator(t *testing.T) {
7272
require.Len(t, dbkeys, initialKeyLen)
7373
requireContainsAllFeatures(t, dbkeys)
7474

75-
trap.MustWait(ctx).Release()
75+
trap.MustWait(ctx).MustRelease(ctx)
7676
_, wait := clock.AdvanceNext()
7777
wait.MustWait(ctx)
7878

coderd/database/dbpurge/dbpurge_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,18 +279,18 @@ func awaitDoTick(ctx context.Context, t *testing.T, clk *quartz.Mock) chan struc
279279
defer trapStop.Close()
280280
defer trapNow.Close()
281281
// Wait for the initial tick signified by a call to Now().
282-
trapNow.MustWait(ctx).Release()
282+
trapNow.MustWait(ctx).MustRelease(ctx)
283283
// doTick runs here. Wait for the next
284284
// ticker reset event that signifies it's completed.
285-
trapReset.MustWait(ctx).Release()
285+
trapReset.MustWait(ctx).MustRelease(ctx)
286286
// Ensure that the next tick happens in 10 minutes from start.
287287
d, w := clk.AdvanceNext()
288288
if !assert.Equal(t, 10*time.Minute, d) {
289289
return
290290
}
291291
w.MustWait(ctx)
292292
// Wait for the ticker stop event.
293-
trapStop.MustWait(ctx).Release()
293+
trapStop.MustWait(ctx).MustRelease(ctx)
294294
}()
295295

296296
return ch

coderd/database/pubsub/watchdog_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestWatchdog_NoTimeout(t *testing.T) {
3232
// right baseline time.
3333
pc, err := pubTrap.Wait(ctx)
3434
require.NoError(t, err)
35-
pc.Release()
35+
pc.MustRelease(ctx)
3636
require.Equal(t, 15*time.Second, pc.Duration)
3737

3838
// we subscribe after starting the timer, so we know the timer also starts
@@ -66,7 +66,7 @@ func TestWatchdog_NoTimeout(t *testing.T) {
6666
}()
6767
sc, err := subTrap.Wait(ctx) // timer.Stop() called
6868
require.NoError(t, err)
69-
sc.Release()
69+
sc.MustRelease(ctx)
7070
err = testutil.TryReceive(ctx, t, errCh)
7171
require.NoError(t, err)
7272
}
@@ -88,7 +88,7 @@ func TestWatchdog_Timeout(t *testing.T) {
8888
// right baseline time.
8989
pc, err := pubTrap.Wait(ctx)
9090
require.NoError(t, err)
91-
pc.Release()
91+
pc.MustRelease(ctx)
9292
require.Equal(t, 15*time.Second, pc.Duration)
9393

9494
// we subscribe after starting the timer, so we know the timer also starts

coderd/notifications/metrics_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ func TestPendingUpdatesMetric(t *testing.T) {
276276
require.NoError(t, err)
277277

278278
mgr.Run(ctx)
279-
trap.MustWait(ctx).Release() // ensures ticker has been set
280-
fetchTrap.MustWait(ctx).Release()
279+
trap.MustWait(ctx).MustRelease(ctx) // ensures ticker has been set
280+
fetchTrap.MustWait(ctx).MustRelease(ctx)
281281

282282
// Advance to the first fetch
283283
mClock.Advance(cfg.FetchInterval.Value()).MustWait(ctx)

coderd/notifications/notifications_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,8 @@ func TestBackpressure(t *testing.T) {
341341

342342
// Start the notifier.
343343
mgr.Run(ctx)
344-
syncTrap.MustWait(ctx).Release()
345-
fetchTrap.MustWait(ctx).Release()
344+
syncTrap.MustWait(ctx).MustRelease(ctx)
345+
fetchTrap.MustWait(ctx).MustRelease(ctx)
346346

347347
// THEN:
348348

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy