Skip to content
Snippets Groups Projects
Commit c49e487b authored by Georges Racinet's avatar Georges Racinet
Browse files

RefExists Comparison tests: more corner cases

These were uncovered by doing the Rust implementation.
parent 6b69b3ba
No related branches found
No related tags found
2 merge requests!169Protocol v15.9 and stable branch merge",!166RHGitaly: reading GitLab ref state files, implementing RefService.RefExists
......@@ -74,6 +74,10 @@
assert_compare = rpc_helper.assert_compare
assert_compare_errors = rpc_helper.assert_compare_errors
# empty repo, when state files don't exist yet
assert_compare(ref=b'refs/heads/branch/default')
assert_compare(ref=b'refs/keep-around/' + b'1234' * 10)
ctx0 = wrapper.commit_file('foo')
wrapper.command('tag', b'start-tag', rev=ctx0.hex())
ctx1 = wrapper.commit_file('foo', topic='sampletop')
......@@ -77,5 +81,7 @@
ctx0 = wrapper.commit_file('foo')
wrapper.command('tag', b'start-tag', rev=ctx0.hex())
ctx1 = wrapper.commit_file('foo', topic='sampletop')
fixture.invalidate()
mr_ref_path, _ = fixture.write_special_ref(b'merge-requests/2/train',
ctx1.hex())
......@@ -80,5 +86,6 @@
mr_ref_path, _ = fixture.write_special_ref(b'merge-requests/2/train',
ctx1.hex())
hg_ka_ref_path, git_ka_ref_path = fixture.create_keep_around(ctx1.hex())
assert_compare(ref=b'refs/heads/branch/default')
assert_compare(ref=b'refs/heads/topic/default/sampletop')
......@@ -90,6 +97,13 @@
assert_compare(ref=b'refs/')
assert_compare(ref=b'refs/tags')
assert_compare(ref=b'refs/tags/')
# assert_compare() not being able to convert the keep-around ref path from
# Mercurial to Git on the fly, we need to go lower level
hg_resp = rpc_helper.rpc('hg', ref=hg_ka_ref_path)
git_resp = rpc_helper.rpc('git', ref=git_ka_ref_path)
assert hg_resp == git_resp
assert_compare(ref=b'refs/keep-around/not-even-a-hash')
assert_compare_errors(ref=b'refs')
assert_compare_errors(ref=b'HEAD')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment