Skip to content

Commit c7ef9cb

Browse files
committed
fixup! add back max_ttl and put restart_requirement behind feature flag
1 parent 024233a commit c7ef9cb

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

coderd/schedule/autostop.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ func nextDayMidnight(t time.Time) time.Time {
225225
yy, mm, dd := t.Date()
226226
// time.Date will correctly normalize the date if it's past the end of the
227227
// month. E.g. October 32nd will be November 1st.
228-
dd += 1
228+
dd++
229229
return time.Date(yy, mm, dd, 0, 0, 0, 0, t.Location())
230230
}
231231

coderd/schedule/autostop_test.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,12 +345,15 @@ func TestCalculateAutoStop(t *testing.T) {
345345
},
346346
}
347347

348+
org := dbgen.Organization(t, db, database.Organization{})
348349
user := dbgen.User(t, db, database.User{
349350
QuietHoursSchedule: c.userQuietHoursSchedule,
350351
})
351352
template := dbgen.Template(t, db, database.Template{
352-
Name: "template",
353-
Provisioner: database.ProvisionerTypeEcho,
353+
Name: "template",
354+
Provisioner: database.ProvisionerTypeEcho,
355+
OrganizationID: org.ID,
356+
CreatedBy: user.ID,
354357
})
355358
template, err := db.UpdateTemplateScheduleByID(ctx, database.UpdateTemplateScheduleByIDParams{
356359
ID: template.ID,
@@ -368,9 +371,10 @@ func TestCalculateAutoStop(t *testing.T) {
368371
}
369372
}
370373
workspace := dbgen.Workspace(t, db, database.Workspace{
371-
TemplateID: template.ID,
372-
Ttl: workspaceTTL,
373-
OwnerID: user.ID,
374+
TemplateID: template.ID,
375+
OrganizationID: org.ID,
376+
OwnerID: user.ID,
377+
Ttl: workspaceTTL,
374378
})
375379

376380
autostop, err := schedule.CalculateAutostop(ctx, schedule.CalculateAutostopParams{

enterprise/coderd/coderd.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,13 +472,9 @@ func (api *API) updateEntitlements(ctx context.Context) error {
472472
templateStore := schedule.NewEnterpriseTemplateScheduleStore()
473473
templateStoreInterface := agplschedule.TemplateScheduleStore(templateStore)
474474
api.AGPL.TemplateScheduleStore.Store(&templateStoreInterface)
475-
476475
} else {
477476
templateStore := agplschedule.NewAGPLTemplateScheduleStore()
478477
api.AGPL.TemplateScheduleStore.Store(&templateStore)
479-
480-
quietHoursStore := agplschedule.NewAGPLUserQuietHoursScheduleStore()
481-
api.AGPL.UserQuietHoursScheduleStore.Store(&quietHoursStore)
482478
}
483479
}
484480

site/src/testHelpers/entities.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,10 @@ export const MockTemplate: TypesGen.Template = {
421421
description: "This is a test description.",
422422
default_ttl_ms: 24 * 60 * 60 * 1000,
423423
max_ttl_ms: 2 * 24 * 60 * 60 * 1000,
424+
restart_requirement: {
425+
days_of_week: [],
426+
weeks: 1,
427+
},
424428
created_by_id: "test-creator-id",
425429
created_by_name: "test_creator",
426430
icon: "/icon/code.svg",

0 commit comments

Comments
 (0)