Skip to content

Commit

Permalink
fix test to match new range query ts logic
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney committed Nov 3, 2023
1 parent a29b83c commit 42fbe29
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/querier/queryrange/roundtrip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ func TestVolumeTripperware(t *testing.T) {
From: model.TimeFromUnixNano(testTime.Add(-25 * time.Hour).UnixNano()), // bigger than split by interval limit
Through: model.TimeFromUnixNano(testTime.UnixNano()),
Limit: 10,
Step: 0, // Travis/Trevor: this should be ignored and set to 0. Karsten: Why?
Step: 0, // Setting this value to 0 is what makes this an instant query
AggregateBy: seriesvolume.DefaultAggregateBy,
}

Expand Down Expand Up @@ -567,7 +567,7 @@ func TestVolumeTripperware(t *testing.T) {
Matchers: `{job="varlogs"}`,
From: model.TimeFromUnixNano(start.UnixNano()), // bigger than split by interval limit
Through: model.TimeFromUnixNano(end.UnixNano()),
Step: time.Hour.Milliseconds(),
Step: time.Hour.Milliseconds(), // a non-zero value makes this a range query
Limit: 10,
AggregateBy: seriesvolume.DefaultAggregateBy,
}
Expand All @@ -587,21 +587,21 @@ func TestVolumeTripperware(t *testing.T) {
require.Equal(t, 6, *count) // 6 queries from splitting into step buckets

barBazExpectedSamples := []logproto.LegacySample{}
util.ForInterval(time.Hour, start, end, true, func(s, _ time.Time) {
util.ForInterval(time.Hour, start, end, true, func(_, e time.Time) {
barBazExpectedSamples = append(barBazExpectedSamples, logproto.LegacySample{
Value: 3350,
TimestampMs: s.Unix() * 1e3,
TimestampMs: e.UnixMilli(),
})
})
sort.Slice(barBazExpectedSamples, func(i, j int) bool {
return barBazExpectedSamples[i].TimestampMs < barBazExpectedSamples[j].TimestampMs
})

fooBarExpectedSamples := []logproto.LegacySample{}
util.ForInterval(time.Hour, start, end, true, func(s, _ time.Time) {
util.ForInterval(time.Hour, start, end, true, func(_, e time.Time) {
fooBarExpectedSamples = append(fooBarExpectedSamples, logproto.LegacySample{
Value: 1024,
TimestampMs: s.Unix() * 1e3,
TimestampMs: e.UnixMilli(),
})
})
sort.Slice(fooBarExpectedSamples, func(i, j int) bool {
Expand Down

0 comments on commit 42fbe29

Please sign in to comment.