Skip to content

Commit

Permalink
Test (empty) diff between a ref and itself
Browse files Browse the repository at this point in the history
  • Loading branch information
arielshaqed committed Nov 25, 2020
1 parent 35a8ecb commit f32712f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions catalog/mvcc/cataloger_diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,31 @@ import (
"github.com/treeverse/lakefs/testutil"
)

func TestCataloger_DiffEmpty(t *testing.T) {
ctx := context.Background()
c := testCataloger(t)
repository := testCatalogerRepo(t, ctx, c, "repo", "master")

// create N files and commit
commitChanges := func(n int, msg, branch string) {
for i := 0; i < n; i++ {
testCatalogerCreateEntry(t, ctx, c, repository, branch, "/file"+strconv.Itoa(i), nil, branch)
}
_, err := c.Commit(ctx, repository, branch, msg, "tester", nil)
testutil.MustDo(t, msg, err)
}
commitChanges(10, "Changes on master", "master")

res, hasMore, err := c.Diff(ctx, repository, "master", "master", DiffParams{Limit: 10})
testutil.MustDo(t, "Diff", err)
if len(res) != 0 {
t.Errorf("Diff: got %+v but expected nothing", res)
}
if hasMore {
t.Errorf("Diff: got *more* diffs but expected nothing")
}
}

func TestCataloger_Diff(t *testing.T) {
ctx := context.Background()
c := testCataloger(t)
Expand Down

0 comments on commit f32712f

Please sign in to comment.