| 97 | } |
| 98 | |
| 99 | func TestDebuggerURL(t *testing.T) { |
| 100 | mux := http.NewServeMux() |
| 101 | dbg := Debugger(mux) |
| 102 | dbg.URL("https://www.tailscale.com", "Homepage") |
| 103 | |
| 104 | code, body := get(mux, "/debug/", tsIP) |
| 105 | if code != 200 { |
| 106 | t.Fatalf("debug access failed, got %v", code) |
| 107 | } |
| 108 | for _, want := range []string{"https://www.tailscale.com", "Homepage"} { |
| 109 | if !strings.Contains(body, want) { |
| 110 | t.Errorf("want %q in output, not found", want) |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | func TestDebuggerSection(t *testing.T) { |
| 116 | mux := http.NewServeMux() |