Skip to content

chore: executor_test: reduce test execution time #1876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 30, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
no asserts in eventually/never
  • Loading branch information
johnstcn committed May 30, 2022
commit 05e4c5e922dbb797d73a784d180b0e4490f27397
7 changes: 5 additions & 2 deletions coderd/autobuild/executor/lifecycle_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ func mustWorkspace(t *testing.T, client *codersdk.Client, workspaceID uuid.UUID)

func assertLatestTransitionWithEventualBuild(t *testing.T, client *codersdk.Client, workspace codersdk.Workspace, expected codersdk.WorkspaceTransition) {
t.Helper()
// assert.Eventually appears to have concurrency issues
assert.Eventually(t, func() bool {
ws := mustWorkspace(t, client, workspace.ID)
if ws.LatestBuild.ID == workspace.LatestBuild.ID {
Expand All @@ -524,7 +525,8 @@ func assertLatestTransitionWithEventualBuild(t *testing.T, client *codersdk.Clie
return false
}
// At this point a build has happened. Is it what we want?
return assert.Equal(t, expected, ws.LatestBuild.Transition)
// return assert.Equal(t, expected, ws.LatestBuild.Transition)
return expected == ws.LatestBuild.Transition
}, 3*time.Second, 25*time.Millisecond)
}

Expand All @@ -539,7 +541,8 @@ func assertLatestTransitionWithNoEventualBuild(t *testing.T, client *codersdk.Cl
return false
}
// At this point a build should not have happened. Is the state still as expected?
return assert.Equal(t, expected, ws.LatestBuild.Transition)
// return assert.Equal(t, expected, ws.LatestBuild.Transition)
return expected == ws.LatestBuild.Transition
}, 3*time.Second, 25*time.Millisecond)
}

Expand Down