Skip to content

Commit

Permalink
Expand TestConcurrentQueries to include testing queries with float sa…
Browse files Browse the repository at this point in the history
…mples
  • Loading branch information
charleskorn committed Sep 4, 2024
1 parent 374dfa6 commit 1f8db8a
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions pkg/streamingpromql/engine_concurrency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ func TestConcurrentQueries(t *testing.T) {
native_histogram{group="a", instance="2"} {{schema:5 sum:8 count:7 buckets:[1 5 1]}}+{{schema:5 sum:10 count:7 buckets:[1 2 3 1]}}x9
native_histogram{group="b", instance="1"} {{schema:5 sum:10 count:7 buckets:[1 2 3 1]}}+{{schema:5 sum:8 count:7 buckets:[1 5 1]}}x9
native_histogram{group="b", instance="2"} {{schema:3 sum:4 count:4 buckets:[4]}}
float{group="a", instance="1"} 1+2x9
float{group="a", instance="2"} 3+2.5x9
float{group="b", instance="1"} 1 2 4 2 7 1 2 3 4
float{group="b", instance="2"} 1 9 2 8 11 12 13 14 15
`

startT := timestamp.Time(0)
Expand All @@ -61,6 +65,12 @@ func TestConcurrentQueries(t *testing.T) {
end: startT.Add(10 * time.Minute),
step: time.Minute,
},
{
expr: `sum(rate(native_histogram[5m]))`,
start: startT,
end: startT.Add(10 * time.Minute),
step: time.Minute,
},
{
expr: `count_over_time(native_histogram[5m])`,
start: startT,
Expand All @@ -79,6 +89,50 @@ func TestConcurrentQueries(t *testing.T) {
end: startT.Add(10 * time.Minute),
step: time.Minute,
},
{
expr: `rate(float[5m])`,
start: startT,
end: startT.Add(10 * time.Minute),
step: time.Minute,
},
{
// Sum of floats into single group
expr: `sum(float)`,
start: startT,
end: startT.Add(10 * time.Minute),
step: time.Minute,
},
{
// Sum of floats into many groups
expr: `sum by (group) (float)`,
start: startT,
end: startT.Add(10 * time.Minute),
step: time.Minute,
},
{
expr: `sum(rate(float[5m]))`,
start: startT,
end: startT.Add(10 * time.Minute),
step: time.Minute,
},
{
expr: `count_over_time(float[5m])`,
start: startT,
end: startT.Add(10 * time.Minute),
step: time.Minute,
},
{
expr: `sum_over_time(float[5m])`,
start: startT,
end: startT.Add(10 * time.Minute),
step: time.Minute,
},
{
expr: `avg_over_time(float[5m])`,
start: startT,
end: startT.Add(10 * time.Minute),
step: time.Minute,
},
}

storage := promqltest.LoadedStorage(t, data)
Expand Down

0 comments on commit 1f8db8a

Please sign in to comment.