mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
test: move context to after db creation (#21224)
Closes https://github.com/coder/internal/issues/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.
This commit is contained in:
@@ -6082,8 +6082,6 @@ func TestGetWorkspaceAgentsByParentID(t *testing.T) {
|
||||
t.Run("NilParentDoesNotReturnAllParentAgents", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx := testutil.Context(t, testutil.WaitShort)
|
||||
|
||||
// Given: A workspace agent
|
||||
db, _ := dbtestutil.NewDB(t)
|
||||
org := dbgen.Organization(t, db, database.Organization{})
|
||||
@@ -6098,6 +6096,8 @@ func TestGetWorkspaceAgentsByParentID(t *testing.T) {
|
||||
ResourceID: resource.ID,
|
||||
})
|
||||
|
||||
ctx := testutil.Context(t, testutil.WaitShort)
|
||||
|
||||
// When: We attempt to select agents with a null parent id
|
||||
agents, err := db.GetWorkspaceAgentsByParentID(ctx, uuid.Nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user