mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
chore: update to coder/quartz v0.2.0 (#18007)
Upgrade to coder/quartz v0.2.0 including fixing up a minor API breaking change.
This commit is contained in:
@ -104,7 +104,7 @@ func TestNotifier(t *testing.T) {
|
||||
n := notify.New(cond, testCase.PollInterval, testCase.Countdown, notify.WithTestClock(mClock))
|
||||
defer n.Close()
|
||||
|
||||
trap.MustWait(ctx).Release() // ensure ticker started
|
||||
trap.MustWait(ctx).MustRelease(ctx) // ensure ticker started
|
||||
for i := 0; i < testCase.NTicks; i++ {
|
||||
interval, w := mClock.AdvanceNext()
|
||||
w.MustWait(ctx)
|
||||
|
@ -423,7 +423,7 @@ func TestCryptoKeyCache(t *testing.T) {
|
||||
require.Equal(t, 2, ff.called)
|
||||
require.Equal(t, decodedSecret(t, newKey), key)
|
||||
|
||||
trapped.Release()
|
||||
trapped.MustRelease(ctx)
|
||||
wait.MustWait(ctx)
|
||||
require.Equal(t, 2, ff.called)
|
||||
trap.Close()
|
||||
|
@ -72,7 +72,7 @@ func TestRotator(t *testing.T) {
|
||||
require.Len(t, dbkeys, initialKeyLen)
|
||||
requireContainsAllFeatures(t, dbkeys)
|
||||
|
||||
trap.MustWait(ctx).Release()
|
||||
trap.MustWait(ctx).MustRelease(ctx)
|
||||
_, wait := clock.AdvanceNext()
|
||||
wait.MustWait(ctx)
|
||||
|
||||
|
@ -279,10 +279,10 @@ func awaitDoTick(ctx context.Context, t *testing.T, clk *quartz.Mock) chan struc
|
||||
defer trapStop.Close()
|
||||
defer trapNow.Close()
|
||||
// Wait for the initial tick signified by a call to Now().
|
||||
trapNow.MustWait(ctx).Release()
|
||||
trapNow.MustWait(ctx).MustRelease(ctx)
|
||||
// doTick runs here. Wait for the next
|
||||
// ticker reset event that signifies it's completed.
|
||||
trapReset.MustWait(ctx).Release()
|
||||
trapReset.MustWait(ctx).MustRelease(ctx)
|
||||
// Ensure that the next tick happens in 10 minutes from start.
|
||||
d, w := clk.AdvanceNext()
|
||||
if !assert.Equal(t, 10*time.Minute, d) {
|
||||
@ -290,7 +290,7 @@ func awaitDoTick(ctx context.Context, t *testing.T, clk *quartz.Mock) chan struc
|
||||
}
|
||||
w.MustWait(ctx)
|
||||
// Wait for the ticker stop event.
|
||||
trapStop.MustWait(ctx).Release()
|
||||
trapStop.MustWait(ctx).MustRelease(ctx)
|
||||
}()
|
||||
|
||||
return ch
|
||||
|
@ -32,7 +32,7 @@ func TestWatchdog_NoTimeout(t *testing.T) {
|
||||
// right baseline time.
|
||||
pc, err := pubTrap.Wait(ctx)
|
||||
require.NoError(t, err)
|
||||
pc.Release()
|
||||
pc.MustRelease(ctx)
|
||||
require.Equal(t, 15*time.Second, pc.Duration)
|
||||
|
||||
// we subscribe after starting the timer, so we know the timer also starts
|
||||
@ -66,7 +66,7 @@ func TestWatchdog_NoTimeout(t *testing.T) {
|
||||
}()
|
||||
sc, err := subTrap.Wait(ctx) // timer.Stop() called
|
||||
require.NoError(t, err)
|
||||
sc.Release()
|
||||
sc.MustRelease(ctx)
|
||||
err = testutil.TryReceive(ctx, t, errCh)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
@ -88,7 +88,7 @@ func TestWatchdog_Timeout(t *testing.T) {
|
||||
// right baseline time.
|
||||
pc, err := pubTrap.Wait(ctx)
|
||||
require.NoError(t, err)
|
||||
pc.Release()
|
||||
pc.MustRelease(ctx)
|
||||
require.Equal(t, 15*time.Second, pc.Duration)
|
||||
|
||||
// we subscribe after starting the timer, so we know the timer also starts
|
||||
|
@ -276,8 +276,8 @@ func TestPendingUpdatesMetric(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
mgr.Run(ctx)
|
||||
trap.MustWait(ctx).Release() // ensures ticker has been set
|
||||
fetchTrap.MustWait(ctx).Release()
|
||||
trap.MustWait(ctx).MustRelease(ctx) // ensures ticker has been set
|
||||
fetchTrap.MustWait(ctx).MustRelease(ctx)
|
||||
|
||||
// Advance to the first fetch
|
||||
mClock.Advance(cfg.FetchInterval.Value()).MustWait(ctx)
|
||||
|
@ -341,8 +341,8 @@ func TestBackpressure(t *testing.T) {
|
||||
|
||||
// Start the notifier.
|
||||
mgr.Run(ctx)
|
||||
syncTrap.MustWait(ctx).Release()
|
||||
fetchTrap.MustWait(ctx).Release()
|
||||
syncTrap.MustWait(ctx).MustRelease(ctx)
|
||||
fetchTrap.MustWait(ctx).MustRelease(ctx)
|
||||
|
||||
// THEN:
|
||||
|
||||
|
Reference in New Issue
Block a user