Commit 2d36ffe4 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

RefService.DeleteRefs: setup mutualization in comparison test

This should distract readers a bit less.

--HG--
branch : stable
parent cebd3b97b285
......@@ -72,11 +72,20 @@ def test_delete_refs(gitaly_comparison):
# TODO get_branch_sha does not work because of PosixPath not having
# the join method (py.path.local does)
git_sha = git_repo.branches()[b'branch/default']['sha']
hg_sha = base_hg_ctx.hex()
mr_ref_name = b'merge-requests/2/train'
mr_ref_path = b'refs/' + mr_ref_name
git_repo.write_ref(mr_ref_path.decode(), git_sha)
write_gitlab_special_ref(hg_repo, mr_ref_name, base_hg_ctx.hex())
def setup_mr_ref():
git_repo.write_ref(mr_ref_path.decode(), git_sha)
write_gitlab_special_ref(hg_repo, mr_ref_name, hg_sha)
# invalidation TODO use the future wrapper.reload()
setattr(hg_repo, '_gitlab_refs_special-refs', None)
assert mr_ref_path in git_repo.all_refs()
assert mr_ref_name in special_refs(hg_repo)
setup_mr_ref()
def do_rpc(vcs, refs=(), except_prefixes=()):
return vcs_channels[vcs].DeleteRefs(
......@@ -100,13 +109,7 @@ def test_delete_refs(gitaly_comparison):
assert do_rpc('hg', refs=[unknown]) == do_rpc('git', refs=[unknown])
# also mixing unknown with known is ok
git_repo.write_ref(mr_ref_path.decode(), git_sha)
write_gitlab_special_ref(hg_repo, mr_ref_name, base_hg_ctx.hex())
# TODO use the future wrapper.reload()
setattr(hg_repo, '_gitlab_refs_special-refs', None)
mixed_refs = [unknown, mr_ref_path]
assert mr_ref_path in git_repo.all_refs()
assert mr_ref_name in special_refs(hg_repo)
setup_mr_ref()
assert do_rpc('hg', refs=mixed_refs) == do_rpc('git', refs=mixed_refs)
assert git_repo.all_refs() == {b'refs/heads/branch/default': git_sha}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment