Skip to content

Commit 722101b

Browse files
authored
test: fix test repo urls to match new gitlab cloudnative form (#3189)
1 parent 42aee90 commit 722101b

File tree

15 files changed

+41
-33
lines changed

15 files changed

+41
-33
lines changed

renku/core/util/git.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ def get_renku_repo_url(remote_url, deployment_hostname=None, access_token=None):
209209
credentials = f"renku:{access_token}@" if access_token else ""
210210
hostname = deployment_hostname or parsed_remote.hostname
211211

212+
if hostname.startswith("gitlab."):
213+
hostname = hostname.replace("gitlab.", "", 1)
214+
212215
return urllib.parse.urljoin(f"https://{credentials}{hostname}", path)
213216

214217

@@ -759,6 +762,10 @@ def check_and_reuse_existing_repository() -> Optional["Repository"]:
759762
repository.pull()
760763
except errors.GitCommandError: # NOTE: When ref is not a branch, an error is thrown
761764
pass
765+
else:
766+
# NOTE: not same remote, so don't reuse
767+
clean_directory()
768+
return None
762769
except errors.GitError: # NOTE: Not a git repository, remote not found, or checkout failed
763770
clean_directory()
764771
else:

tests/cli/test_init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ def test_init_initial_branch(isolated_runner, project_init):
148148
"remote",
149149
[
150150
(
151-
"https://user:[email protected]/gitlab/group/subgroup/project.git",
151+
"https://user:password@gitlab.dev.renku.ch/group/subgroup/project.git",
152152
"https://dev.renku.ch/projects/group/subgroup/project",
153153
),
154154
("ssh://@dev.renku.ch:group/subgroup/project.git", "https://dev.renku.ch/projects/group/subgroup/project"),
155155
(
156-
"https://user:[email protected]/gitlab/group/subgroup/sub-subgroup/project.git",
156+
"https://user:password@gitlab.dev.renku.ch/group/subgroup/sub-subgroup/project.git",
157157
"https://dev.renku.ch/projects/group/subgroup/sub-subgroup/project",
158158
),
159159
(

tests/cli/test_integration_cli.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
@pytest.mark.integration
3030
@retry_failed
31-
@pytest.mark.parametrize("url", ["https://dev.renku.ch/gitlab/renku-testing/project-9"])
31+
@pytest.mark.parametrize("url", ["https://gitlab.dev.renku.ch/renku-testing/project-9"])
3232
def test_renku_clone(runner, monkeypatch, url):
3333
"""Test cloning of a Renku repo and existence of required settings."""
3434
import renku.core.storage
@@ -59,7 +59,7 @@ def test_renku_clone(runner, monkeypatch, url):
5959

6060
@pytest.mark.integration
6161
@retry_failed
62-
@pytest.mark.parametrize("url", ["https://dev.renku.ch/gitlab/renku-testing/project-9"])
62+
@pytest.mark.parametrize("url", ["https://gitlab.dev.renku.ch/renku-testing/project-9"])
6363
def test_renku_clone_with_config(tmp_path, url):
6464
"""Test cloning of a Renku repo and existence of required settings."""
6565
with chdir(tmp_path):
@@ -75,7 +75,7 @@ def test_renku_clone_with_config(tmp_path, url):
7575

7676
@pytest.mark.integration
7777
@retry_failed
78-
@pytest.mark.parametrize("url", ["https://dev.renku.ch/gitlab/renku-testing/project-9"])
78+
@pytest.mark.parametrize("url", ["https://gitlab.dev.renku.ch/renku-testing/project-9"])
7979
def test_renku_clone_checkout_rev(tmp_path, url):
8080
"""Test cloning of a repo checking out a rev with static config."""
8181
with chdir(tmp_path):
@@ -102,7 +102,7 @@ def test_renku_clone_checkout_revs(tmp_path, rev, detached):
102102
repository, _ = (
103103
project_clone_command()
104104
.build()
105-
.execute("https://dev.renku.ch/gitlab/renku-python-integration-tests/no-renku.git", checkout_revision=rev)
105+
.execute("https://gitlab.dev.renku.ch/renku-python-integration-tests/no-renku.git", checkout_revision=rev)
106106
).output
107107

108108
if detached:
@@ -117,7 +117,7 @@ def test_renku_clone_checkout_revs(tmp_path, rev, detached):
117117
@retry_failed
118118
def test_renku_clone_uses_project_name(runner, path, expected_path):
119119
"""Test renku clone uses project name as target-path by default."""
120-
remote = "https://dev.renku.ch/gitlab/renku-testing/project-9"
120+
remote = "https://gitlab.dev.renku.ch/renku-testing/project-9"
121121

122122
with runner.isolated_filesystem() as project_path:
123123
result = runner.invoke(cli, ["clone", remote, path])

tests/cli/test_integration_datasets.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def test_dataset_reimport_renkulab_dataset(runner, project, url):
507507
assert 0 == runner.invoke(cli, ["dataset", "import", url], input="y").exit_code
508508

509509
result = runner.invoke(cli, ["dataset", "import", url], input="y")
510-
assert 1 == result.exit_code
510+
assert 1 == result.exit_code, format_result_exception(result)
511511
assert "Dataset exists" in result.output
512512

513513

@@ -666,7 +666,7 @@ def test_dataset_export_upload_tag(
666666
@pytest.mark.integration
667667
def test_dataset_export_to_local(runner, tmp_path):
668668
"""Test exporting a version of dataset to a local directory."""
669-
url = "https://dev.renku.ch/gitlab/renku-python-integration-tests/lego-datasets.git"
669+
url = "https://gitlab.dev.renku.ch/renku-python-integration-tests/lego-datasets.git"
670670
repository = Repository.clone_from(url=url, path=tmp_path / "repo")
671671
# NOTE: Install LFS and disable LFS smudge filter to make sure that we can get valid content in that case
672672
repository.lfs.install(skip_smudge=True)
@@ -1440,7 +1440,7 @@ def test_import_from_renku_project(tmpdir, project, runner):
14401440
"""Check metadata for an imported dataset from other renkulab repo."""
14411441
from renku.domain_model.project_context import project_context
14421442

1443-
url = "https://dev.renku.ch/gitlab/renku-testing/project-9.git"
1443+
url = "https://gitlab.dev.renku.ch/renku-testing/project-9.git"
14441444

14451445
def get_remote_file():
14461446
repo_path = tmpdir.mkdir("remote_repo")
@@ -1734,6 +1734,7 @@ def test_migration_submodule_datasets(isolated_runner, old_repository_with_submo
17341734
assert not path.is_symlink()
17351735
assert file.based_on is not None
17361736
assert Path(file.entity.path).name == Path(file.based_on.path).name
1737+
# NOTE: Old repo URL pre-cloudnative gitlab, not changed by migration
17371738
assert "https://dev.renku.ch/gitlab/mohammad.alisafaee/remote-renku-project.git" == file.based_on.url
17381739

17391740

@@ -1948,7 +1949,7 @@ def test_dataset_update_removes_deleted_files(project, runner, with_injection):
19481949
@pytest.mark.integration
19491950
def test_dataset_ls_with_tag(runner, tmp_path):
19501951
"""Test listing dataset files from a given tag."""
1951-
url = "https://dev.renku.ch/gitlab/renku-python-integration-tests/lego-datasets.git"
1952+
url = "https://gitlab.dev.renku.ch/renku-python-integration-tests/lego-datasets.git"
19521953
repository = Repository.clone_from(url=url, path=tmp_path / "repo")
19531954

19541955
os.chdir(repository.path)

tests/cli/test_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def test_template_set_uses_renku_version_when_non_existing(tmpdir, runner):
203203
from renku.domain_model.project_context import project_context
204204
from renku.version import __version__
205205

206-
url = "https://dev.renku.ch/gitlab/renku-testing/project-9.git"
206+
url = "https://gitlab.dev.renku.ch/renku-testing/project-9.git"
207207
repo_path = tmpdir.mkdir("repo")
208208
Repository.clone_from(url=url, path=repo_path, env={"GIT_LFS_SKIP_SMUDGE": "1"})
209209

tests/core/commands/test_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def test_uppercase_dataset_name_is_valid():
249249
@pytest.mark.integration
250250
def test_get_dataset_by_tag(with_injection, tmp_path):
251251
"""Test getting datasets by a given tag."""
252-
url = "https://dev.renku.ch/gitlab/renku-python-integration-tests/lego-datasets.git"
252+
url = "https://gitlab.dev.renku.ch/renku-python-integration-tests/lego-datasets.git"
253253
repository = Repository.clone_from(url=url, path=tmp_path / "repo")
254254

255255
with project_context.with_path(repository.path), with_injection():

tests/core/metadata/test_repository.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def test_contains_untracked_file(git_repository):
261261
@pytest.mark.integration
262262
def test_get_content_from_lfs(tmp_path):
263263
"""Test can get file content from LFS."""
264-
url = "https://dev.renku.ch/gitlab/renku-python-integration-tests/lego-datasets.git"
264+
url = "https://gitlab.dev.renku.ch/renku-python-integration-tests/lego-datasets.git"
265265
repository = Repository.clone_from(url=url, path=tmp_path / "repo", env={"GIT_LFS_SKIP_SMUDGE": "1"})
266266
# NOTE: Install LFS and disable LFS smudge filter to make sure that we can get valid content in that case
267267
repository.lfs.install(skip_smudge=True)

tests/fixtures/config.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@
2323
import pytest
2424

2525
IT_REMOTE_REPO_URL = os.getenv(
26-
"IT_REMOTE_REPOSITORY", "https://dev.renku.ch/gitlab/renku-python-integration-tests/core-integration-test"
26+
"IT_REMOTE_REPOSITORY", "https://gitlab.dev.renku.ch/renku-python-integration-tests/core-integration-test"
2727
)
2828
IT_PROTECTED_REMOTE_REPO_URL = os.getenv(
29-
"IT_PROTECTED_REMOTE_REPO", "https://dev.renku.ch/gitlab/renku-python-integration-tests/core-it-protected.git"
29+
"IT_PROTECTED_REMOTE_REPO", "https://gitlab.dev.renku.ch/renku-python-integration-tests/core-it-protected.git"
3030
)
3131
IT_PUBLIC_REMOTE_REPO_URL = os.getenv(
32-
"IT_PUBLIC_REMOTE_REPO", "https://dev.renku.ch/gitlab/renku-python-integration-tests/core-it-public"
32+
"IT_PUBLIC_REMOTE_REPO", "https://gitlab.dev.renku.ch/renku-python-integration-tests/core-it-public"
3333
)
3434
IT_REMOTE_NON_RENKU_REPO_URL = os.getenv(
35-
"IT_REMOTE_NON_RENKU_REPO_URL", "https://dev.renku.ch/gitlab/renku-python-integration-tests/core-it-non-renku"
35+
"IT_REMOTE_NON_RENKU_REPO_URL", "https://gitlab.dev.renku.ch/renku-python-integration-tests/core-it-non-renku"
3636
)
3737
IT_REMOTE_NO_COMMITS_REPO_URL = os.getenv(
38-
"IT_REMOTE_NO_COMMITS_REPO_URL", "https://dev.renku.ch/gitlab/renku-python-integration-tests/core-it-no-commits"
38+
"IT_REMOTE_NO_COMMITS_REPO_URL", "https://gitlab.dev.renku.ch/renku-python-integration-tests/core-it-no-commits"
3939
)
4040
IT_GIT_ACCESS_TOKEN = os.getenv("IT_OAUTH_GIT_TOKEN")
4141

tests/fixtures/templates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def project_init(template):
8282
data["test_project"],
8383
],
8484
"init_custom_template": (
85-
"https://dev.renku.ch/gitlab/renku-python-integration-tests/core-it-template-variable-test-project"
85+
"https://gitlab.dev.renku.ch/renku-python-integration-tests/core-it-template-variable-test-project"
8686
),
8787
"remote": ["--template-source", template["url"], "--template-ref", template["ref"]],
8888
"id": ["--template-id", template["id"]],

tests/service/controllers/utils/test_project_clone.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_service_user_project_clone(svc_client_cache):
4545
project_data = {
4646
"project_name": "deadbeef",
4747
"project_repository": "https://dev.renku.ch",
48-
"project_namespace": "gitlab/renku-qa",
48+
"project_namespace": "renku-qa",
4949
"identifier": "0xdeadbeef",
5050
"depth": 1,
5151
"url": "https://github.com/SwissDataScienceCenter/renku-project-template",

0 commit comments

Comments
 (0)