Merge branch 'dont-hang-on-test_mirroring_a_repo-fail' into 'master'

ensure httpd is shut down when test_mirroring_a_repo fails

See merge request fdroid/fdroidserver!1830
This commit is contained in:
Michael Pöhn
2026-05-22 23:02:09 +00:00
2 changed files with 26 additions and 23 deletions

View File

@@ -229,7 +229,7 @@ ubuntu_jammy_pip:
image: ubuntu:jammy
<<: *apt-template
script:
- apt-get install git default-jdk-headless python3-pip python3-venv rsync
- apt-get install git default-jdk-headless python3-pip python3-venv rsync wget
# setup venv to act as release build machine
- python3 -m venv sdist-env

View File

@@ -1441,28 +1441,31 @@ class IntegrationTest(unittest.TestCase):
httpd = ThreadingHTTPServer(("127.0.0.1", 0), RequestHandler)
threading.Thread(target=httpd.serve_forever).start()
os.chdir(self.tmp_repo_root)
host, port = httpd.socket.getsockname()
url, output_dir = f"http://{host}:{port}/", Path(f"{host}:{port}")
self.assert_run(self.fdroid_cmd + ["mirror", url])
self.assertTrue((output_dir / "repo/souch.smsbypass_9.apk").is_file())
self.assertTrue((output_dir / "repo/icons-640/souch.smsbypass.9.png").is_file())
# the index shouldn't be saved unless it was verified
self.assertFalse((output_dir / "repo/index-v1.jar").exists())
self.assert_run_fail(
self.fdroid_cmd + ["mirror", f"{url}?fingerprint=asdfasdf"]
)
self.assertFalse((output_dir / "repo/index-v1.jar").exists())
self.assert_run(
self.fdroid_cmd
+ [
"mirror",
f"{url}?fingerprint=F49AF3F11EFDDF20DFFD70F5E3117B9976674167ADCA280E6B1932A0601B26F6",
],
)
self.assertTrue((output_dir / "repo/index-v1.jar").is_file())
httpd.shutdown()
try:
os.chdir(self.tmp_repo_root)
host, port = httpd.socket.getsockname()
url, output_dir = f"http://{host}:{port}/", Path(f"{host}:{port}")
self.assert_run(self.fdroid_cmd + ["mirror", url])
self.assertTrue((output_dir / "repo/souch.smsbypass_9.apk").is_file())
self.assertTrue(
(output_dir / "repo/icons-640/souch.smsbypass.9.png").is_file()
)
# the index shouldn't be saved unless it was verified
self.assertFalse((output_dir / "repo/index-v1.jar").exists())
self.assert_run_fail(
self.fdroid_cmd + ["mirror", f"{url}?fingerprint=asdfasdf"]
)
self.assertFalse((output_dir / "repo/index-v1.jar").exists())
self.assert_run(
self.fdroid_cmd
+ [
"mirror",
f"{url}?fingerprint=F49AF3F11EFDDF20DFFD70F5E3117B9976674167ADCA280E6B1932A0601B26F6",
],
)
self.assertTrue((output_dir / "repo/index-v1.jar").is_file())
finally:
httpd.shutdown()
def test_recovering_from_broken_git_submodules(self):
Path("foo").mkdir()