Skip to content

feat: add dbfake for workspace builds and resources #10426

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 10 commits into from
Nov 2, 2023
Merged
Prev Previous commit
Fix listening ports
  • Loading branch information
kylecarbs committed Nov 2, 2023
commit cff7aca00bd24f6996034d3b359f1b7e0a20f099
11 changes: 10 additions & 1 deletion coderd/workspaceagents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,19 @@ func TestWorkspaceAgentListeningPorts(t *testing.T) {
require.NoError(t, err)

user := coderdtest.CreateFirstUser(t, client)
ws, authToken := dbfake.WorkspaceWithAgent(t, db, database.Workspace{
ws := dbfake.Workspace(t, db, database.Workspace{
OrganizationID: user.OrganizationID,
OwnerID: user.UserID,
})
authToken := uuid.NewString()
dbfake.WorkspaceBuild(t, db, ws, database.WorkspaceBuild{}, &proto.Resource{
Agents: []*proto.Agent{{
Apps: apps,
Auth: &proto.Agent_Token{
Token: authToken,
},
}},
})
_ = agenttest.New(t, client.URL, authToken)
resources := coderdtest.AwaitWorkspaceAgents(t, client, ws.ID)
return client, uint16(coderdPort), resources[0].Agents[0].ID
Expand Down