(t *testing.T)
| 2453 | } |
| 2454 | |
| 2455 | func TestWorkspaceAgent_Metadata_DisplayOrder(t *testing.T) { |
| 2456 | t.Parallel() |
| 2457 | |
| 2458 | client, db := coderdtest.NewWithDatabase(t, nil) |
| 2459 | user := coderdtest.CreateFirstUser(t, client) |
| 2460 | r := dbfake.WorkspaceBuild(t, db, database.WorkspaceTable{ |
| 2461 | OrganizationID: user.OrganizationID, |
| 2462 | OwnerID: user.UserID, |
| 2463 | }).WithAgent(func(agents []*proto.Agent) []*proto.Agent { |
| 2464 | agents[0].Metadata = []*proto.Agent_Metadata{ |
| 2465 | { |
| 2466 | DisplayName: "First Meta", |
| 2467 | Key: "foo1", |
| 2468 | Script: "echo hi", |
| 2469 | Interval: 10, |
| 2470 | Timeout: 3, |
| 2471 | Order: 2, |
| 2472 | }, |
| 2473 | { |
| 2474 | DisplayName: "Second Meta", |
| 2475 | Key: "foo2", |
| 2476 | Script: "echo howdy", |
| 2477 | Interval: 10, |
| 2478 | Timeout: 3, |
| 2479 | Order: 1, |
| 2480 | }, |
| 2481 | { |
| 2482 | DisplayName: "Third Meta", |
| 2483 | Key: "foo3", |
| 2484 | Script: "echo howdy", |
| 2485 | Interval: 10, |
| 2486 | Timeout: 3, |
| 2487 | Order: 2, |
| 2488 | }, |
| 2489 | { |
| 2490 | DisplayName: "Fourth Meta", |
| 2491 | Key: "foo4", |
| 2492 | Script: "echo howdy", |
| 2493 | Interval: 10, |
| 2494 | Timeout: 3, |
| 2495 | Order: 3, |
| 2496 | }, |
| 2497 | } |
| 2498 | return agents |
| 2499 | }).Do() |
| 2500 | |
| 2501 | workspace, err := client.Workspace(context.Background(), r.Workspace.ID) |
| 2502 | require.NoError(t, err) |
| 2503 | for _, res := range workspace.LatestBuild.Resources { |
| 2504 | for _, a := range res.Agents { |
| 2505 | require.Equal(t, codersdk.WorkspaceAgentLifecycleCreated, a.LifecycleState) |
| 2506 | } |
| 2507 | } |
| 2508 | |
| 2509 | ctx := testutil.Context(t, testutil.WaitMedium) |
| 2510 | workspace, err = client.Workspace(ctx, workspace.ID) |
| 2511 | require.NoError(t, err, "get workspace") |
| 2512 |
nothing calls this directly
no test coverage detected