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

Refactor part 2 - separate merge from diff iterator [change-log] optimize merge by 20 percent #2884

Merged
merged 17 commits into from
Feb 6, 2022
Merged
2 changes: 1 addition & 1 deletion nessie/identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestIdentity(t *testing.T) {

resp, err := client.MergeIntoBranchWithResponse(ctx, repo, branch1, branch2, api.MergeIntoBranchJSONRequestBody{})
require.NoError(t, err, "error during merge")
require.NotNil(t, resp.JSON400, "merge should fail since there are no changes between the branches")
require.Nil(t, resp.JSON400, "allow merge with no changes between the branches")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a strange test to check specifically that the 400 error is empty - should probably check that the returned code is not empty (200?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

})
}
}
10 changes: 8 additions & 2 deletions pkg/api/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,10 @@ func TestController_CommitsGetBranchCommitLogByPath(t *testing.T) {
user: "user3",
commitName: "P",
})
mergeCommit, _ := deps.catalog.Merge(ctx, "repo3", "main", "branch-b", "user3", "commitR", nil)
mergeCommit, err := deps.catalog.Merge(ctx, "repo3", "main", "branch-b", "user3", "commitR", nil)
if err != nil {
t.Fatal(err)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if err != nil {
t.Fatal(err)
}
testutil.Must(t, err)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

commitsMap["commitR"] = mergeCommit.Reference
commitsMap["commitM"] = testCommitEntries(t, ctx, deps.catalog, deps, commitEntriesParams{
repo: "repo3",
Expand All @@ -352,7 +355,10 @@ func TestController_CommitsGetBranchCommitLogByPath(t *testing.T) {
user: "user2",
commitName: "M",
})
mergeCommit, _ = deps.catalog.Merge(ctx, "repo3", "main", "branch-a", "user2", "commitN", nil)
mergeCommit, err = deps.catalog.Merge(ctx, "repo3", "main", "branch-a", "user2", "commitN", nil)
if err != nil {
t.Fatal(err)
}
commitsMap["commitN"] = mergeCommit.Reference
commitsMap["commitX"] = testCommitEntries(t, ctx, deps.catalog, deps, commitEntriesParams{
repo: "repo3",
Expand Down
Loading