Skip to content

Commit 714e962

Browse files
committed
Fix racey test by allowing logs before
1 parent 6e6beb4 commit 714e962

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

coderd/provisionerjoblogs_test.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/coder/coder/provisionersdk/proto"
1515
)
1616

17-
func TestWorkspaceHistoryLogsByName(t *testing.T) {
17+
func TestProvisionerJobLogsByName(t *testing.T) {
1818
t.Parallel()
1919
t.Run("List", func(t *testing.T) {
2020
t.Parallel()
@@ -44,17 +44,10 @@ func TestWorkspaceHistoryLogsByName(t *testing.T) {
4444
Transition: database.WorkspaceTransitionCreate,
4545
})
4646
require.NoError(t, err)
47-
48-
// Successfully return empty logs before the job starts!
49-
logs, err := client.ProvisionerJobLogs(context.Background(), history.Provision.ID)
50-
require.NoError(t, err)
51-
require.NotNil(t, logs)
52-
require.Len(t, logs, 0)
53-
5447
coderdtest.AwaitWorkspaceHistoryProvisioned(t, client, "", workspace.Name, history.Name)
5548

5649
// Return the log after completion!
57-
logs, err = client.ProvisionerJobLogs(context.Background(), history.Provision.ID)
50+
logs, err := client.ProvisionerJobLogs(context.Background(), history.Provision.ID)
5851
require.NoError(t, err)
5952
require.NotNil(t, logs)
6053
require.Len(t, logs, 1)

database/query.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ VALUES
372372
INSERT INTO
373373
provisioner_job_log
374374
SELECT
375-
@job_id :: uuid AS job_id,
376375
unnest(@id :: uuid [ ]) AS id,
376+
@job_id :: uuid AS job_id,
377377
unnest(@created_at :: timestamptz [ ]) AS created_at,
378378
unnest(@source :: log_source [ ]) as source,
379379
unnest(@level :: log_level [ ]) as level,

database/query.sql.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)