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

Function TestNetcheck

cli/netcheck_test.go:15–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestNetcheck(t *testing.T) {
16 t.Parallel()
17
18 pty := ptytest.New(t)
19 config := login(t, pty)
20
21 var out bytes.Buffer
22 inv, _ := clitest.New(t, "netcheck", "--global-config", string(config))
23 inv.Stdout = &out
24
25 clitest.StartWithWaiter(t, inv).RequireSuccess()
26
27 b := out.Bytes()
28 t.Log(string(b))
29 var report healthsdk.ClientNetcheckReport
30 require.NoError(t, json.Unmarshal(b, &report))
31
32 // We do not assert that the report is healthy, just that
33 // it has the expected number of reports per region.
34 require.Len(t, report.DERP.Regions, 1+1) // 1 built-in region + 1 test-managed STUN region
35 for _, v := range report.DERP.Regions {
36 require.Len(t, v.NodeReports, len(v.Region.Nodes))
37 }
38}

Callers

nothing calls this directly

Calls 9

NewFunction · 0.92
NewFunction · 0.92
StartWithWaiterFunction · 0.92
RequireSuccessMethod · 0.80
LogMethod · 0.80
loginFunction · 0.70
BytesMethod · 0.45
UnmarshalMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected