Merge pull request #13656 from prometheus/owilliams/quotetests

tests(utf8): confirm that other quote marks are handled correctly in promql
This commit is contained in:
Björn Rabenstein 2024-02-27 23:16:43 +01:00 committed by GitHub
commit 4408f898bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1731,6 +1731,34 @@ var testExpr = []struct {
},
},
},
{
input: `{'foo\'bar', 'a\\dos\\path'='boo\\urns'}`,
expected: &VectorSelector{
// When a metric is named inside the braces, the Name field is not set.
LabelMatchers: []*labels.Matcher{
MustLabelMatcher(labels.MatchEqual, model.MetricNameLabel, `foo'bar`),
MustLabelMatcher(labels.MatchEqual, `a\dos\path`, `boo\urns`),
},
PosRange: posrange.PositionRange{
Start: 0,
End: 40,
},
},
},
{
input: `{'foo\'bar', ` + "`" + `a\dos\path` + "`" + `="boo"}`,
expected: &VectorSelector{
// When a metric is named inside the braces, the Name field is not set.
LabelMatchers: []*labels.Matcher{
MustLabelMatcher(labels.MatchEqual, model.MetricNameLabel, `foo'bar`),
MustLabelMatcher(labels.MatchEqual, `a\dos\path`, "boo"),
},
PosRange: posrange.PositionRange{
Start: 0,
End: 32,
},
},
},
{
input: `{"foo", a="bc"}`,
expected: &VectorSelector{