Просмотр исходного кода

test(launcher): skip repo-root launcher checks when files aren't shipped

test_launcher_shutdown_config.py and test_systemd_backup_paths.py read
repo-root launcher/config files (Dockerfile, docker-compose.yml,
deploy/bambuddy.service, install/install.sh, installers/windows/...,
spoolbuddy/install/install.sh). The Docker test image built from
Dockerfile.test copies only backend/, pyproject.toml, gcode_viewer/ and
requirements, so all 15 tests failed in test_docker.sh with "launcher
moved or was removed" — the files simply aren't in the image.

Guard both modules with skipif on frontend/package.json, which is present
in every source checkout but never in the test image. Native runs
(test_backend.sh, every commit) still execute the tests in full and catch
a genuinely moved/deleted launcher; the release-gate Docker run skips them
instead of failing on files it deliberately doesn't ship.
maziggy 1 месяц назад
Родитель
Сommit
29e78e85d5

+ 13 - 0
backend/tests/unit/test_launcher_shutdown_config.py

@@ -34,6 +34,19 @@ REPO = Path(__file__).resolve().parents[3]
 
 FLAG = "--timeout-graceful-shutdown"
 
+# These pin repo-root launcher files (Dockerfile, compose, service units,
+# install scripts) that the Docker test image deliberately does not ship —
+# Dockerfile.test copies only backend/, pyproject.toml, gcode_viewer/ and
+# requirements. In a source checkout the files are always present and the
+# guard below is live (a moved/deleted launcher still fails loudly on every
+# `test_backend.sh` run); inside the stripped test image there is nothing to
+# check, so skip rather than fail. `frontend/package.json` is present in every
+# checkout but never in the test image, so it distinguishes the two.
+pytestmark = pytest.mark.skipif(
+    not (REPO / "frontend" / "package.json").is_file(),
+    reason="launcher config files aren't shipped in the Docker test image; verified in native runs",
+)
+
 
 def _read(rel: str) -> str:
     path = REPO / rel

+ 11 - 0
backend/tests/unit/test_systemd_backup_paths.py

@@ -20,6 +20,17 @@ REPO = Path(__file__).resolve().parents[3]
 
 INSTALLERS = ["install/install.sh", "spoolbuddy/install/install.sh"]
 
+# The service unit + install scripts these tests read live at the repo root and
+# are not copied into the Docker test image (Dockerfile.test ships only backend/,
+# pyproject.toml, gcode_viewer/ and requirements). In a source checkout they are
+# always present and the guard below is live; in the stripped test image there is
+# nothing to check, so skip rather than fail. `frontend/package.json` exists in
+# every checkout but never in the test image, so it distinguishes the two.
+pytestmark = pytest.mark.skipif(
+    not (REPO / "frontend" / "package.json").is_file(),
+    reason="launcher config files aren't shipped in the Docker test image; verified in native runs",
+)
+
 
 def _read(rel: str) -> str:
     path = REPO / rel