Skip to content

test(dynamic-wallpaper): BATS coverage for the 20-dynamic-wallpaper.sh user-setup hook - #1138

Open
kubestellar-hive[bot] wants to merge 2 commits into
mainfrom
quality/test-dynamic-wallpaper-hook
Open

kubestellar-hive[bot] wants to merge 2 commits into
mainfrom
quality/test-dynamic-wallpaper-hook

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Claimed ground: tests/test_dynamic_wallpaper_hook.bats (new) and the test recipe in Justfile. The file under test is system_files/bluefin/usr/share/ublue-os/user-setup.hooks.d/20-dynamic-wallpaper.sh — the only file under any *.hooks.d/ directory with no test suite. No production code is changed.

Eight bats cases, following the tests/test_theming_hook.bats pattern (sed-patch the absolute source and /usr/libexec paths into a temp dir, mock systemctl, point SETUP_CHECKER_FILE at the temp dir):

  • first run enables the timer and invokes the wallpaper helper exactly once
  • the enabled unit is the one this repo ships (bluefin-dynamic-wallpaper.timer)
  • the enable is --user scope, never --system
  • version 1 is recorded under .version.user."dynamic-wallpaper"
  • the version gate makes a second run a no-op
  • a failing wallpaper helper does not fail the hook (the deliberate || true)
  • a failing systemctl aborts before the wallpaper is set (set -e)
  • characterization: a failed run still burns the version and never retries

The last case documents a real defect rather than endorsing it: version-script stamps the version before the hook body runs, so a first boot that dies at systemctl enable permanently skips the setup step. Filed separately as #1137 — fixing it means changing production code, which is out of scope here, and the fix must update that one test.

Local run: bats tests/test_dynamic_wallpaper_hook.bats — 8/8 pass.

CI registration

Registered in the Justfile test recipe. The matching step in .github/workflows/unit-tests.yml is not in this PR: this agent runs at a token tier without the Workflows permission, so any diff touching .github/workflows/** is rejected server-side. The workflow already omits several suites that just test runs, which is tracked by #968; this suite joins that set until a human or a workflow-capable agent adds the step:

      - name: Run bats (dynamic wallpaper hook)
        run: bats tests/test_dynamic_wallpaper_hook.bats

Related Issue

Closes #1136


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.78

…h user-setup hook

system_files/bluefin/usr/share/ublue-os/user-setup.hooks.d/20-dynamic-wallpaper.sh
was the only file under */*.hooks.d/ without a test suite. Add
tests/test_dynamic_wallpaper_hook.bats, following the tests/test_theming_hook.bats
pattern, covering the once-only version-script gate, the --user scope and exact
unit name of the timer enable, the deliberately tolerated helper failure, and
the set -e abort when systemctl fails.

The last case is a characterization test: version-script stamps the version
before the hook body runs, so a run that dies at systemctl enable burns
version 1 and never retries. Asserted as-is so the behaviour is visible.

Register the suite in the Justfile test recipe.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
@kubestellar-hive kubestellar-hive Bot added the hold Work is intentionally paused. label Sep 17, 2026
@kubestellar-hive

Copy link
Copy Markdown
Contributor Author

Important

Held for human review by the hive's ACMM level gate.

This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the outreach agent is always held because it publishes project-facing communication.

Hive will automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

@kubestellar-hive

Copy link
Copy Markdown
Contributor Author

Compose PR test image failed on a transient registry error, not on this PR's diff.

This branch adds tests/test_dynamic_wallpaper_hook.bats and a Justfile recipe
entry only. The failing run built the image and then died while pushing a layer:

Error: writing blob: uploading layer chunked: StatusCode: 400, "\r\n<html>\r\n  <head>\r\n    <meta content=\"origin\" nam..."
##[error]podman exited with code 125

An HTML error body from the registry on a chunked blob upload is a registry-side
failure; nothing in a BATS test file can produce or prevent it. The branch is
already even with main (0 commits behind), so there was nothing to rebase.

I have re-triggered PR E2E so the compose runs again against the same commit.

Run: https://github.com/projectbluefin/common/actions/runs/35275848606/job/105386185655

— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Work is intentionally paused.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] coverage-gap: user-setup hook 20-dynamic-wallpaper.sh is the only *.hooks.d hook with no test suite

0 participants