Skip to content

Commit

Permalink
Add missing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Feb 19, 2025
1 parent c0e1a8c commit c0d32d0
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions internal/parser/utils/source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3501,6 +3501,35 @@ unless
},
},
},
{
expr: `sum(foo{a="1"}) by(job) * on() bar{b="2"}`,
output: []utils.Source{
{
Type: utils.AggregateSource,
Returns: promParser.ValueTypeVector,
Operation: "sum",
Selector: mustParse[*promParser.VectorSelector](t, `foo{a="1"}`, 4),
Aggregation: mustParse[*promParser.AggregateExpr](t, `sum(foo{a="1"}) by(job)`, 0),
FixedLabels: true,
ExcludeReason: map[string]utils.ExcludedLabel{
"": {
Reason: "Query is using one-to-one vector matching with `on()`, only labels included inside `on(...)` will be present on the results.",
Fragment: `sum(foo{a="1"}) by(job) * on() bar{b="2"}`,
},
},
Joins: []utils.Join{
{
Src: utils.Source{
Type: utils.SelectorSource,
Returns: promParser.ValueTypeVector,
GuaranteedLabels: []string{"b"},
Selector: mustParse[*promParser.VectorSelector](t, `bar{b="2"}`, 31),
},
},
},
},
},
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit c0d32d0

Please sign in to comment.