Skip to content

Commit

Permalink
Add test case for proxy store
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
  • Loading branch information
fpetkovski authored and HC Zhu committed Jun 27, 2023
1 parent 949bc15 commit d6140a8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pkg/store/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/efficientgo/core/testutil"

"github.com/thanos-io/thanos/pkg/component"
"github.com/thanos-io/thanos/pkg/info/infopb"
"github.com/thanos-io/thanos/pkg/store/labelpb"
"github.com/thanos-io/thanos/pkg/store/storepb"
storetestutil "github.com/thanos-io/thanos/pkg/store/storepb/testutil"
Expand Down Expand Up @@ -77,6 +78,34 @@ func TestProxyStore_Info(t *testing.T) {
testutil.Equals(t, int64(0), resp.MaxTime)
}

func TestProxyStore_TSDBInfos(t *testing.T) {
stores := []Client{
&storetestutil.TestClient{
StoreTSDBInfos: nil,
},
&storetestutil.TestClient{
StoreTSDBInfos: []infopb.TSDBInfo{
infopb.NewTSDBInfo(0, 10, []labelpb.ZLabel{{Name: "lbl", Value: "val1"}}),
},
},
&storetestutil.TestClient{
StoreTSDBInfos: []infopb.TSDBInfo{
infopb.NewTSDBInfo(0, 20, []labelpb.ZLabel{{Name: "lbl", Value: "val2"}}),
},
},
}
q := NewProxyStore(nil, nil,
func() []Client { return stores },
component.Query, nil, 0*time.Second, EagerRetrieval,
)

expected := []infopb.TSDBInfo{
infopb.NewTSDBInfo(0, 10, []labelpb.ZLabel{{Name: "lbl", Value: "val1"}}),
infopb.NewTSDBInfo(0, 20, []labelpb.ZLabel{{Name: "lbl", Value: "val2"}}),
}
testutil.Equals(t, expected, q.TSDBInfos())
}

func TestProxyStore_Series(t *testing.T) {
defer custom.TolerantVerifyLeak(t)

Expand Down

0 comments on commit d6140a8

Please sign in to comment.