Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor readability fix for shipper tests. #2764

Merged
merged 1 commit into from
Jun 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Minor readability fix for shipper tests.
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
  • Loading branch information
bwplotka committed Jun 15, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit bf6af0051613c9cd58730c97d20f565559960310
1 change: 0 additions & 1 deletion pkg/shipper/shipper.go
Original file line number Diff line number Diff line change
@@ -419,7 +419,6 @@ func (s *Shipper) iterBlockMetas(f func(m *metadata.Meta) error) error {
return metas[i].BlockMeta.MinTime < metas[j].BlockMeta.MinTime
})
for _, m := range metas {

if err := f(m); err != nil {
return err
}
9 changes: 3 additions & 6 deletions pkg/shipper/shipper_test.go
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ import (
"math/rand"
"os"
"path"
"sort"
"testing"

"github.com/go-kit/kit/log"
@@ -84,7 +83,6 @@ func TestShipperTimestamps(t *testing.T) {
}

func TestIterBlockMetas(t *testing.T) {
var metas []*metadata.Meta
dir, err := ioutil.TempDir("", "shipper-test")
testutil.Ok(t, err)
defer func() {
@@ -124,16 +122,15 @@ func TestIterBlockMetas(t *testing.T) {
},
}))

var ids []ulid.ULID
shipper := New(nil, nil, dir, nil, nil, metadata.TestSource)
if err := shipper.iterBlockMetas(func(m *metadata.Meta) error {
metas = append(metas, m)
ids = append(ids, m.ULID)
return nil
}); err != nil {
testutil.Ok(t, err)
}
testutil.Equals(t, sort.SliceIsSorted(metas, func(i, j int) bool {
return metas[i].BlockMeta.MinTime < metas[j].BlockMeta.MinTime
}), true)
testutil.Equals(t, []ulid.ULID{id1, id3, id2}, ids)
}

func BenchmarkIterBlockMetas(b *testing.B) {