Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf1eec2d

Browse files
authored
fix(cli): scope context per subtest to fix flake test in prebuilt workspace delete (#18872)
## DescriptionThis PR fixes a flaky test in`TestDelete/Prebuilt_workspace_delete_permissions`:coder/internal#764Previously, all subtests used the same context created at the top level.Since the subtests run in parallel, they could run for too long andcause the shared context to expire. This sometimes led to contextdeadline exceeded errors, especially during the `testutil.Eventually`check for running prebuilt workspaces.The fix is to create a fresh context per subtest, ensuring they areisolated and not prematurely cancelled due to other subtests' durations.
1 parentc643214 commitf1eec2d

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)

[8]ページ先頭

©2009-2025 Movatter.jp