Compare commits

...

1 Commits

Author SHA1 Message Date
Mathias Fredriksson
807c3ff68e fix(autobuild): fix flaky TestExecutorAutostopAIAgentActivity
The second tick used a time offset from a 'now' variable captured
early in the test. The activity bump uses the database NOW() which
advances with wall clock time. Under slow CI, the elapsed time
between the two caused the tick to land before the bumped deadline,
so the executor skipped the stop transition.

Use time.Now() when computing the second tick so it is always
relative to the actual bump time.
2026-03-10 02:02:30 +00:00

View File

@@ -599,8 +599,11 @@ func TestExecutorAutostopAIAgentActivity(t *testing.T) {
require.NoError(t, err)
// When: the autobuild executor ticks after the bumped deadline.
// Use time.Now() to account for elapsed time since the test's
// "now" variable, because the activity bump uses the database
// NOW() which advances with wall clock time.
go func() {
tickTime := now.Add(time.Hour).Add(time.Minute)
tickTime := time.Now().Add(time.Hour).Add(time.Minute)
coderdtest.UpdateProvisionerLastSeenAt(t, db, p.ID, tickTime)
tickCh <- tickTime
close(tickCh)