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:
Spike Curtis
2025-05-27 16:05:03 +04:00
committed by GitHub
parent 9ada1232f3
commit 6c0bed0f53
17 changed files with 49 additions and 50 deletions
+6 -6
View File
@@ -257,7 +257,7 @@ func TestAPI(t *testing.T) {
// Make sure the ticker function has been registered
// before advancing the clock.
tickerTrap.MustWait(ctx).Release()
tickerTrap.MustWait(ctx).MustRelease(ctx)
tickerTrap.Close()
// Initial request returns the initial data.
@@ -432,7 +432,7 @@ func TestAPI(t *testing.T) {
// Make sure the ticker function has been registered
// before advancing the clock.
tickerTrap.MustWait(ctx).Release()
tickerTrap.MustWait(ctx).MustRelease(ctx)
tickerTrap.Close()
for i := range tt.wantStatus {
@@ -486,7 +486,7 @@ func TestAPI(t *testing.T) {
nowRecreateSuccessTrap.Close()
// The timestamp for the error will be stored, which gives
// us a good anchor point to know when to do our request.
nowRecreateErrorTrap.MustWait(ctx).Release()
nowRecreateErrorTrap.MustWait(ctx).MustRelease(ctx)
nowRecreateErrorTrap.Close()
// Advance the clock to run the devcontainer state update routine.
@@ -507,7 +507,7 @@ func TestAPI(t *testing.T) {
}
// Ensure the devcontainer ends up in success state.
nowRecreateSuccessTrap.MustWait(ctx).Release()
nowRecreateSuccessTrap.MustWait(ctx).MustRelease(ctx)
nowRecreateSuccessTrap.Close()
// Advance the clock to run the devcontainer state update routine.
@@ -911,7 +911,7 @@ func TestAPI(t *testing.T) {
// Make sure the ticker function has been registered
// before advancing any use of mClock.Advance.
tickerTrap.MustWait(ctx).Release()
tickerTrap.MustWait(ctx).MustRelease(ctx)
tickerTrap.Close()
// Make sure the start loop has been called.
@@ -1007,7 +1007,7 @@ func TestAPI(t *testing.T) {
// Make sure the ticker function has been registered
// before advancing any use of mClock.Advance.
tickerTrap.MustWait(ctx).Release()
tickerTrap.MustWait(ctx).MustRelease(ctx)
tickerTrap.Close()
// Call the list endpoint first to ensure config files are
+9 -9
View File
@@ -78,7 +78,7 @@ func TestAppHealth_Healthy(t *testing.T) {
healthchecksStarted := make([]string, 2)
for i := 0; i < 2; i++ {
c := healthcheckTrap.MustWait(ctx)
c.Release()
c.MustRelease(ctx)
healthchecksStarted[i] = c.Tags[1]
}
slices.Sort(healthchecksStarted)
@@ -87,7 +87,7 @@ func TestAppHealth_Healthy(t *testing.T) {
// advance the clock 1ms before the report ticker starts, so that it's not
// simultaneous with the checks.
mClock.Advance(time.Millisecond).MustWait(ctx)
reportTrap.MustWait(ctx).Release()
reportTrap.MustWait(ctx).MustRelease(ctx)
mClock.Advance(999 * time.Millisecond).MustWait(ctx) // app2 is now healthy
@@ -143,11 +143,11 @@ func TestAppHealth_500(t *testing.T) {
fakeAPI, closeFn := setupAppReporter(ctx, t, slices.Clone(apps), handlers, mClock)
defer closeFn()
healthcheckTrap.MustWait(ctx).Release()
healthcheckTrap.MustWait(ctx).MustRelease(ctx)
// advance the clock 1ms before the report ticker starts, so that it's not
// simultaneous with the checks.
mClock.Advance(time.Millisecond).MustWait(ctx)
reportTrap.MustWait(ctx).Release()
reportTrap.MustWait(ctx).MustRelease(ctx)
mClock.Advance(999 * time.Millisecond).MustWait(ctx) // check gets triggered
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) {
fakeAPI, closeFn := setupAppReporter(ctx, t, apps, handlers, mClock)
defer closeFn()
healthcheckTrap.MustWait(ctx).Release()
healthcheckTrap.MustWait(ctx).MustRelease(ctx)
// advance the clock 1ms before the report ticker starts, so that it's not
// simultaneous with the checks.
mClock.Set(ms(1)).MustWait(ctx)
reportTrap.MustWait(ctx).Release()
reportTrap.MustWait(ctx).MustRelease(ctx)
w := mClock.Set(ms(1000)) // 1st check starts
timeoutTrap.MustWait(ctx).Release()
timeoutTrap.MustWait(ctx).MustRelease(ctx)
mClock.Set(ms(1001)).MustWait(ctx) // report tick, no change
mClock.Set(ms(1999)) // timeout pops
w.MustWait(ctx) // 1st check finished
w = mClock.Set(ms(2000)) // 2nd check starts
timeoutTrap.MustWait(ctx).Release()
timeoutTrap.MustWait(ctx).MustRelease(ctx)
mClock.Set(ms(2001)).MustWait(ctx) // report tick, no change
mClock.Set(ms(2999)) // timeout pops
w.MustWait(ctx) // 2nd check finished
// app is now unhealthy after 2 timeouts
mClock.Set(ms(3000)) // 3rd check starts
timeoutTrap.MustWait(ctx).Release()
timeoutTrap.MustWait(ctx).MustRelease(ctx)
mClock.Set(ms(3001)).MustWait(ctx) // report tick, sends changes
update := testutil.TryReceive(ctx, t, fakeAPI.AppHealthCh())