MCPcopy Create free account
hub / github.com/coder/coder / sendRestart

Function sendRestart

tailnet/test/integration/suite.go:21–43  ·  view source on GitHub ↗

nolint:revive

(t *testing.T, serverURL *url.URL, derp bool, coordinator bool)

Source from the content-addressed store, hash-verified

19
20// nolint:revive
21func sendRestart(t *testing.T, serverURL *url.URL, derp bool, coordinator bool) {
22 t.Helper()
23 ctx := testutil.Context(t, 2*time.Second)
24
25 serverURL, err := url.Parse(serverURL.String() + "/restart")
26 q := serverURL.Query()
27 if derp {
28 q.Set("derp", "true")
29 }
30 if coordinator {
31 q.Set("coordinator", "true")
32 }
33 serverURL.RawQuery = q.Encode()
34 require.NoError(t, err)
35
36 req, err := http.NewRequestWithContext(ctx, http.MethodPost, serverURL.String(), nil)
37 require.NoError(t, err)
38 resp, err := http.DefaultClient.Do(req)
39 require.NoError(t, err)
40 defer resp.Body.Close()
41
42 require.Equal(t, http.StatusOK, resp.StatusCode, "unexpected status code %d", resp.StatusCode)
43}
44
45// TODO: instead of reusing one conn for each suite, maybe we should make a new
46// one for each subtest?

Callers 1

TestSuiteFunction · 0.85

Calls 9

ContextFunction · 0.92
EncodeMethod · 0.80
HelperMethod · 0.65
ParseMethod · 0.65
SetMethod · 0.65
DoMethod · 0.65
CloseMethod · 0.65
StringMethod · 0.45
EqualMethod · 0.45

Tested by 1

TestSuiteFunction · 0.68