From 29e78e85d5d923816f854b4b3fab9e5da613c4bb Mon Sep 17 00:00:00 2001 From: maziggy Date: Fri, 24 Jul 2026 11:17:19 +0200 Subject: [PATCH] test(launcher): skip repo-root launcher checks when files aren't shipped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- backend/tests/unit/test_launcher_shutdown_config.py | 13 +++++++++++++ backend/tests/unit/test_systemd_backup_paths.py | 11 +++++++++++ 2 files changed, 24 insertions(+) diff --git a/backend/tests/unit/test_launcher_shutdown_config.py b/backend/tests/unit/test_launcher_shutdown_config.py index 9ec479b24..54363f067 100644 --- a/backend/tests/unit/test_launcher_shutdown_config.py +++ b/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 diff --git a/backend/tests/unit/test_systemd_backup_paths.py b/backend/tests/unit/test_systemd_backup_paths.py index 4c2a8ddb8..40cf64c31 100644 --- a/backend/tests/unit/test_systemd_backup_paths.py +++ b/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