@@ -14,6 +14,7 @@ import (
14
14
"github.com/coder/coder/coderd/autobuild/schedule"
15
15
"github.com/coder/coder/coderd/coderdtest"
16
16
"github.com/coder/coder/coderd/database"
17
+ "github.com/coder/coder/coderd/util/ptr"
17
18
"github.com/coder/coder/codersdk"
18
19
19
20
"github.com/google/uuid"
@@ -44,7 +45,7 @@ func TestExecutorAutostartOK(t *testing.T) {
44
45
sched , err := schedule .Weekly ("* * * * *" )
45
46
require .NoError (t , err )
46
47
require .NoError (t , client .UpdateWorkspaceAutostart (ctx , workspace .ID , codersdk.UpdateWorkspaceAutostartRequest {
47
- Schedule : sched .String (),
48
+ Schedule : ptr . Ref ( sched .String () ),
48
49
}))
49
50
50
51
// When: the autobuild executor ticks
@@ -95,7 +96,7 @@ func TestExecutorAutostartTemplateUpdated(t *testing.T) {
95
96
sched , err := schedule .Weekly ("* * * * *" )
96
97
require .NoError (t , err )
97
98
require .NoError (t , client .UpdateWorkspaceAutostart (ctx , workspace .ID , codersdk.UpdateWorkspaceAutostartRequest {
98
- Schedule : sched .String (),
99
+ Schedule : ptr . Ref ( sched .String () ),
99
100
}))
100
101
101
102
// When: the autobuild executor ticks
@@ -138,7 +139,7 @@ func TestExecutorAutostartAlreadyRunning(t *testing.T) {
138
139
sched , err := schedule .Weekly ("* * * * *" )
139
140
require .NoError (t , err )
140
141
require .NoError (t , client .UpdateWorkspaceAutostart (ctx , workspace .ID , codersdk.UpdateWorkspaceAutostartRequest {
141
- Schedule : sched .String (),
142
+ Schedule : ptr . Ref ( sched .String () ),
142
143
}))
143
144
144
145
// When: the autobuild executor ticks
@@ -316,12 +317,12 @@ func TestExecutorAutostopNotEnabled(t *testing.T) {
316
317
})
317
318
// Given: we have a user with a workspace that has no TTL set
318
319
workspace = mustProvisionWorkspace (t , client , func (cwr * codersdk.CreateWorkspaceRequest ) {
319
- cwr .TTL = nil
320
+ cwr .TTLMillis = nil
320
321
})
321
322
)
322
323
323
324
// Given: workspace has no TTL set
324
- require .Nil (t , workspace .TTL )
325
+ require .Nil (t , workspace .TTLMillis )
325
326
326
327
// Given: workspace is running
327
328
require .Equal (t , codersdk .WorkspaceTransitionStart , workspace .LatestBuild .Transition )
@@ -359,7 +360,7 @@ func TestExecutorWorkspaceDeleted(t *testing.T) {
359
360
sched , err := schedule .Weekly ("* * * * *" )
360
361
require .NoError (t , err )
361
362
require .NoError (t , client .UpdateWorkspaceAutostart (ctx , workspace .ID , codersdk.UpdateWorkspaceAutostartRequest {
362
- Schedule : sched .String (),
363
+ Schedule : ptr . Ref ( sched .String () ),
363
364
}))
364
365
365
366
// Given: workspace is deleted
@@ -402,7 +403,7 @@ func TestExecutorWorkspaceAutostartTooEarly(t *testing.T) {
402
403
sched , err := schedule .Weekly (futureTimeCron )
403
404
require .NoError (t , err )
404
405
require .NoError (t , client .UpdateWorkspaceAutostart (ctx , workspace .ID , codersdk.UpdateWorkspaceAutostartRequest {
405
- Schedule : sched .String (),
406
+ Schedule : ptr . Ref ( sched .String () ),
406
407
}))
407
408
408
409
// When: the autobuild executor ticks
@@ -461,7 +462,7 @@ func TestExecutorWorkspaceAutostopNoWaitChangedMyMind(t *testing.T) {
461
462
)
462
463
463
464
// Given: the user changes their mind and decides their workspace should not auto-stop
464
- err := client .UpdateWorkspaceTTL (ctx , workspace .ID , codersdk.UpdateWorkspaceTTLRequest {TTL : nil })
465
+ err := client .UpdateWorkspaceTTL (ctx , workspace .ID , codersdk.UpdateWorkspaceTTLRequest {TTLMillis : nil })
465
466
require .NoError (t , err )
466
467
467
468
// When: the autobuild executor ticks after the deadline
0 commit comments