feat: Use mirror git cloning
Test and coverage / build (push) Failing after 54s

This commit is contained in:
2026-06-28 01:58:52 +03:00
parent 846ac52854
commit e06ad4aa4e
5 changed files with 65 additions and 32 deletions
+18 -9
View File
@@ -79,16 +79,20 @@ def test_process_repo_clones_with_https_url_and_auth_env(monkeypatch, tmp_path):
assert env["GIT_CONFIG_VALUE_0"].startswith("Authorization: Basic ")
def test_process_repo_pulls_existing_repo_with_fetch_env(monkeypatch, tmp_path):
def test_process_repo_updates_existing_mirror_with_fetch_env(
monkeypatch,
tmp_path,
):
calls = []
repo_path = tmp_path / "alex" / "repo" / ".git"
repo_path.mkdir(parents=True)
repo_path = tmp_path / "alex" / "repo"
(repo_path / "objects").mkdir(parents=True)
(repo_path / "config").write_text("[core]\nrepositoryformatversion = 0\n")
def fake_git_pull(repository, env):
def fake_git_update_mirror(repository, env):
calls.append((repository, env))
return True
monkeypatch.setattr(cli, "git_pull", fake_git_pull)
monkeypatch.setattr(cli, "git_update_mirror", fake_git_update_mirror)
assert cli.process_repo(
config=make_config(tmp_path, FetchConfig(ssh_key="/tmp/test_key")),
@@ -116,10 +120,15 @@ def test_process_repo_returns_false_when_clone_fails(monkeypatch, tmp_path):
)
def test_process_repo_returns_false_when_pull_fails(monkeypatch, tmp_path):
repo_path = tmp_path / "alex" / "repo" / ".git"
repo_path.mkdir(parents=True)
monkeypatch.setattr(cli, "git_pull", lambda repository, env: False)
def test_process_repo_returns_false_when_update_fails(monkeypatch, tmp_path):
repo_path = tmp_path / "alex" / "repo"
(repo_path / "objects").mkdir(parents=True)
(repo_path / "config").write_text("[core]\nrepositoryformatversion = 0\n")
monkeypatch.setattr(
cli,
"git_update_mirror",
lambda repository, env: False,
)
assert not cli.process_repo(
config=make_config(tmp_path, FetchConfig(ssh_key="/tmp/test_key")),