Skip to content

Commit 125f872

Browse files
committed
querymiddleware: utf8/legacy tests for MetricsQueryRequestValidationRoundTripper
1 parent a6e76ff commit 125f872

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

pkg/frontend/querymiddleware/request_validation_test.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,21 @@ func TestMetricsQueryRequestValidationRoundTripper(t *testing.T) {
7070
url: instantQueryPathSuffix + "?query=up&start=123&end=456&step=60s",
7171
expectedErrType: "",
7272
},
73+
{
74+
// accepts utf label names
75+
url: instantQueryPathSuffix + `?query=up{"test.label"="test"}`,
76+
expectedErrType: "",
77+
},
78+
{
79+
// accepts utf metric name
80+
url: instantQueryPathSuffix + `?query={"test.label"}`,
81+
expectedErrType: "",
82+
},
83+
{
84+
// invalid utf-string
85+
url: instantQueryPathSuffix + "?query=up{\"test.label\"=\"\xff\"}",
86+
expectedErrType: apierror.TypeBadData,
87+
},
7388
} {
7489
t.Run(strconv.Itoa(i), func(t *testing.T) {
7590
req, err := http.NewRequest(http.MethodGet, srv.URL+tc.url, nil)
@@ -132,7 +147,7 @@ func TestLabelsQueryRequestValidationRoundTripper(t *testing.T) {
132147
expectedErrType: "",
133148
},
134149
{
135-
url: labelNamesPathSuffix + "?match=up{}&start=123&end=456&limit=100",
150+
url: labelNamesPathSuffix + "?match[]=up{}&start=123&end=456&limit=100",
136151
expectedErrType: "",
137152
},
138153
} {

0 commit comments

Comments
 (0)