mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Merge pull request #89412 from coderanger/fix-kubelet-method-metrics
Apply the same style of fix as #87913 but for HTTP methods too.
This commit is contained in:
@@ -1510,8 +1510,8 @@ func TestMetricBuckets(t *testing.T) {
|
||||
"stats summary sub": {url: "/stats/summary", bucket: "stats"},
|
||||
"stats containerName with uid": {url: "/stats/namespace/podName/uid/containerName", bucket: "stats"},
|
||||
"stats containerName": {url: "/stats/podName/containerName", bucket: "stats"},
|
||||
"invalid path": {url: "/junk", bucket: "Invalid path"},
|
||||
"invalid path starting with good": {url: "/healthzjunk", bucket: "Invalid path"},
|
||||
"invalid path": {url: "/junk", bucket: "other"},
|
||||
"invalid path starting with good": {url: "/healthzjunk", bucket: "other"},
|
||||
}
|
||||
fw := newServerTest()
|
||||
defer fw.testHTTPServer.Close()
|
||||
@@ -1523,6 +1523,26 @@ func TestMetricBuckets(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMetricMethodBuckets(t *testing.T) {
|
||||
tests := map[string]struct {
|
||||
method string
|
||||
bucket string
|
||||
}{
|
||||
"normal GET": {method: "GET", bucket: "GET"},
|
||||
"normal POST": {method: "POST", bucket: "POST"},
|
||||
"invalid method": {method: "WEIRD", bucket: "other"},
|
||||
}
|
||||
|
||||
fw := newServerTest()
|
||||
defer fw.testHTTPServer.Close()
|
||||
|
||||
for _, test := range tests {
|
||||
method := test.method
|
||||
bucket := test.bucket
|
||||
require.Equal(t, fw.serverUnderTest.getMetricMethodBucket(method), bucket)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDebuggingDisabledHandlers(t *testing.T) {
|
||||
fw := newServerTestWithDebug(false, false, nil)
|
||||
defer fw.testHTTPServer.Close()
|
||||
|
||||
Reference in New Issue
Block a user