mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
test: Fix test timeouts due to contexts created too early (#7242)
This commit is contained in:
committed by
GitHub
parent
ea78ca5dff
commit
6f06f8dadb
@ -572,8 +572,7 @@ func TestWorkspaceBuildState(t *testing.T) {
|
||||
|
||||
func TestWorkspaceBuildStatus(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
|
||||
defer cancel()
|
||||
|
||||
auditor := audit.NewMock()
|
||||
numLogs := len(auditor.AuditLogs())
|
||||
client, closeDaemon, api := coderdtest.NewWithAPI(t, &coderdtest.Options{IncludeProvisionerDaemon: true, Auditor: auditor})
|
||||
@ -597,6 +596,10 @@ func TestWorkspaceBuildStatus(t *testing.T) {
|
||||
closeDaemon = coderdtest.NewProvisionerDaemon(t, api)
|
||||
// after successful build is "running"
|
||||
_ = coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
|
||||
defer cancel()
|
||||
|
||||
workspace, err := client.Workspace(ctx, workspace.ID)
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, codersdk.WorkspaceStatusRunning, workspace.LatestBuild.Status)
|
||||
|
@ -980,7 +980,6 @@ func TestReadFileWithTemplateUpdate(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("HasTemplateUpdate", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := testutil.Context(t, testutil.WaitMedium)
|
||||
|
||||
// Upload a file
|
||||
client := coderdenttest.New(t, nil)
|
||||
@ -991,6 +990,8 @@ func TestReadFileWithTemplateUpdate(t *testing.T) {
|
||||
},
|
||||
})
|
||||
|
||||
ctx := testutil.Context(t, testutil.WaitLong)
|
||||
|
||||
resp, err := client.Upload(ctx, codersdk.ContentTypeTar, bytes.NewReader(make([]byte, 1024)))
|
||||
require.NoError(t, err)
|
||||
|
||||
|
Reference in New Issue
Block a user