MCPcopy
hub / github.com/tailscale/tailscale / TestDebuggerSection

Function TestDebuggerSection

tsweb/debug_test.go:115–130  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

113}
114
115func TestDebuggerSection(t *testing.T) {
116 mux := http.NewServeMux()
117 dbg := Debugger(mux)
118 dbg.Section(func(w io.Writer, r *http.Request) {
119 fmt.Fprintf(w, "Test output %v", r.RemoteAddr)
120 })
121
122 code, body := get(mux, "/debug/", tsIP)
123 if code != 200 {
124 t.Fatalf("debug access failed, got %v", code)
125 }
126 want := `Test output 100.100.100.100:1234`
127 if !strings.Contains(body, want) {
128 t.Errorf("want %q in output, not found", want)
129 }
130}
131
132func TestDebuggerHandle(t *testing.T) {
133 mux := http.NewServeMux()

Callers

nothing calls this directly

Calls 6

SectionMethod · 0.80
DebuggerFunction · 0.70
getFunction · 0.70
FatalfMethod · 0.65
ErrorfMethod · 0.65
ContainsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…