(t *testing.T)
| 219 | } |
| 220 | |
| 221 | func setupRunnerTest(t *testing.T) (client *codersdk.Client, agentID uuid.UUID) { |
| 222 | t.Helper() |
| 223 | |
| 224 | client = coderdtest.New(t, &coderdtest.Options{ |
| 225 | IncludeProvisionerDaemon: true, |
| 226 | }) |
| 227 | user := coderdtest.CreateFirstUser(t, client) |
| 228 | |
| 229 | authToken := uuid.NewString() |
| 230 | version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ |
| 231 | Parse: echo.ParseComplete, |
| 232 | ProvisionPlan: echo.PlanComplete, |
| 233 | ProvisionGraph: []*proto.Response{{ |
| 234 | Type: &proto.Response_Graph{ |
| 235 | Graph: &proto.GraphComplete{ |
| 236 | Resources: []*proto.Resource{{ |
| 237 | Name: "example", |
| 238 | Type: "aws_instance", |
| 239 | Agents: []*proto.Agent{{ |
| 240 | Id: uuid.NewString(), |
| 241 | Name: "agent", |
| 242 | Auth: &proto.Agent_Token{ |
| 243 | Token: authToken, |
| 244 | }, |
| 245 | Apps: []*proto.App{}, |
| 246 | }}, |
| 247 | }}, |
| 248 | }, |
| 249 | }, |
| 250 | }}, |
| 251 | }) |
| 252 | |
| 253 | template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID) |
| 254 | coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID) |
| 255 | |
| 256 | workspace := coderdtest.CreateWorkspace(t, client, template.ID) |
| 257 | coderdtest.AwaitWorkspaceBuildJobCompleted(t, client, workspace.LatestBuild.ID) |
| 258 | |
| 259 | _ = agenttest.New(t, client.URL, authToken) |
| 260 | resources := coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID) |
| 261 | return client, resources[0].Agents[0].ID |
| 262 | } |
| 263 | |
| 264 | func testServer(t *testing.T) (string, func() int64) { |
| 265 | t.Helper() |
no test coverage detected