File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -2875,13 +2875,18 @@ func TestWorkspaceUpdateTTL(t *testing.T) {
2875
2875
ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
2876
2876
defer cancel ()
2877
2877
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 )
2881
2881
require .NoError (t , err )
2882
2882
2883
2883
deadlineBefore := build .Deadline
2884
2884
2885
+ err = client .UpdateWorkspaceTTL (ctx , workspace .ID , codersdk.UpdateWorkspaceTTLRequest {
2886
+ TTLMillis : testCase .toTTL ,
2887
+ })
2888
+ require .NoError (t , err )
2889
+
2885
2890
build , err = client .WorkspaceBuild (ctx , build .ID )
2886
2891
require .NoError (t , err )
2887
2892
You can’t perform that action at this time.
0 commit comments