Add metrics to monitor the kubelet http server

Signed-off-by: Haiyan Meng <haiyanmeng@google.com>
This commit is contained in:
Haiyan Meng
2019-03-08 15:29:23 -08:00
parent 3ef622d5b8
commit 538cd87864
5 changed files with 179 additions and 0 deletions

View File

@@ -1666,3 +1666,24 @@ func TestDebuggingDisabledHandlers(t *testing.T) {
assert.Equal(t, http.StatusOK, resp.StatusCode)
}
func TestTrimURLPath(t *testing.T) {
tests := []struct {
path, expected string
}{
{"", ""},
{"//", ""},
{"/pods", "pods"},
{"pods", "pods"},
{"pods/", "pods"},
{"good/", "good"},
{"pods/probes", "pods"},
{"metrics", "metrics"},
{"metrics/resource", "metrics/resource"},
{"metrics/hello", "metrics/hello"},
}
for _, test := range tests {
assert.Equal(t, test.expected, trimURLPath(test.path), fmt.Sprintf("path is: %s", test.path))
}
}