@@ -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 : ptr (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 : ptr (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 : ptr (sched .String ()),
142
+ Schedule : ptr . Ref (sched .String ()),
142
143
}))
143
144
144
145
// When: the autobuild executor ticks
@@ -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 : ptr (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 : ptr (sched .String ()),
406
+ Schedule : ptr . Ref (sched .String ()),
406
407
}))
407
408
408
409
// When: the autobuild executor ticks
@@ -572,10 +573,6 @@ func mustWorkspace(t *testing.T, client *codersdk.Client, workspaceID uuid.UUID)
572
573
return ws
573
574
}
574
575
575
- func ptr [T any ](v T ) * T {
576
- return & v
577
- }
578
-
579
576
func TestMain (m * testing.M ) {
580
577
goleak .VerifyTestMain (m )
581
578
}
0 commit comments