Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
  • Loading branch information
fpetkovski committed Oct 15, 2024
1 parent 0167097 commit f364085
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/store/proxy_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func TestProxyResponseTreeSort(t *testing.T) {
input: []respSet{
&eagerRespSet{
closeSeries: func() {},
cl: nopClientSendCloser{},
wg: &sync.WaitGroup{},
bufferedResponses: []*storepb.SeriesResponse{
storeSeriesResponse(t, labelsFromStrings("a", "1", "c", "3")),
Expand All @@ -43,6 +44,7 @@ func TestProxyResponseTreeSort(t *testing.T) {
},
&eagerRespSet{
closeSeries: func() {},
cl: nopClientSendCloser{},
wg: &sync.WaitGroup{},
bufferedResponses: []*storepb.SeriesResponse{
storeSeriesResponse(t, labelsFromStrings("a", "1", "c", "4", "e", "5")),
Expand All @@ -62,6 +64,7 @@ func TestProxyResponseTreeSort(t *testing.T) {
input: []respSet{
&eagerRespSet{
closeSeries: func() {},
cl: nopClientSendCloser{},
wg: &sync.WaitGroup{},
bufferedResponses: []*storepb.SeriesResponse{
storeSeriesResponse(t, labelsFromStrings("a", "1", "b", "2", "c", "3")),
Expand All @@ -71,6 +74,7 @@ func TestProxyResponseTreeSort(t *testing.T) {
},
&eagerRespSet{
closeSeries: func() {},
cl: nopClientSendCloser{},
wg: &sync.WaitGroup{},
bufferedResponses: []*storepb.SeriesResponse{
storeSeriesResponse(t, labelsFromStrings("d", "4", "e", "5")),
Expand All @@ -91,6 +95,7 @@ func TestProxyResponseTreeSort(t *testing.T) {
input: []respSet{
&eagerRespSet{
closeSeries: func() {},
cl: nopClientSendCloser{},
wg: &sync.WaitGroup{},
bufferedResponses: []*storepb.SeriesResponse{
storeSeriesResponse(t, labelsFromStrings("a", "1", "b", "2", "ext2", "9")),
Expand All @@ -100,6 +105,7 @@ func TestProxyResponseTreeSort(t *testing.T) {
},
&eagerRespSet{
closeSeries: func() {},
cl: nopClientSendCloser{},
wg: &sync.WaitGroup{},
bufferedResponses: []*storepb.SeriesResponse{
storeSeriesResponse(t, labelsFromStrings("a", "1", "b", "2", "ext1", "5", "ext2", "9")),
Expand All @@ -120,6 +126,7 @@ func TestProxyResponseTreeSort(t *testing.T) {
input: []respSet{
&eagerRespSet{
closeSeries: func() {},
cl: nopClientSendCloser{},
wg: &sync.WaitGroup{},
bufferedResponses: []*storepb.SeriesResponse{
storeSeriesResponse(t, labelsFromStrings("a", "1", "b", "2", "c", "3")),
Expand All @@ -129,6 +136,7 @@ func TestProxyResponseTreeSort(t *testing.T) {
},
&eagerRespSet{
closeSeries: func() {},
cl: nopClientSendCloser{},
wg: &sync.WaitGroup{},
bufferedResponses: []*storepb.SeriesResponse{
storeSeriesResponse(t, labelsFromStrings("a", "1", "b", "1", "c", "3")),
Expand All @@ -149,6 +157,7 @@ func TestProxyResponseTreeSort(t *testing.T) {
input: []respSet{
&eagerRespSet{
closeSeries: func() {},
cl: nopClientSendCloser{},
wg: &sync.WaitGroup{},
bufferedResponses: []*storepb.SeriesResponse{
storeSeriesResponse(t, labelsFromStrings("a", "1", "b", "2", "ext2", "9")),
Expand All @@ -158,6 +167,7 @@ func TestProxyResponseTreeSort(t *testing.T) {
},
&eagerRespSet{
closeSeries: func() {},
cl: nopClientSendCloser{},
wg: &sync.WaitGroup{},
bufferedResponses: []*storepb.SeriesResponse{
storeSeriesResponse(t, labelsFromStrings("a", "1", "b", "2", "ext1", "5", "ext2", "9")),
Expand All @@ -178,6 +188,7 @@ func TestProxyResponseTreeSort(t *testing.T) {
input: []respSet{
&eagerRespSet{
closeSeries: func() {},
cl: nopClientSendCloser{},
wg: &sync.WaitGroup{},
bufferedResponses: []*storepb.SeriesResponse{
storeSeriesResponse(t, labelsFromStrings("cluster", "beam-platform", "instance", "10.70.13.3:15692", "prometheus", "telemetry/observe-prometheus", "receive", "true", "tenant_id", "default-tenant")),
Expand All @@ -188,6 +199,7 @@ func TestProxyResponseTreeSort(t *testing.T) {
},
&eagerRespSet{
closeSeries: func() {},
cl: nopClientSendCloser{},
wg: &sync.WaitGroup{},
bufferedResponses: []*storepb.SeriesResponse{
storeSeriesResponse(t, labelsFromStrings("cluster", "beam-platform", "instance", "10.70.13.3:15692", "prometheus", "telemetry/observe-prometheus", "receive", "true", "tenant_id", "default-tenant")),
Expand Down Expand Up @@ -219,6 +231,12 @@ func TestProxyResponseTreeSort(t *testing.T) {
}
}

type nopClientSendCloser struct {
storepb.Store_SeriesClient
}

func (c nopClientSendCloser) CloseSend() error { return nil }

func TestSortWithoutLabels(t *testing.T) {
for _, tcase := range []struct {
input []*storepb.SeriesResponse
Expand Down Expand Up @@ -341,6 +359,7 @@ func BenchmarkKWayMerge(b *testing.B) {
for j := 0; j < 1000; j++ {
respSets = append(respSets, &eagerRespSet{
closeSeries: func() {},
cl: nopClientSendCloser{},
wg: &sync.WaitGroup{},
bufferedResponses: []*storepb.SeriesResponse{
storeSeriesResponse(b, labelsFromStrings("a", "1", "b", fmt.Sprintf("replica-%d", j), "c", "3")),
Expand Down

0 comments on commit f364085

Please sign in to comment.