(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func 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 | } |
nothing calls this directly
no test coverage detected