@@ -44,7 +44,7 @@ func TestExecutorAutostartOK(t *testing.T) {
4444 sched , err := schedule .Weekly ("* * * * *" )
4545 require .NoError (t , err )
4646 require .NoError (t , client .UpdateWorkspaceAutostart (ctx , workspace .ID , codersdk.UpdateWorkspaceAutostartRequest {
47- Schedule : sched .String (),
47+ Schedule : ptr ( sched .String () ),
4848 }))
4949
5050 // When: the autobuild executor ticks
@@ -95,7 +95,7 @@ func TestExecutorAutostartTemplateUpdated(t *testing.T) {
9595 sched , err := schedule .Weekly ("* * * * *" )
9696 require .NoError (t , err )
9797 require .NoError (t , client .UpdateWorkspaceAutostart (ctx , workspace .ID , codersdk.UpdateWorkspaceAutostartRequest {
98- Schedule : sched .String (),
98+ Schedule : ptr ( sched .String () ),
9999 }))
100100
101101 // When: the autobuild executor ticks
@@ -138,7 +138,7 @@ func TestExecutorAutostartAlreadyRunning(t *testing.T) {
138138 sched , err := schedule .Weekly ("* * * * *" )
139139 require .NoError (t , err )
140140 require .NoError (t , client .UpdateWorkspaceAutostart (ctx , workspace .ID , codersdk.UpdateWorkspaceAutostartRequest {
141- Schedule : sched .String (),
141+ Schedule : ptr ( sched .String () ),
142142 }))
143143
144144 // When: the autobuild executor ticks
@@ -316,12 +316,12 @@ func TestExecutorAutostopNotEnabled(t *testing.T) {
316316 })
317317 // Given: we have a user with a workspace that has no TTL set
318318 workspace = mustProvisionWorkspace (t , client , func (cwr * codersdk.CreateWorkspaceRequest ) {
319- cwr .TTL = nil
319+ cwr .TTLMillis = nil
320320 })
321321 )
322322
323323 // Given: workspace has no TTL set
324- require .Nil (t , workspace .TTL )
324+ require .Nil (t , workspace .TTLMillis )
325325
326326 // Given: workspace is running
327327 require .Equal (t , codersdk .WorkspaceTransitionStart , workspace .LatestBuild .Transition )
@@ -359,7 +359,7 @@ func TestExecutorWorkspaceDeleted(t *testing.T) {
359359 sched , err := schedule .Weekly ("* * * * *" )
360360 require .NoError (t , err )
361361 require .NoError (t , client .UpdateWorkspaceAutostart (ctx , workspace .ID , codersdk.UpdateWorkspaceAutostartRequest {
362- Schedule : sched .String (),
362+ Schedule : ptr ( sched .String () ),
363363 }))
364364
365365 // Given: workspace is deleted
@@ -402,7 +402,7 @@ func TestExecutorWorkspaceAutostartTooEarly(t *testing.T) {
402402 sched , err := schedule .Weekly (futureTimeCron )
403403 require .NoError (t , err )
404404 require .NoError (t , client .UpdateWorkspaceAutostart (ctx , workspace .ID , codersdk.UpdateWorkspaceAutostartRequest {
405- Schedule : sched .String (),
405+ Schedule : ptr ( sched .String () ),
406406 }))
407407
408408 // When: the autobuild executor ticks
@@ -461,7 +461,7 @@ func TestExecutorWorkspaceAutostopNoWaitChangedMyMind(t *testing.T) {
461461 )
462462
463463 // 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 })
464+ err := client .UpdateWorkspaceTTL (ctx , workspace .ID , codersdk.UpdateWorkspaceTTLRequest {TTLMillis : nil })
465465 require .NoError (t , err )
466466
467467 // When: the autobuild executor ticks after the deadline
@@ -572,6 +572,10 @@ func mustWorkspace(t *testing.T, client *codersdk.Client, workspaceID uuid.UUID)
572572 return ws
573573}
574574
575+ func ptr [T any ](v T ) * T {
576+ return & v
577+ }
578+
575579func TestMain (m * testing.M ) {
576580 goleak .VerifyTestMain (m )
577581}
0 commit comments