mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-13 02:30:11 +01:00
test(deploy): fix errors
This commit is contained in:
parent
44530a7272
commit
a1c225c50d
@ -703,7 +703,8 @@ def update_servergitmirrors(servergitmirrors, repo_section):
|
||||
repo_section=repo_section,
|
||||
fdroid_dir=git_fdroiddir,
|
||||
git_mirror_path=git_mirror_path,
|
||||
ssh_cmd=ssh_cmd)
|
||||
ssh_cmd=ssh_cmd,
|
||||
progress=progress)
|
||||
|
||||
# Switch to the initial branch and unstage all files
|
||||
repo.head.reference = initial_ref
|
||||
@ -718,7 +719,8 @@ def upload_to_servergitmirror(mirror_config: Dict[str, str],
|
||||
repo_section: str,
|
||||
fdroid_dir: str,
|
||||
git_mirror_path: str,
|
||||
ssh_cmd: str):
|
||||
ssh_cmd: str,
|
||||
progress: git.RemoteProgress) -> None:
|
||||
# Test
|
||||
print(f"mirror_config: {mirror_config}")
|
||||
print("files:")
|
||||
@ -735,9 +737,6 @@ def upload_to_servergitmirror(mirror_config: Dict[str, str],
|
||||
local_repo.create_head(branch_name)
|
||||
local_repo.head.reference = local_repo.heads[branch_name]
|
||||
|
||||
# test
|
||||
print(local_repo.git.status())
|
||||
|
||||
remote_url = mirror_config['url']
|
||||
name = REMOTE_HOSTNAME_REGEX.sub(r'\1', remote_url)
|
||||
enabled_remotes.append(name)
|
||||
|
@ -1017,15 +1017,18 @@ class DeployTest(unittest.TestCase):
|
||||
fdroidserver.deploy.config = config
|
||||
|
||||
repo_section = 'repo'
|
||||
initial_branch = 'main'
|
||||
initial_branch = fdroidserver.deploy.GIT_BRANCH
|
||||
|
||||
os.chdir(self.testdir)
|
||||
|
||||
local_git_repo_path = Path(self.testdir)
|
||||
local_git_repo = git.Repo.init(
|
||||
local_git_repo_path, initial_branch=initial_branch
|
||||
local_repo_path = Path(self.testdir) / 'local'
|
||||
local_repo = git.Repo.init(
|
||||
local_repo_path, initial_branch=initial_branch
|
||||
)
|
||||
fdroid_dir = local_git_repo_path / 'fdroid'
|
||||
# An initial commit of the git tree is required be for other operations
|
||||
local_repo.index.commit('Initial commit')
|
||||
|
||||
fdroid_dir = local_repo_path / 'fdroid'
|
||||
repo_dir = fdroid_dir / repo_section
|
||||
repo_dir.mkdir(parents=True)
|
||||
for filename in fdroidserver.deploy.INDEX_FILES:
|
||||
@ -1033,20 +1036,22 @@ class DeployTest(unittest.TestCase):
|
||||
with fake_file.open('w') as fp:
|
||||
fp.write('not a real one, but has the right filename')
|
||||
|
||||
remote_git_repo_path = Path('git-mirror')
|
||||
remote_repo = git.Repo.init(remote_git_repo_path, initial_branch=initial_branch)
|
||||
# The remote repo must be a bare repo to allow being pushed to
|
||||
remote_repo_path = Path(self.testdir) / 'remote'
|
||||
remote_repo = git.Repo.init(remote_repo_path, initial_branch=initial_branch, bare=True)
|
||||
|
||||
mirror_config = {"url": remote_git_repo_path, "index_only": True}
|
||||
mirror_config = {"url": str(remote_repo_path), "index_only": True}
|
||||
enabled_remotes = []
|
||||
ssh_cmd = 'ssh -oBatchMode=yes'
|
||||
fdroidserver.deploy.upload_to_servergitmirror(
|
||||
mirror_config=mirror_config,
|
||||
local_repo=local_git_repo,
|
||||
local_repo=local_repo,
|
||||
enabled_remotes=enabled_remotes,
|
||||
repo_section=repo_section,
|
||||
fdroid_dir=str(fdroid_dir),
|
||||
git_mirror_path=str(local_git_repo_path),
|
||||
git_mirror_path=str(local_repo_path),
|
||||
ssh_cmd=ssh_cmd,
|
||||
progress=git.RemoteProgress()
|
||||
)
|
||||
assert remote_repo.is_dirty
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user