Skip to content

test: fix flaky TestPostWorkspacesByOrganization/TemplateNoTTL #9680

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 1 commit into from
Sep 14, 2023
Merged
Changes from all commits
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
fix: wait for build job
  • Loading branch information
mtojek committed Sep 14, 2023
commit 66a7578e23a54d8d73b1260cc517f29ba2ca8c9d
4 changes: 4 additions & 0 deletions coderd/workspaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ func TestPostWorkspacesByOrganization(t *testing.T) {
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID, func(cwr *codersdk.CreateWorkspaceRequest) {
cwr.TTLMillis = ptr.Ref(int64(0))
})
coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)

// Then: No TTL should be set by the template
require.Nil(t, workspace.TTLMillis)
})
Expand All @@ -603,6 +605,8 @@ func TestPostWorkspacesByOrganization(t *testing.T) {
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID, func(cwr *codersdk.CreateWorkspaceRequest) {
cwr.TTLMillis = nil // ensure that no default TTL is set
})
coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)

// TTL should be set by the template
require.Equal(t, template.DefaultTTLMillis, templateTTL)
require.Equal(t, template.DefaultTTLMillis, *workspace.TTLMillis)
Expand Down