(t *testing.T, client *codersdk.Client, user codersdk.CreateFirstUserResponse, appPort uint16)
| 272 | } |
| 273 | |
| 274 | func setupWorkspaceAgent(t *testing.T, client *codersdk.Client, user codersdk.CreateFirstUserResponse, appPort uint16) setupResp { |
| 275 | authToken := uuid.NewString() |
| 276 | version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{ |
| 277 | Parse: echo.ParseComplete, |
| 278 | ProvisionGraph: []*proto.Response{{ |
| 279 | Type: &proto.Response_Graph{ |
| 280 | Graph: &proto.GraphComplete{ |
| 281 | Resources: []*proto.Resource{{ |
| 282 | Name: "example", |
| 283 | Type: "aws_instance", |
| 284 | Agents: []*proto.Agent{{ |
| 285 | Id: uuid.NewString(), |
| 286 | Name: "example", |
| 287 | Auth: &proto.Agent_Token{ |
| 288 | Token: authToken, |
| 289 | }, |
| 290 | Apps: []*proto.App{ |
| 291 | { |
| 292 | Slug: testAppNameOwner, |
| 293 | DisplayName: testAppNameOwner, |
| 294 | SharingLevel: proto.AppSharingLevel_OWNER, |
| 295 | Url: fmt.Sprintf("http://localhost:%d", appPort), |
| 296 | }, |
| 297 | { |
| 298 | Slug: testAppNameAuthenticated, |
| 299 | DisplayName: testAppNameAuthenticated, |
| 300 | SharingLevel: proto.AppSharingLevel_AUTHENTICATED, |
| 301 | Url: fmt.Sprintf("http://localhost:%d", appPort), |
| 302 | }, |
| 303 | { |
| 304 | Slug: testAppNamePublic, |
| 305 | DisplayName: testAppNamePublic, |
| 306 | SharingLevel: proto.AppSharingLevel_PUBLIC, |
| 307 | Url: fmt.Sprintf("http://localhost:%d", appPort), |
| 308 | }, |
| 309 | }, |
| 310 | }}, |
| 311 | }}, |
| 312 | }, |
| 313 | }, |
| 314 | }}, |
| 315 | }) |
| 316 | coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID) |
| 317 | template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID) |
| 318 | workspace := coderdtest.CreateWorkspace(t, client, template.ID) |
| 319 | coderdtest.AwaitWorkspaceBuildJobCompleted(t, client, workspace.LatestBuild.ID) |
| 320 | agentClient := agentsdk.New(client.URL, agentsdk.WithFixedToken(authToken)) |
| 321 | agentClient.SDK.HTTPClient = &http.Client{ |
| 322 | Transport: &http.Transport{ |
| 323 | TLSClientConfig: &tls.Config{ |
| 324 | //nolint:gosec |
| 325 | InsecureSkipVerify: true, |
| 326 | }, |
| 327 | }, |
| 328 | } |
| 329 | agnt := agent.New(agent.Options{ |
| 330 | Client: agentClient, |
| 331 | Logger: testutil.Logger(t).Named("agent"), |
no test coverage detected