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

Commit6f06f8d

Browse files
authored
test: Fix test timeouts due to contexts created too early (#7242)
1 parentea78ca5 commit6f06f8d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

‎coderd/workspacebuilds_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,7 @@ func TestWorkspaceBuildState(t *testing.T) {
572572

573573
funcTestWorkspaceBuildStatus(t*testing.T) {
574574
t.Parallel()
575-
ctx,cancel:=context.WithTimeout(context.Background(),testutil.WaitLong)
576-
defercancel()
575+
577576
auditor:=audit.NewMock()
578577
numLogs:=len(auditor.AuditLogs())
579578
client,closeDaemon,api:=coderdtest.NewWithAPI(t,&coderdtest.Options{IncludeProvisionerDaemon:true,Auditor:auditor})
@@ -597,6 +596,10 @@ func TestWorkspaceBuildStatus(t *testing.T) {
597596
closeDaemon=coderdtest.NewProvisionerDaemon(t,api)
598597
// after successful build is "running"
599598
_=coderdtest.AwaitWorkspaceBuildJob(t,client,workspace.LatestBuild.ID)
599+
600+
ctx,cancel:=context.WithTimeout(context.Background(),testutil.WaitLong)
601+
defercancel()
602+
600603
workspace,err:=client.Workspace(ctx,workspace.ID)
601604
require.NoError(t,err)
602605
require.EqualValues(t,codersdk.WorkspaceStatusRunning,workspace.LatestBuild.Status)

‎enterprise/coderd/templates_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,6 @@ func TestReadFileWithTemplateUpdate(t *testing.T) {
980980
t.Parallel()
981981
t.Run("HasTemplateUpdate",func(t*testing.T) {
982982
t.Parallel()
983-
ctx:=testutil.Context(t,testutil.WaitMedium)
984983

985984
// Upload a file
986985
client:=coderdenttest.New(t,nil)
@@ -991,6 +990,8 @@ func TestReadFileWithTemplateUpdate(t *testing.T) {
991990
},
992991
})
993992

993+
ctx:=testutil.Context(t,testutil.WaitLong)
994+
994995
resp,err:=client.Upload(ctx,codersdk.ContentTypeTar,bytes.NewReader(make([]byte,1024)))
995996
require.NoError(t,err)
996997

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp