Skip to content

Commit 1e575d8

Browse files
DanielleMaywoodaslilac
authored andcommitted
chore: fix TestWorkspaceAutobuild/NextStartAtIsValid flake (#15772)
Fixes coder/internal#238 It appears we haven't got quartz piped through to enough of Coder for the test to work as I had expected. Using the current time should be sufficient for this test.
1 parent 88c5360 commit 1e575d8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

enterprise/coderd/workspaces_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,9 +1117,7 @@ func TestWorkspaceAutobuild(t *testing.T) {
11171117
clock = quartz.NewMock(t)
11181118
)
11191119

1120-
// Set the clock to 8AM Monday, 1st January, 2024 to keep
1121-
// this test deterministic.
1122-
clock.Set(time.Date(2024, 1, 1, 8, 0, 0, 0, time.UTC))
1120+
clock.Set(dbtime.Now())
11231121

11241122
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true}).Leveled(slog.LevelDebug)
11251123
client, user := coderdenttest.New(t, &coderdenttest.Options{
@@ -1129,7 +1127,7 @@ func TestWorkspaceAutobuild(t *testing.T) {
11291127
AutobuildStats: statsCh,
11301128
Logger: &logger,
11311129
Clock: clock,
1132-
TemplateScheduleStore: schedule.NewEnterpriseTemplateScheduleStore(agplUserQuietHoursScheduleStore(), notifications.NewNoopEnqueuer(), logger, nil),
1130+
TemplateScheduleStore: schedule.NewEnterpriseTemplateScheduleStore(agplUserQuietHoursScheduleStore(), notifications.NewNoopEnqueuer(), logger, clock),
11331131
},
11341132
LicenseOptions: &coderdenttest.LicenseOptions{
11351133
Features: license.Features{codersdk.FeatureAdvancedTemplateScheduling: 1},
@@ -1185,7 +1183,7 @@ func TestWorkspaceAutobuild(t *testing.T) {
11851183
}
11861184

11871185
// Ensure that there is a valid next start at and that is is after
1188-
// the preivous start.
1186+
// the previous start.
11891187
require.NotNil(t, ws.NextStartAt)
11901188
require.Greater(t, *ws.NextStartAt, next)
11911189

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