From 0cfacbd852e3c880f238f6f27b21f2542b2efcd9 Mon Sep 17 00:00:00 2001 From: Danathar Date: Sat, 14 Nov 2026 09:09:10 -0500 Subject: [PATCH 1/2] test: replace Search Light checks with Compass launcher Carries #1076 (castrojo's work, unchanged in substance) onto current main as one signed commit: #1076's commits lack Signed-off-by, and its branch conflicts with main in the generated suite map, which is regenerated here. - compass_launcher.feature (@smoke_suite @compass): the Compass flatpak is preinstalled; compass.service owns exactly one engine across stop, start and restart; Super+Space shows and hides the launcher. - common_dconf.feature: the Searchlight keybinding scenario becomes the Compass one (space runs org.tunaos.compass toggle). - Search Light scenarios, the unit-test fixture UUID and skill references go. Needs projectbluefin/common#1599 in the tested image; until then the Compass scenarios fail. Refs #1076 Assisted-by: Claude Opus 5.5 via Claude Code Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WcWm7qQa538Zjcuvv8jBtn Signed-off-by: Danathar --- docs/skills/test-authoring/behave/SKILL.md | 2 +- docs/skills/test-authoring/gnome/SKILL.md | 8 +- docs/skills/test-authoring/suite-map/SKILL.md | 4 +- tests/common/features/common_dconf.feature | 14 +- .../smoke/features/bluefin_extensions.feature | 7 - tests/smoke/features/compass_launcher.feature | 20 +++ tests/smoke/features/steps/steps.py | 165 ++++++++++++++++++ tests/unit/test_gnome_extensions_steps.py | 2 +- 8 files changed, 202 insertions(+), 20 deletions(-) create mode 100644 tests/smoke/features/compass_launcher.feature diff --git a/docs/skills/test-authoring/behave/SKILL.md b/docs/skills/test-authoring/behave/SKILL.md index 40fa0d311..92f56b2e1 100644 --- a/docs/skills/test-authoring/behave/SKILL.md +++ b/docs/skills/test-authoring/behave/SKILL.md @@ -383,7 +383,7 @@ For commands that produce multiline output (e.g. `flatpak install ... 2>&1; echo In the SSH-driven `common` suite, validate Bluefin desktop identity overrides with the API that matches the schema type: - Use `gsettings get` for regular schemas shipped via `zz0-bluefin-modifications.gschema.override` (for example `org.gnome.desktop.interface accent-color` or `org.gnome.desktop.app-folders folder-children`). -- Use `dconf read` for relocatable schemas and extensions without XML schemas (for example custom media-key keybindings under `/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/`, Search Light under `/org/gnome/shell/extensions/search-light/`, and Ptyxis profile palette keys under `/org/gnome/Ptyxis/Profiles//`). +- Use `dconf read` for relocatable schemas and extensions without XML schemas (for example custom media-key keybindings under `/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/` such as Compass at `.../custom-keybindings/compass/`, and Ptyxis profile palette keys under `/org/gnome/Ptyxis/Profiles//`). This keeps common-suite assertions aligned with how Bluefin actually ships those defaults in `projectbluefin/common`. diff --git a/docs/skills/test-authoring/gnome/SKILL.md b/docs/skills/test-authoring/gnome/SKILL.md index 41a3d1b93..7c499f40d 100644 --- a/docs/skills/test-authoring/gnome/SKILL.md +++ b/docs/skills/test-authoring/gnome/SKILL.md @@ -254,10 +254,10 @@ The smoke suite's UUID-specific extension checks use the same `_run_host(...)` helper so they work both inside the VM and from the Fedora runner container over SSH. -Bluefin's 9 bundled extensions each get a named scenario in -`tests/smoke/features/bluefin_extensions.feature`. Tag the -`search-light@icedman.github.com` scenario `@bluefin` and guard it with -`... is installed, otherwise skip on GNOME 51+` (missing on older shells fails). +Bluefin's bundled extensions each get a named scenario in +`tests/smoke/features/bluefin_extensions.feature`; guard ones newer GNOME stops +shipping with `@bluefin` and `... is installed, otherwise skip on GNOME 51+`. +Super+Space is Compass (`org.tunaos.compass` Flatpak): `compass_launcher.feature`. Use the distinct step phrase `GNOME extension "{uuid}" is enabled` (not bazzite's `Extension "{uuid}" is enabled`) to avoid cross-suite step collisions. diff --git a/docs/skills/test-authoring/suite-map/SKILL.md b/docs/skills/test-authoring/suite-map/SKILL.md index 75a600d0a..fc84320ed 100644 --- a/docs/skills/test-authoring/suite-map/SKILL.md +++ b/docs/skills/test-authoring/suite-map/SKILL.md @@ -163,7 +163,7 @@ Set `image` (e.g. `ghcr.io/projectbluefin/dakota:latest`), `suites: lifecycle`, -554 scenarios across 81 feature files: 433 active, 6 quarantined, 115 `@future`/`@pending`/`@hardware_blocked` +555 scenarios across 82 feature files: 434 active, 6 quarantined, 115 `@future`/`@pending`/`@hardware_blocked` | Suite | Scenarios | Active | Quarantined | Pending/Future | Notes | |---|---|---|---|---|---| @@ -180,7 +180,7 @@ Set `image` (e.g. `ghcr.io/projectbluefin/dakota:latest`), `suites: lifecycle`, | lifecycle | 24 | 22 | 0 | 2 | bootc upgrade / rollback / migration; switch is `@future` (needs a valid alternate image ref; pin activated with settled-deployment barrier) | | nvidia | 12 | 0 | 0 | 12 | `@future` / `@hardware_blocked` until GPU passthrough exists in the lab | | security | 7 | 7 | 0 | 0 | cosign verify: projectbluefin (bluefin, lts, dakota) + ublue-os (latest, LTS, DX, nvidia, GTS, DX-nvidia, negative) | -| smoke | 221 | 169 | 6 | 46 | 39 `@pending` flatpak-permission audits blocked on CI never seeding system Flatpaks; MIME handler coverage (Firefox/Papers/Loupe/Text Editor/video); GNOME accessibility (AT-SPI daemon, high-contrast toggle, a11y panel); display fractional/integer scaling via Mutter DisplayConfig; Bluefin desktop identity (Wayland, hardware accel, Dash to Dock); GNOME regression guards in gnome_regression.feature; Dakota sudo-rs privilege and PAM checks | +| smoke | 222 | 170 | 6 | 46 | 39 `@pending` flatpak-permission audits blocked on CI never seeding system Flatpaks; MIME handler coverage (Firefox/Papers/Loupe/Text Editor/video); GNOME accessibility (AT-SPI daemon, high-contrast toggle, a11y panel); display fractional/integer scaling via Mutter DisplayConfig; Bluefin desktop identity (Wayland, hardware accel, Dash to Dock); GNOME regression guards in gnome_regression.feature; Dakota sudo-rs privilege and PAM checks | | software | 35 | 27 | 0 | 8 | Bazaar GUI (`@bazaar_ui`: launch, view content per tab, typed search with a visible result, Ctrl+Q quit) + CLI presence/info/remote + config YAML parse (non-empty mappings; empty dir fails) active on images that carry Bazaar; CLI (Flathub remote + permissions DB) active on all images; Flatpak per-app permission management active on all images; FlatPark remote + Compass (`org.tunaos.compass`) system install/permission/export/uninstall lifecycle active (x86_64 only) and the shipped `compass@tunaos.org` default gated on the image enabling it (#1073); upstream GNOME Software scenarios are `@future` (#847) | | vanilla-gnome | 15 | 15 | 0 | 0 | Baseline GNOME Shell parity check; runs on any GNOME image; org.gnome.desktop.a11y.interface reduced-motion + keyboard-focus-visible-timeout gsettings round-trips (@requires_gnome_51, skip on GNOME <= 50 via runtime Shell version probe) | diff --git a/tests/common/features/common_dconf.feature b/tests/common/features/common_dconf.feature index df311f1d9..da9fb6277 100644 --- a/tests/common/features/common_dconf.feature +++ b/tests/common/features/common_dconf.feature @@ -84,12 +84,16 @@ Feature: Bluefin common dconf and GSettings defaults * SSH command return code is "0" * SSH command output stripped "is" "'xdg-terminal-exec'" - # Bluefin's pinned common still ships Searchlight; Utah's newer pin does not (#1076). - @skip_utah - Scenario: Searchlight extension is configured - * Run SSH command: "dconf read /org/gnome/shell/extensions/search-light/shortcut-search" + Scenario: Compass launcher keybinding is configured + * Run SSH command: "gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings" + * SSH command return code is "0" + * SSH command output contains "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/compass/" + * Run SSH command: "dconf read /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/compass/binding" + * SSH command return code is "0" + * SSH command output stripped "is" "'space'" + * Run SSH command: "dconf read /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/compass/command" * SSH command return code is "0" - * SSH command output stripped "is" "['space']" + * SSH command output contains "org.tunaos.compass toggle" # Pending: the Ptyxis palette is user-session dconf state, not image state. @pending diff --git a/tests/smoke/features/bluefin_extensions.feature b/tests/smoke/features/bluefin_extensions.feature index d0542ee24..532cb0343 100644 --- a/tests/smoke/features/bluefin_extensions.feature +++ b/tests/smoke/features/bluefin_extensions.feature @@ -45,10 +45,3 @@ Feature: Bluefin GNOME extension presence Scenario: Custom Command List extension is enabled * GNOME Shell is accessible via AT-SPI * GNOME extension "custom-command-list@storageb.github.com" is enabled - - @bluefin @extensions - Scenario: Search Light extension is enabled - # Broken on GNOME 51: GNOME 51 images do not ship it, so skip there only. - * GNOME extension "search-light@icedman.github.com" is installed, otherwise skip on GNOME 51+ - * GNOME Shell is accessible via AT-SPI - * GNOME extension "search-light@icedman.github.com" is enabled diff --git a/tests/smoke/features/compass_launcher.feature b/tests/smoke/features/compass_launcher.feature new file mode 100644 index 000000000..3bec2012d --- /dev/null +++ b/tests/smoke/features/compass_launcher.feature @@ -0,0 +1,20 @@ +@smoke_suite @compass +Feature: Compass launcher + Compass (org.tunaos.compass) is preinstalled from FlatPark and bound to + Super+Space through a GNOME custom keybinding. + + Scenario: Compass launcher Flatpak is preinstalled + * Compass Flatpak is installed system-wide within 600 seconds + + Scenario: Super+Space toggles the Compass launcher + * Compass Flatpak is installed system-wide within 600 seconds + * Compass user service is wanted by graphical-session.target + * Compass user service is stopped and its engine is gone within 30 seconds + * Compass user service is started with one serving engine within 60 seconds + * Compass user service is restarted with one serving engine within 60 seconds + * GNOME Shell is accessible via AT-SPI + * Key combo: "space" + * Compass diagnostics are logged + * Compass launcher window is visible within 60 seconds + * Key combo: "space" + * Compass launcher window is hidden within 30 seconds diff --git a/tests/smoke/features/steps/steps.py b/tests/smoke/features/steps/steps.py index e17842812..559b7de41 100644 --- a/tests/smoke/features/steps/steps.py +++ b/tests/smoke/features/steps/steps.py @@ -892,3 +892,168 @@ def flatpak_no_excessive_permissions(context, app_id: str) -> None: assert not re.search(r"filesystems=(host|home)", perms_out), ( f"{app_id} has excessive filesystem access:\n{perms_out}" ) + + +# ── Compass launcher (org.tunaos.compass Flatpak, Super+Space) ── + +_COMPASS_VISIBLE_JS = ( + "global.get_window_actors().some(a => { const w = a.meta_window; " + "const ids = [w.get_wm_class(), w.get_wm_class_instance(), " + "w.get_gtk_application_id(), w.get_sandboxed_app_id(), w.get_title()]" + ".join(' ').toLowerCase(); " + "return ids.includes('compass') && a.visible && !w.minimized " + "&& w.showing_on_its_workspace(); })" +) +_WINDOWS_JS = ( + "JSON.stringify(global.get_window_actors().map(a => { const w = a.meta_window; " + "return [w.get_wm_class(), w.get_gtk_application_id(), " + "w.get_sandboxed_app_id(), w.get_title(), a.visible, w.minimized]; }))" +) + + +@step("Compass Flatpak is installed system-wide within {timeout:d} seconds") +def compass_flatpak_installed_within(context, timeout: int) -> None: + # flatpak-preinstall downloads a ~71 MB extra-data AppImage at boot. + # The VM e2e lane masks flatpak-preinstall.service (no first-boot network + # pulls), so Compass can never appear there: skip instead of timing out. + state, _, _ = _run_host("systemctl is-enabled flatpak-preinstall.service") + if state == "masked": + context.scenario.skip("flatpak-preinstall.service is masked in this lane") + return + deadline = time.monotonic() + timeout + while True: + out, rc, err = _run_host("flatpak info --system org.tunaos.compass") + if rc == 0: + return + assert time.monotonic() < deadline, ( + f"org.tunaos.compass not installed after {timeout}s: {err or out}" + ) + sleep(10) + + +_SESSION = "source /tmp/session.env 2>/dev/null; " + + +@step("Compass user service is wanted by graphical-session.target") +def compass_service_wanted_by_session(context) -> None: + enabled, _, _ = _run_host(_SESSION + "systemctl --user is-enabled compass.service") + exec_start, _, _ = _run_host(_SESSION + "systemctl --user show -p ExecStart compass.service") + print(f"compass.service is-enabled={enabled!r} {exec_start}", flush=True) + wanted_by, rc, err = _run_host(_SESSION + "systemctl --user show -p WantedBy compass.service") + assert rc == 0 and "graphical-session.target" in wanted_by, ( + f"compass.service not wanted by graphical-session.target: {wanted_by!r} {err}" + ) + + +def _compass_engine_ps() -> tuple[list[str], str]: + """Return (engine lines, full compass ps listing). + + An engine is the sandboxed binary itself (argv[0] basename ``compass``, + e.g. /app/extra/compass/usr/bin/compass) running ``serve --no-hotkey``; + the bwrap and ``flatpak run`` wrappers carry other argv[0]s. + """ + out, _, _ = _run_host("ps -eo pid=,ppid=,user=,args=") + listing = [line for line in out.splitlines() if "compass" in line.lower()] + engines = [] + for line in listing: + argv = line.split()[3:] + if (argv and os.path.basename(argv[0]) == "compass" + and "serve" in argv and "--no-hotkey" in argv): + engines.append(line) + return engines, "\n".join(listing) + + +def _compass_ping_rc() -> tuple[int, str]: + out, rc, err = _run_host(_SESSION + "timeout 15 flatpak run org.tunaos.compass ping") + return rc, (err or out) + + +def _systemctl_user(verb: str) -> None: + _, rc, err = _run_host(_SESSION + f"systemctl --user {verb} compass.service", timeout=60) + assert rc == 0, f"systemctl --user {verb} compass.service failed: {err}" + + +@step("Compass user service is stopped and its engine is gone within {timeout:d} seconds") +def compass_service_stopped(context, timeout: int) -> None: + _systemctl_user("stop") + deadline = time.monotonic() + timeout + while True: + ping_rc, ping_out = _compass_ping_rc() + engines, listing = _compass_engine_ps() + if ping_rc != 0 and not engines: + return + if time.monotonic() >= deadline: + raise AssertionError( + f"Compass engine survived 'systemctl --user stop' for {timeout}s: " + f"ping rc={ping_rc} {ping_out}; engines={len(engines)}\n{listing}" + ) + sleep(2) + + +@step("Compass user service is {verb} with one serving engine within {timeout:d} seconds") +def compass_service_serves_one_engine(context, verb: str, timeout: int) -> None: + action = {"started": "start", "restarted": "restart"}[verb] + _systemctl_user(action) + deadline = time.monotonic() + timeout + while True: + active, _, _ = _run_host(_SESSION + "systemctl --user is-active compass.service") + ping_rc, ping_out = _compass_ping_rc() + engines, listing = _compass_engine_ps() + if active == "active" and ping_rc == 0 and len(engines) == 1: + break + if time.monotonic() >= deadline: + status, _, _ = _run_host( + _SESSION + "systemctl --user status --no-pager -l compass.service 2>&1" + ) + raise AssertionError( + f"compass.service not serving one engine {timeout}s after {action}: " + f"is-active={active!r} ping rc={ping_rc} {ping_out}; " + f"engines={len(engines)}\n{listing}\n{status}" + ) + sleep(2) + if action == "restart": + restarts, _, _ = _run_host(_SESSION + "systemctl --user show -p NRestarts compass.service") + assert restarts == "NRestarts=0", ( + f"compass.service crash-looped after restart: {restarts!r}\n{listing}" + ) + + +_COMPASS_DIAG_CMDS = ( + "ps -eo pid,ppid,user,args | grep -i [c]ompass", + "systemctl --user status compass.service --no-pager -l 2>&1 | tail -30", + "journalctl --user -b --no-pager 2>&1 | grep -i -E 'compass|media-keys|custom' | tail -80", + "systemctl --user show-environment | grep -E 'WAYLAND|DISPLAY|XDG_SESSION|DBUS'", + "timeout 20 flatpak run org.tunaos.compass doctor 2>&1 | tail -60", + "timeout 10 flatpak run org.tunaos.compass logs 2>&1 | tail -80", +) + + +def _compass_diagnostics(include_toggle: bool) -> str: + cmds = list(_COMPASS_DIAG_CMDS) + if include_toggle: + # Mutates launcher state, so only run once the assertion has failed. + cmds.append("timeout 15 flatpak run org.tunaos.compass toggle 2>&1; echo rc=$?") + parts = [] + for cmd in cmds: + out, rc, err = _run_host(_SESSION + cmd, timeout=40) + parts.append(f"$ {cmd} [rc={rc}]\n{out}\n{err}".rstrip()) + report = "\n".join(parts) + print(f"── Compass diagnostics ──\n{report}", flush=True) + return report + + +@step("Compass diagnostics are logged") +def compass_diagnostics_are_logged(context) -> None: + _compass_diagnostics(include_toggle=False) + + +@step("Compass launcher window is {state} within {timeout:d} seconds") +def compass_window_state_within(context, state: str, timeout: int) -> None: + assert state in ("visible", "hidden"), f"unknown state {state!r}" + if _wait_eval_bool(_COMPASS_VISIBLE_JS, state == "visible", retries=timeout, delay=1): + return + windows = _shell_eval(_WINDOWS_JS) + raise AssertionError( + f"Compass window not {state} after {timeout}s; windows: {windows}\n" + + _compass_diagnostics(include_toggle=True) + ) diff --git a/tests/unit/test_gnome_extensions_steps.py b/tests/unit/test_gnome_extensions_steps.py index fc6ba6365..351042a8f 100644 --- a/tests/unit/test_gnome_extensions_steps.py +++ b/tests/unit/test_gnome_extensions_steps.py @@ -220,7 +220,7 @@ def fake_run_host(cmd): class TestExtensionInstalledOrSkip: - UUID = "search-light@icedman.github.com" + UUID = "gsconnect@andyholmes.github.io" def _run(self, installed: bool, major): m = _import_gnome_extensions_steps() From 92ea58d3bde481b8549b1203f3fc774f87ed89d0 Mon Sep 17 00:00:00 2001 From: Danathar Date: Sat, 14 Nov 2026 09:12:57 -0500 Subject: [PATCH 2/2] test: run the Compass scenarios wherever the image ships Compass, skip elsewhere common#1599 reaches images at different times: utah takes common's image digest, while dakota pins common as a BuildStream junction and needs its own bump. Without a gate, the Compass scenarios would fail on every image built before its pin moves. - Smoke: the install step skips when /usr/share/flatpak/preinstall.d/ compass.preinstall is absent. Where it ships, Compass must install, and the rest of each scenario runs. - Common: a shared step `Skip unless the image ships ""` gates the keybinding scenario on the same file. - @skip_utah is removed: it gated only the Searchlight scenario this change replaces. Its hook, unit tests and docs go with it. Refs #1076 Assisted-by: Claude Opus 5.5 via Claude Code Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WcWm7qQa538Zjcuvv8jBtn Signed-off-by: Danathar --- ...-skipping-bluefin-on-non-bluefin-images.md | 7 ++-- docs/skills/test-authoring/suite-map/SKILL.md | 1 - tests/common/features/common_dconf.feature | 2 + tests/common/features/environment.py | 4 -- tests/shared/ssh_steps.py | 13 ++++++ tests/smoke/features/steps/steps.py | 9 ++++ tests/unit/test_common_steps.py | 20 --------- tests/unit/test_smoke_steps.py | 30 ++++++++++++++ tests/unit/test_ssh_skip_unless_ships.py | 41 +++++++++++++++++++ 9 files changed, 98 insertions(+), 29 deletions(-) create mode 100644 tests/unit/test_ssh_skip_unless_ships.py diff --git a/docs/skills/ci-ops/ops/references/cross-image-tag-skipping-bluefin-on-non-bluefin-images.md b/docs/skills/ci-ops/ops/references/cross-image-tag-skipping-bluefin-on-non-bluefin-images.md index 2474541fc..89422cba3 100644 --- a/docs/skills/ci-ops/ops/references/cross-image-tag-skipping-bluefin-on-non-bluefin-images.md +++ b/docs/skills/ci-ops/ops/references/cross-image-tag-skipping-bluefin-on-non-bluefin-images.md @@ -22,10 +22,9 @@ URL-wide check would select Bluefin scenarios on Dakota. Bluefin-family names are `bluefin`, `bazzite`, `utah`, and `common`. Common's PR e2e image is named `common`, but it overlays common's `shared` and `bluefin` trees onto its base image. Utah is Bluefin built on Fedora Hummingbird. Dakota -remains separate and selects `@dakota_only` scenarios. In the common suite, -`@skip_utah` excludes a `@bluefin` scenario on Utah only: it marks content that -Bluefin's common pin still ships but Utah's newer pin does not (the Searchlight -dconf scenario, until #1076 replaces it). +remains separate and selects `@dakota_only` scenarios. Content that reaches +images at different times (one image's common pin lagging another's) is gated on +the content itself, not the image name: `Skip unless the image ships ""`. The smoke suite runs inside the GUI runner container, so it only sees `BASE_IMAGE` if `e2e.yml` passes it into that container (`-e BASE_IMAGE` and diff --git a/docs/skills/test-authoring/suite-map/SKILL.md b/docs/skills/test-authoring/suite-map/SKILL.md index fc84320ed..dddd69b90 100644 --- a/docs/skills/test-authoring/suite-map/SKILL.md +++ b/docs/skills/test-authoring/suite-map/SKILL.md @@ -140,7 +140,6 @@ Set `image` (e.g. `ghcr.io/projectbluefin/dakota:latest`), `suites: lifecycle`, | `@smoke_suite` | Runs as part of the standard smoke suite | | `@bluefin` | Scenario runs on Bluefin-family image names (`bluefin`, `bazzite`, `utah`, `common`); smoke and common read `BASE_IMAGE` before `IMAGE`, so composed runs keep their family | | `@dakota_only` | Scenario runs only when the image name contains `dakota`; smoke and common read `BASE_IMAGE` before `IMAGE`. Only the image **name** is matched, so the `projectbluefin` org name cannot false-positive | -| `@skip_utah` | Common scenario skips when the image name contains `utah`: it asserts content Bluefin's common pin still ships but Utah's newer pin does not. Remove it when the scenario is replaced (#1076) | | `@dx_only` / `@developer_suite` | DX variant only | | `@nvidia_only` | NVIDIA variant only | | `@flatcar_suite` | Flatcar OS only | diff --git a/tests/common/features/common_dconf.feature b/tests/common/features/common_dconf.feature index da9fb6277..83e4bf0c1 100644 --- a/tests/common/features/common_dconf.feature +++ b/tests/common/features/common_dconf.feature @@ -84,7 +84,9 @@ Feature: Bluefin common dconf and GSettings defaults * SSH command return code is "0" * SSH command output stripped "is" "'xdg-terminal-exec'" + # Images get Compass when their common pin reaches projectbluefin/common#1599. Scenario: Compass launcher keybinding is configured + * Skip unless the image ships "/usr/share/flatpak/preinstall.d/compass.preinstall" * Run SSH command: "gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings" * SSH command return code is "0" * SSH command output contains "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/compass/" diff --git a/tests/common/features/environment.py b/tests/common/features/environment.py index 5387c39af..30b244f13 100644 --- a/tests/common/features/environment.py +++ b/tests/common/features/environment.py @@ -213,10 +213,6 @@ def before_scenario(context, scenario): f"(IMAGE={os.environ.get('IMAGE', 'unknown')})" ) return - # Temporary: drop @skip_utah once #1076 replaces the scenarios it gates. - if "skip_utah" in scenario_tags and getattr(context, "is_utah_image", False): - scenario.skip("Skipping @skip_utah scenario: Utah's common pin no longer ships it") - return if "requires_brew" in scenario_tags and not _has_brew(context): scenario.skip("Homebrew not present on this image") return diff --git a/tests/shared/ssh_steps.py b/tests/shared/ssh_steps.py index edb74f6a1..ec329fa78 100644 --- a/tests/shared/ssh_steps.py +++ b/tests/shared/ssh_steps.py @@ -93,6 +93,19 @@ def run_ssh_command(context, cmd): run_ssh(context, cmd) +@step('Skip unless the image ships "{path}"') +def skip_unless_image_ships(context, path): + """Skip the scenario on images that predate the feature under test. + + For content that reaches images at different times (one image's pin may + lag another's): the scenario runs, and must pass, wherever the marker file + exists. + """ + run_ssh(context, f"test -e {shlex.quote(path)}") + if context.ssh_rc != 0: + context.scenario.skip(f"image does not ship {path}") + + @step('Run long SSH command: "{cmd}"') def run_long_ssh_command(context, cmd): """Run a command that may take many minutes (bootc switch/upgrade pulling OCI layers).""" diff --git a/tests/smoke/features/steps/steps.py b/tests/smoke/features/steps/steps.py index 559b7de41..ae786536a 100644 --- a/tests/smoke/features/steps/steps.py +++ b/tests/smoke/features/steps/steps.py @@ -911,11 +911,20 @@ def flatpak_no_excessive_permissions(context, app_id: str) -> None: ) +COMPASS_PREINSTALL = "/usr/share/flatpak/preinstall.d/compass.preinstall" + + @step("Compass Flatpak is installed system-wide within {timeout:d} seconds") def compass_flatpak_installed_within(context, timeout: int) -> None: # flatpak-preinstall downloads a ~71 MB extra-data AppImage at boot. # The VM e2e lane masks flatpak-preinstall.service (no first-boot network # pulls), so Compass can never appear there: skip instead of timing out. + # Images get Compass when their common pin reaches projectbluefin/common#1599; + # where the preinstall file ships, Compass must install. + _, shipped, _ = _run_host("test -f " + COMPASS_PREINSTALL) + if shipped != 0: + context.scenario.skip(f"image does not ship {COMPASS_PREINSTALL}") + return state, _, _ = _run_host("systemctl is-enabled flatpak-preinstall.service") if state == "masked": context.scenario.skip("flatpak-preinstall.service is masked in this lane") diff --git a/tests/unit/test_common_steps.py b/tests/unit/test_common_steps.py index 659af7cf0..21f0c0278 100644 --- a/tests/unit/test_common_steps.py +++ b/tests/unit/test_common_steps.py @@ -249,26 +249,6 @@ def test_allows_dakota_only_on_dakota_image(self): assert scenario.skip_message is None -class TestCommonEnvironmentSkipUtah: - def test_skips_skip_utah_on_utah_image(self): - m = _import_common_environment() - context = _ctx(is_bluefin_image=True, is_utah_image=True, has_brew=True) - scenario = _Scenario(["bluefin", "skip_utah"]) - - m.before_scenario(context, scenario) - - assert "Skipping @skip_utah scenario" in scenario.skip_message - - def test_allows_skip_utah_on_bluefin_image(self): - m = _import_common_environment() - context = _ctx(is_bluefin_image=True, is_utah_image=False, has_brew=True) - scenario = _Scenario(["bluefin", "skip_utah"]) - - m.before_scenario(context, scenario) - - assert scenario.skip_message is None - - class TestCommonEnvironmentRequiresToggleAction: def test_skips_when_recipe_lacks_action_value(self): m = _import_common_environment(run_ssh_returncode=1) diff --git a/tests/unit/test_smoke_steps.py b/tests/unit/test_smoke_steps.py index 01a779a6b..7e15d8681 100644 --- a/tests/unit/test_smoke_steps.py +++ b/tests/unit/test_smoke_steps.py @@ -316,3 +316,33 @@ def test_returns_stripped_stdout(self): stdout, rc, _ = m._run_host("echo hi") assert stdout == "hello world" assert rc == 0 + + +# --------------------------------------------------------------------------- +# Compass install step: gated on the image shipping Compass (common#1599) +# --------------------------------------------------------------------------- + +class TestCompassInstallGate: + def _run(self, responses): + m = _import_steps() + calls = [] + + def fake(cmd, timeout=30): + calls.append(cmd) + return responses.pop(0) + + context = MagicMock() + with patch.object(m, "_run_host", side_effect=fake), patch.object(m, "sleep"): + m.compass_flatpak_installed_within(context, 600) + return context, calls + + def test_image_without_compass_skips(self): + context, calls = self._run([("", 1, "")]) + context.scenario.skip.assert_called_once() + assert "compass.preinstall" in context.scenario.skip.call_args.args[0] + assert len(calls) == 1 + + def test_image_with_compass_must_install_it(self): + context, calls = self._run([("", 0, ""), ("enabled", 0, ""), ("org.tunaos.compass", 0, "")]) + context.scenario.skip.assert_not_called() + assert calls[-1] == "flatpak info --system org.tunaos.compass" diff --git a/tests/unit/test_ssh_skip_unless_ships.py b/tests/unit/test_ssh_skip_unless_ships.py new file mode 100644 index 000000000..1c84a84e9 --- /dev/null +++ b/tests/unit/test_ssh_skip_unless_ships.py @@ -0,0 +1,41 @@ +"""`Skip unless the image ships ""` gates content that reaches images at different times.""" +import importlib +import sys +import types +from unittest.mock import MagicMock + + +def _import_ssh_steps(): + behave_stub = types.ModuleType("behave") + behave_stub.step = lambda *a, **kw: (lambda f: f) + sys.modules["behave"] = behave_stub + sys.modules.pop("tests.shared.ssh_steps", None) + return importlib.import_module("tests.shared.ssh_steps") + + +def _context_after(rc): + m = _import_ssh_steps() + context = MagicMock() + commands = [] + + def fake_run_ssh(ctx, cmd, timeout=60): + commands.append(cmd) + ctx.ssh_rc = rc + return "", rc + + m.run_ssh = fake_run_ssh + m.skip_unless_image_ships(context, "/usr/share/flatpak/preinstall.d/compass.preinstall") + return context, commands + + +def test_missing_file_skips_with_the_path(): + context, commands = _context_after(1) + assert commands == ["test -e /usr/share/flatpak/preinstall.d/compass.preinstall"] + context.scenario.skip.assert_called_once_with( + "image does not ship /usr/share/flatpak/preinstall.d/compass.preinstall" + ) + + +def test_present_file_runs_the_scenario(): + context, _ = _context_after(0) + context.scenario.skip.assert_not_called()