diff --git a/pkg/store/proxy_test.go b/pkg/store/proxy_test.go index 8c5e749216..774f8ad194 100644 --- a/pkg/store/proxy_test.go +++ b/pkg/store/proxy_test.go @@ -32,6 +32,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" @@ -78,6 +79,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)