@@ -15,20 +15,12 @@ import (
15
15
"testing"
16
16
"time"
17
17
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
-
26
18
"github.com/google/uuid"
19
+ "github.com/prometheus/client_golang/prometheus"
27
20
"github.com/stretchr/testify/assert"
28
21
"github.com/stretchr/testify/require"
29
22
30
23
"cdr.dev/slog"
31
-
32
24
"cdr.dev/slog/sloggers/slogtest"
33
25
34
26
"github.com/coder/coder/v2/coderd/audit"
@@ -37,10 +29,13 @@ import (
37
29
"github.com/coder/coder/v2/coderd/database"
38
30
"github.com/coder/coder/v2/coderd/database/dbauthz"
39
31
"github.com/coder/coder/v2/coderd/database/dbfake"
32
+ "github.com/coder/coder/v2/coderd/database/dbgen"
40
33
"github.com/coder/coder/v2/coderd/database/dbtestutil"
41
34
"github.com/coder/coder/v2/coderd/database/dbtime"
35
+ "github.com/coder/coder/v2/coderd/files"
42
36
"github.com/coder/coder/v2/coderd/httpmw"
43
37
"github.com/coder/coder/v2/coderd/notifications"
38
+ agplprebuilds "github.com/coder/coder/v2/coderd/prebuilds"
44
39
"github.com/coder/coder/v2/coderd/provisionerdserver"
45
40
"github.com/coder/coder/v2/coderd/rbac"
46
41
"github.com/coder/coder/v2/coderd/rbac/policy"
@@ -52,6 +47,7 @@ import (
52
47
"github.com/coder/coder/v2/enterprise/audit/backends"
53
48
"github.com/coder/coder/v2/enterprise/coderd/coderdenttest"
54
49
"github.com/coder/coder/v2/enterprise/coderd/license"
50
+ "github.com/coder/coder/v2/enterprise/coderd/prebuilds"
55
51
"github.com/coder/coder/v2/enterprise/coderd/schedule"
56
52
"github.com/coder/coder/v2/provisioner/echo"
57
53
"github.com/coder/coder/v2/provisionersdk"
@@ -2524,19 +2520,15 @@ func templateWithFailedResponseAndPresetsWithPrebuilds(desiredInstances int32) *
2524
2520
func TestPrebuildUpdateLifecycleParams (t * testing.T ) {
2525
2521
t .Parallel ()
2526
2522
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
-
2531
2523
// Autostart schedule configuration set to weekly at 9:30 AM UTC
2532
2524
autostartSchedule , err := cron .Weekly ("CRON_TZ=UTC 30 9 * * 1-5" )
2533
2525
require .NoError (t , err )
2534
2526
2535
2527
// TTL configuration set to 8 hours
2536
2528
ttlMillis := ptr .Ref ((8 * time .Hour ).Milliseconds ())
2537
2529
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 )
2540
2532
2541
2533
cases := []struct {
2542
2534
name string
@@ -2615,6 +2607,10 @@ func TestPrebuildUpdateLifecycleParams(t *testing.T) {
2615
2607
t .Run (tc .name , func (t * testing.T ) {
2616
2608
t .Parallel ()
2617
2609
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
+
2618
2614
// Setup
2619
2615
client , db , owner := coderdenttest .NewWithDatabase (t , & coderdenttest.Options {
2620
2616
Options : & coderdtest.Options {
0 commit comments