Skip to content

Commit 5ce1283

Browse files
committed
fix test
1 parent 4c91c3c commit 5ce1283

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

pkg/metrics/http_test.go

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ var _ = Describe("Metrics", func() {
3636

3737
labels := prometheus.Labels{
3838
apiLabel: "test",
39+
methodLabel: "GET",
3940
operationLabel: "get_request-count-test",
41+
codeLabel: "200",
4042
}
4143
before := testutil.ToFloat64(HTTPRequestCount.With(labels))
4244

@@ -58,7 +60,9 @@ var _ = Describe("Metrics", func() {
5860

5961
labels := prometheus.Labels{
6062
apiLabel: "test",
63+
methodLabel: "GET",
6164
operationLabel: "get_request-duration-test",
65+
codeLabel: "200",
6266
}
6367
before := histogramSampleCount(HTTPRequestDurationHistogram.With(labels))
6468

@@ -87,19 +91,22 @@ var _ = Describe("Metrics", func() {
8791
defer server.Close()
8892

8993
labels400 := prometheus.Labels{
90-
apiLabel: "test",
91-
methodLabel: http.MethodGet,
92-
codeLabel: "400",
94+
apiLabel: "test",
95+
methodLabel: http.MethodGet,
96+
operationLabel: "get_",
97+
codeLabel: "400",
9398
}
9499
labels404 := prometheus.Labels{
95-
apiLabel: "test",
96-
methodLabel: http.MethodGet,
97-
codeLabel: "404",
100+
apiLabel: "test",
101+
methodLabel: http.MethodGet,
102+
operationLabel: "get_404",
103+
codeLabel: "404",
98104
}
99105
labels500 := prometheus.Labels{
100-
apiLabel: "test",
101-
methodLabel: http.MethodPost,
102-
codeLabel: "500",
106+
apiLabel: "test",
107+
methodLabel: http.MethodPost,
108+
operationLabel: "post_",
109+
codeLabel: "500",
103110
}
104111
before400 := testutil.ToFloat64(HTTPErrorCount.With(labels400))
105112
before404 := testutil.ToFloat64(HTTPErrorCount.With(labels404))
@@ -136,9 +143,10 @@ var _ = Describe("Metrics", func() {
136143
defer server.Close()
137144

138145
labels := prometheus.Labels{
139-
apiLabel: "test",
140-
methodLabel: http.MethodGet,
141-
codeLabel: "200",
146+
apiLabel: "test",
147+
methodLabel: http.MethodGet,
148+
operationLabel: "get_",
149+
codeLabel: "200",
142150
}
143151
before := testutil.ToFloat64(HTTPErrorCount.With(labels))
144152

0 commit comments

Comments
 (0)