From 66a7578e23a54d8d73b1260cc517f29ba2ca8c9d Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Thu, 14 Sep 2023 09:45:23 +0200 Subject: [PATCH] fix: wait for build job --- coderd/workspaces_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coderd/workspaces_test.go b/coderd/workspaces_test.go index 9d4082d4e4e39..da32d66b6ee0e 100644 --- a/coderd/workspaces_test.go +++ b/coderd/workspaces_test.go @@ -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) }) @@ -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)