Skip to content

Commit a3f64f7

Browse files
fix(coderd): fix flake in TestAPI/ModifyAutostopWithRunningWorkspace
1 parent f3c1353 commit a3f64f7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

coderd/workspaces_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,13 +2875,18 @@ func TestWorkspaceUpdateTTL(t *testing.T) {
28752875
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
28762876
defer cancel()
28772877

2878-
err := client.UpdateWorkspaceTTL(ctx, workspace.ID, codersdk.UpdateWorkspaceTTLRequest{
2879-
TTLMillis: testCase.toTTL,
2880-
})
2878+
// Re-fetch the workspace build. This is required because
2879+
// `AwaitWorkspaceBuildJobCompleted` can return stale data.
2880+
build, err := client.WorkspaceBuild(ctx, build.ID)
28812881
require.NoError(t, err)
28822882

28832883
deadlineBefore := build.Deadline
28842884

2885+
err = client.UpdateWorkspaceTTL(ctx, workspace.ID, codersdk.UpdateWorkspaceTTLRequest{
2886+
TTLMillis: testCase.toTTL,
2887+
})
2888+
require.NoError(t, err)
2889+
28852890
build, err = client.WorkspaceBuild(ctx, build.ID)
28862891
require.NoError(t, err)
28872892

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy