tsweb: add VarzHandler tests

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-08-10 13:38:12 -07:00
committed by Brad Fitzpatrick
parent a4e19f2233
commit 5f45d8f8e6
2 changed files with 108 additions and 1 deletions

View File

@@ -424,11 +424,13 @@ func VarzHandler(w http.ResponseWriter, r *http.Request) {
})
}
}
expvar.Do(func(kv expvar.KeyValue) {
expvarDo(func(kv expvar.KeyValue) {
dump("", kv)
})
}
var expvarDo = expvar.Do // pulled out for tests
func writeMemstats(w io.Writer, ms *runtime.MemStats) {
out := func(name, typ string, v uint64, help string) {
if help != "" {