@@ -364,7 +364,6 @@ func TestExecutorAutostartUserSuspended(t *testing.T) {
364
364
t .Parallel ()
365
365
366
366
var (
367
- ctx = testutil .Context (t , testutil .WaitShort )
368
367
sched = mustSchedule (t , "CRON_TZ=UTC 0 * * * *" )
369
368
tickCh = make (chan time.Time )
370
369
statsCh = make (chan autobuild.Stats )
@@ -389,6 +388,8 @@ func TestExecutorAutostartUserSuspended(t *testing.T) {
389
388
// Given: workspace is stopped, and the user is suspended.
390
389
workspace = coderdtest .MustTransitionWorkspace (t , userClient , workspace .ID , database .WorkspaceTransitionStart , database .WorkspaceTransitionStop )
391
390
391
+ ctx := testutil .Context (t , testutil .WaitShort )
392
+
392
393
_ , err := client .UpdateUserStatus (ctx , user .ID .String (), codersdk .UserStatusSuspended )
393
394
require .NoError (t , err , "update user status" )
394
395
@@ -660,7 +661,6 @@ func TestExecuteAutostopSuspendedUser(t *testing.T) {
660
661
t .Parallel ()
661
662
662
663
var (
663
- ctx = testutil .Context (t , testutil .WaitShort )
664
664
tickCh = make (chan time.Time )
665
665
statsCh = make (chan autobuild.Stats )
666
666
client = coderdtest .New (t , & coderdtest.Options {
@@ -681,6 +681,9 @@ func TestExecuteAutostopSuspendedUser(t *testing.T) {
681
681
// Given: workspace is running, and the user is suspended.
682
682
workspace = coderdtest .MustWorkspace (t , userClient , workspace .ID )
683
683
require .Equal (t , codersdk .WorkspaceStatusRunning , workspace .LatestBuild .Status )
684
+
685
+ ctx := testutil .Context (t , testutil .WaitShort )
686
+
684
687
_ , err := client .UpdateUserStatus (ctx , user .ID .String (), codersdk .UserStatusSuspended )
685
688
require .NoError (t , err , "update user status" )
686
689
@@ -980,6 +983,9 @@ func TestExecutorRequireActiveVersion(t *testing.T) {
980
983
activeVersion := coderdtest .CreateTemplateVersion (t , ownerClient , owner .OrganizationID , nil )
981
984
coderdtest .AwaitTemplateVersionJobCompleted (t , ownerClient , activeVersion .ID )
982
985
template := coderdtest .CreateTemplate (t , ownerClient , owner .OrganizationID , activeVersion .ID )
986
+
987
+ ctx = testutil .Context (t , testutil .WaitShort ) // Reset context after setting up the template.
988
+
983
989
//nolint We need to set this in the database directly, because the API will return an error
984
990
// letting you know that this feature requires an enterprise license.
985
991
err = db .UpdateTemplateAccessControlByID (dbauthz .As (ctx , coderdtest .AuthzUserSubject (me , owner .OrganizationID )), database.UpdateTemplateAccessControlByIDParams {
0 commit comments