Read about our upcoming Code of Conduct on this issue

Commit 71bf07cc authored by Raphaël Gomès's avatar Raphaël Gomès
Browse files

mirror: add a test for an "hg-pull" mirror with an empty project

parent 21723972af9c
Pipeline #14746 passed with stage
in 28 minutes and 51 seconds
......@@ -4,6 +4,7 @@
# GNU General Public License version 2 or any later version.
#
# SPDX-License-Identifier: GPL-2.0-or-later
from .test_import import prepare_import_source, LocalRepo, hg_log_set
def test_create(test_project):
......@@ -26,3 +27,33 @@ def test_update(test_project):
data={"url": "https://other.test", "enabled": True})
assert info['url'] == url # Gitlab does not allow updating the url
assert info['enabled'] is True
def test_pull(test_project, public_project, tmpdir):
"""Test hg-pull mirror"""
src_repo, src_url = prepare_import_source(public_project, tmpdir,
tweak_hgrc=False)
print("Graph of source project after push:")
print(src_repo.graphlog())
print("Url of the mirror target")
print(src_url)
mirror = test_project.api_create_mirror(url=src_url,
enabled=True,
hg_mirror_type='hg-pull')
res = mirror.api_trigger(check=False)
assert res.status_code == 204
# Check that Gitlab became aware of the changes done by the pull
test_project.wait_assert_api_branches(
lambda branches: "topic/default/antelope" in branches,
timeout=30,
)
clone = LocalRepo.clone(test_project.owner_basic_auth_url,
tmpdir.join('target-repo'))
expected_log_set = hg_log_set(src_repo, phase=False)
assert hg_log_set(clone, phase=False) == expected_log_set
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