Skip to content

Commit a4ce5f6

Browse files
committed
fix(cli): flake test in prebuilt workspace delete by scoping context per subtest
1 parent bfdacae commit a4ce5f6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cli/delete_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,6 @@ func TestDelete(t *testing.T) {
233233
t.Skip("this test requires postgres")
234234
}
235235

236-
clock := quartz.NewMock(t)
237-
ctx := testutil.Context(t, testutil.WaitSuperLong)
238-
239236
// Setup
240237
db, pb := dbtestutil.NewDB(t, dbtestutil.WithDumpOnFailure())
241238
client, _ := coderdtest.NewWithProvisionerCloser(t, &coderdtest.Options{
@@ -301,6 +298,9 @@ func TestDelete(t *testing.T) {
301298
t.Run(tc.name, func(t *testing.T) {
302299
t.Parallel()
303300

301+
clock := quartz.NewMock(t)
302+
ctx := testutil.Context(t, testutil.WaitSuperLong)
303+
304304
// Create one prebuilt workspace (owned by system user) and one normal workspace (owned by a user)
305305
// Each workspace is persisted in the DB along with associated workspace jobs and builds.
306306
dbPrebuiltWorkspace := setupTestDBWorkspace(t, clock, db, pb, orgID, database.PrebuildsSystemUserID, template.ID, version.ID, preset.ID)

0 commit comments

Comments
 (0)