Skip to content

Commit f45a179

Browse files
test: move context to after db creation (#21224)
Closes coder/internal#1040 We move the context to just before it is used to avoid the scenario where NewDB takes a while to spin up and runs up the context to the deadline.
1 parent c44a2c3 commit f45a179

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

coderd/database/querier_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6082,8 +6082,6 @@ func TestGetWorkspaceAgentsByParentID(t *testing.T) {
60826082
t.Run("NilParentDoesNotReturnAllParentAgents", func(t *testing.T) {
60836083
t.Parallel()
60846084

6085-
ctx := testutil.Context(t, testutil.WaitShort)
6086-
60876085
// Given: A workspace agent
60886086
db, _ := dbtestutil.NewDB(t)
60896087
org := dbgen.Organization(t, db, database.Organization{})
@@ -6098,6 +6096,8 @@ func TestGetWorkspaceAgentsByParentID(t *testing.T) {
60986096
ResourceID: resource.ID,
60996097
})
61006098

6099+
ctx := testutil.Context(t, testutil.WaitShort)
6100+
61016101
// When: We attempt to select agents with a null parent id
61026102
agents, err := db.GetWorkspaceAgentsByParentID(ctx, uuid.Nil)
61036103
require.NoError(t, err)

0 commit comments

Comments
 (0)