MCPcopy Index your code
hub / github.com/coder/coder / TestSpeedtest

Function TestSpeedtest

cli/speedtest_test.go:21–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19)
20
21func 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
61func TestSpeedtestJson(t *testing.T) {
62 t.Parallel()

Callers

nothing calls this directly

Calls 14

NewFunction · 0.92
AwaitWorkspaceAgentsFunction · 0.92
NewFunction · 0.92
SetupConfigFunction · 0.92
NewFunction · 0.92
LoggerFunction · 0.92
tGoFunction · 0.85
SkipMethod · 0.80
WorkspaceMethod · 0.80
NamedMethod · 0.80
WithContextMethod · 0.80
setupWorkspaceForAgentFunction · 0.70

Tested by

no test coverage detected