Skip to content

Commit

Permalink
cr: fix docs and test
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Chodur <m.chodur@seznam.cz>
  • Loading branch information
FUSAKLA committed Feb 3, 2022
1 parent d0f58ef commit 53bab98
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions docs/components/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,9 @@ Flags:
other matchers will be ignored. When specified,
this command will be run only once after
successful replication. Repeated field
--ignore-marked-for-deletion
Do not replicate blocks that have deletion
mark.
--log.format=logfmt Log format to use. Possible options: logfmt or
json.
--log.level=info Log filtering level.
Expand Down
20 changes: 10 additions & 10 deletions pkg/replicate/scheme_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ func testDeletionMark(ulid ulid.ULID) *metadata.DeletionMark {
func TestReplicationSchemeAll(t *testing.T) {
testBlockID := testULID(0)
var cases = []struct {
name string
selector labels.Selector
blockIDs []ulid.ULID
prepare func(ctx context.Context, t *testing.T, originBucket, targetBucket *objstore.InMemBucket)
assert func(ctx context.Context, t *testing.T, originBucket, targetBucket *objstore.InMemBucket)
name string
selector labels.Selector
blockIDs []ulid.ULID
ignoreMarkedForDeletion bool
prepare func(ctx context.Context, t *testing.T, originBucket, targetBucket *objstore.InMemBucket)
assert func(ctx context.Context, t *testing.T, originBucket, targetBucket *objstore.InMemBucket)
}{
{
name: "EmptyOrigin",
Expand Down Expand Up @@ -126,7 +127,8 @@ func TestReplicationSchemeAll(t *testing.T) {
},
},
{
name: "MarkedForDeletion",
name: "MarkedForDeletion",
ignoreMarkedForDeletion: true,
prepare: func(ctx context.Context, t *testing.T, originBucket, targetBucket *objstore.InMemBucket) {
ulid := testULID(0)
meta := testMeta(ulid)
Expand All @@ -142,9 +144,7 @@ func TestReplicationSchemeAll(t *testing.T) {
_ = originBucket.Upload(ctx, path.Join(ulid.String(), "index"), bytes.NewReader(nil))
},
assert: func(ctx context.Context, t *testing.T, originBucket, targetBucket *objstore.InMemBucket) {
if len(targetBucket.Objects()) != 0 {
t.Fatal("TargetBucket should have been empty but is not.")
}
testutil.Equals(t, map[string][]byte{}, targetBucket.Objects())
},
},
{
Expand Down Expand Up @@ -374,7 +374,7 @@ func TestReplicationSchemeAll(t *testing.T) {
selector = c.selector
}

filter := NewBlockFilter(logger, selector, []compact.ResolutionLevel{compact.ResolutionLevelRaw}, []int{1}, c.blockIDs, true).Filter
filter := NewBlockFilter(logger, selector, []compact.ResolutionLevel{compact.ResolutionLevelRaw}, []int{1}, c.blockIDs, c.ignoreMarkedForDeletion).Filter
fetcher, err := block.NewMetaFetcher(logger, 32, objstore.WithNoopInstr(originBucket), "", nil, nil)
testutil.Ok(t, err)

Expand Down

0 comments on commit 53bab98

Please sign in to comment.