(t *testing.T)
| 19 | ) |
| 20 | |
| 21 | func TestSpeedtest(t *testing.T) { |
| 22 | t.Parallel() |
| 23 | t.Skip("Flaky test - see https://github.com/coder/coder/issues/6321") |
| 24 | if testing.Short() { |
| 25 | t.Skip("This test takes a minimum of 5ms per a hardcoded value in Tailscale!") |
| 26 | } |
| 27 | client, workspace, agentToken := setupWorkspaceForAgent(t) |
| 28 | _ = agenttest.New(t, client.URL, agentToken) |
| 29 | coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID) |
| 30 | |
| 31 | ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) |
| 32 | defer cancel() |
| 33 | |
| 34 | require.Eventually(t, func() bool { |
| 35 | ws, err := client.Workspace(ctx, workspace.ID) |
| 36 | if !assert.NoError(t, err) { |
| 37 | return false |
| 38 | } |
| 39 | a := ws.LatestBuild.Resources[0].Agents[0] |
| 40 | return a.Status == codersdk.WorkspaceAgentConnected && |
| 41 | a.LifecycleState == codersdk.WorkspaceAgentLifecycleReady |
| 42 | }, testutil.WaitLong, testutil.IntervalFast, "agent is not ready") |
| 43 | |
| 44 | inv, root := clitest.New(t, "speedtest", workspace.Name) |
| 45 | clitest.SetupConfig(t, client, root) |
| 46 | pty := ptytest.New(t) |
| 47 | inv.Stdout = pty.Output() |
| 48 | inv.Stderr = pty.Output() |
| 49 | |
| 50 | ctx, cancel = context.WithTimeout(context.Background(), testutil.WaitLong) |
| 51 | defer cancel() |
| 52 | |
| 53 | inv.Logger = testutil.Logger(t).Named("speedtest") |
| 54 | cmdDone := tGo(t, func() { |
| 55 | err := inv.WithContext(ctx).Run() |
| 56 | assert.NoError(t, err) |
| 57 | }) |
| 58 | <-cmdDone |
| 59 | } |
| 60 | |
| 61 | func TestSpeedtestJson(t *testing.T) { |
| 62 | t.Parallel() |
nothing calls this directly
no test coverage detected