Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney committed Sep 18, 2024
1 parent b2a7688 commit 0a0559a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions pkg/querier/queryrange/roundtrip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1607,10 +1607,21 @@ func indexStatsResult(v logproto.IndexStatsResponse) (*int, base.Handler) {
func seriesVolumeResult(v logproto.VolumeResponse) (*int, base.Handler) {
count := 0
var lock sync.Mutex
return &count, base.HandlerFunc(func(_ context.Context, _ base.Request) (base.Response, error) {
return &count, base.HandlerFunc(func(_ context.Context, req base.Request) (base.Response, error) {
lock.Lock()
defer lock.Unlock()
count++

switch req.(type) {
case *logproto.VolumeRequest:
count++
// Split by label middleware makes a labels call for __stream_shard__. Pretend there's never
// and stream shards to keep the tests simpler.
case *LabelRequest:
return &LokiLabelNamesResponse{
Status: "success",
Data: []string{},
}, nil
}
return &VolumeResponse{Response: &v}, nil
})
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/querier/queryrange/split_by_shard_label_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func Test_SplitByShardLabel(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
lims := limits{
Limits: nil,
Limits: fakeLimits{},
splitDuration: &tc.splitDuration,
}

Expand Down Expand Up @@ -228,7 +228,7 @@ func Test_SplitByShardLabel(t *testing.T) {
func(t *testing.T) {
splitDuration := 30 * time.Minute
lims := limits{
Limits: nil,
Limits: fakeLimits{},
splitDuration: &splitDuration,
}

Expand Down

0 comments on commit 0a0559a

Please sign in to comment.