Skip to content

Commit 0884628

Browse files
committed
fix: minor fixes
1 parent 7bbb045 commit 0884628

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

enterprise/coderd/workspaces_test.go

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,12 @@ import (
1515
"testing"
1616
"time"
1717

18-
"github.com/prometheus/client_golang/prometheus"
19-
20-
"github.com/coder/coder/v2/coderd/database/dbgen"
21-
22-
"github.com/coder/coder/v2/coderd/files"
23-
agplprebuilds "github.com/coder/coder/v2/coderd/prebuilds"
24-
"github.com/coder/coder/v2/enterprise/coderd/prebuilds"
25-
2618
"github.com/google/uuid"
19+
"github.com/prometheus/client_golang/prometheus"
2720
"github.com/stretchr/testify/assert"
2821
"github.com/stretchr/testify/require"
2922

3023
"cdr.dev/slog"
31-
3224
"cdr.dev/slog/sloggers/slogtest"
3325

3426
"github.com/coder/coder/v2/coderd/audit"
@@ -37,10 +29,13 @@ import (
3729
"github.com/coder/coder/v2/coderd/database"
3830
"github.com/coder/coder/v2/coderd/database/dbauthz"
3931
"github.com/coder/coder/v2/coderd/database/dbfake"
32+
"github.com/coder/coder/v2/coderd/database/dbgen"
4033
"github.com/coder/coder/v2/coderd/database/dbtestutil"
4134
"github.com/coder/coder/v2/coderd/database/dbtime"
35+
"github.com/coder/coder/v2/coderd/files"
4236
"github.com/coder/coder/v2/coderd/httpmw"
4337
"github.com/coder/coder/v2/coderd/notifications"
38+
agplprebuilds "github.com/coder/coder/v2/coderd/prebuilds"
4439
"github.com/coder/coder/v2/coderd/provisionerdserver"
4540
"github.com/coder/coder/v2/coderd/rbac"
4641
"github.com/coder/coder/v2/coderd/rbac/policy"
@@ -52,6 +47,7 @@ import (
5247
"github.com/coder/coder/v2/enterprise/audit/backends"
5348
"github.com/coder/coder/v2/enterprise/coderd/coderdenttest"
5449
"github.com/coder/coder/v2/enterprise/coderd/license"
50+
"github.com/coder/coder/v2/enterprise/coderd/prebuilds"
5551
"github.com/coder/coder/v2/enterprise/coderd/schedule"
5652
"github.com/coder/coder/v2/provisioner/echo"
5753
"github.com/coder/coder/v2/provisionersdk"
@@ -2524,19 +2520,15 @@ func templateWithFailedResponseAndPresetsWithPrebuilds(desiredInstances int32) *
25242520
func TestPrebuildUpdateLifecycleParams(t *testing.T) {
25252521
t.Parallel()
25262522

2527-
// Set the clock to Monday, January 1st, 2024 at 8:00 AM UTC to keep the test deterministic
2528-
clock := quartz.NewMock(t)
2529-
clock.Set(time.Date(2024, 1, 1, 8, 0, 0, 0, time.UTC))
2530-
25312523
// Autostart schedule configuration set to weekly at 9:30 AM UTC
25322524
autostartSchedule, err := cron.Weekly("CRON_TZ=UTC 30 9 * * 1-5")
25332525
require.NoError(t, err)
25342526

25352527
// TTL configuration set to 8 hours
25362528
ttlMillis := ptr.Ref((8 * time.Hour).Milliseconds())
25372529

2538-
// Deadline configuration set to 10:00 AM UTC
2539-
deadline := clock.Now().Add(2 * time.Hour)
2530+
// Deadline configuration set to January 1st, 2024 at 10:00 AM UTC
2531+
deadline := time.Date(2024, 1, 1, 10, 0, 0, 0, time.UTC)
25402532

25412533
cases := []struct {
25422534
name string
@@ -2615,6 +2607,10 @@ func TestPrebuildUpdateLifecycleParams(t *testing.T) {
26152607
t.Run(tc.name, func(t *testing.T) {
26162608
t.Parallel()
26172609

2610+
// Set the clock to Monday, January 1st, 2024 at 8:00 AM UTC to keep the test deterministic
2611+
clock := quartz.NewMock(t)
2612+
clock.Set(time.Date(2024, 1, 1, 8, 0, 0, 0, time.UTC))
2613+
26182614
// Setup
26192615
client, db, owner := coderdenttest.NewWithDatabase(t, &coderdenttest.Options{
26202616
Options: &coderdtest.Options{

0 commit comments

Comments
 (0)