Skip to content

Commit df29e75

Browse files
test: close provisioner before creating workspace build
Closes coder/internal#1178 I verified the fix works by adding a `time.Sleep(100 * time.Millisecond)` between the `CreateWorkspaceBuild` and `CancelWorkspaceBuild` calls. Adding this reliably triggered the flake, and when I added the fix the flake stopped happening.
1 parent 8ed1c1d commit df29e75

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

coderd/aitasks_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,12 @@ func TestTasks(t *testing.T) {
811811
require.NoError(t, err)
812812
coderdtest.AwaitWorkspaceBuildJobCompleted(t, client, workspace.LatestBuild.ID)
813813

814+
// If we're going to cancel the transition, we want to close the provisioner
815+
// to stop the job completing before we can cancel it.
816+
if tt.cancelTransition {
817+
provisioner.Close()
818+
}
819+
814820
// Given: We transition the task's workspace
815821
build := coderdtest.CreateWorkspaceBuild(t, client, workspace, tt.transition)
816822
if tt.cancelTransition {

0 commit comments

Comments
 (0)