[quality] test(system.just): BATS coverage for toggle-testing, toggle-vms, install-system-flatpaks - #1031
Open
kubestellar-hive[bot] wants to merge 1 commit into
Open
[quality] test(system.just): BATS coverage for toggle-testing, toggle-vms, install-system-flatpaks#1031kubestellar-hive[bot] wants to merge 1 commit into
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
…install-system-flatpaks
system_files/bluefin/usr/share/ublue-os/just/system.just is the largest
untested file in the repo — 388 lines, zero tests — and toggle-testing is
the recipe that computes the ref handed to `bootc switch`. A mistake in
its channel mapping moves a user's machine onto the wrong image, and
nothing in the repo would catch it.
tests/test_system_just.bats extracts each recipe body out of the justfile
into a standalone script and runs it against mocked jq/gum/pkexec/bootc/
flatpak/brew/just, so no host state is touched. 24 tests:
toggle-testing (14)
- stable/latest -> testing, lts -> lts-testing, lts-hwe -> lts-hwe-testing
- testing -> stable, lts-testing -> lts, lts-hwe-testing -> lts-hwe
(guards the ${IMAGE_TAG/-testing/} path that must not collapse to
"stable" for the LTS channels)
- unrecognised channel exits 1 and issues no switch
- transport-prefix stripping for ostree-image-signed:docker:// and
ostree-unverified-registry:, plus a bare registry ref
- declining either gum confirm switches nothing
- the switch is issued through pkexec
toggle-vms (6)
- installs when virt-manager is absent, removes when present
- removal covers the QEMU extension and strips only the session
uri_default line from libvirt.conf
- both declined prompts are no-ops
install-system-flatpaks (4)
- confirm=0 skips the prompt, confirm=1 requires it
- declining installs nothing
- TARGET_FLATPAK_FILE overrides the default Brewfile
Wired into `just test`. The extractor asserts a non-empty recipe body so a
rename fails loudly instead of silently testing nothing. Verified by
mutation: flipping the lts-hwe mapping fails the suite.
The unit-tests.yml step is deliberately not in this PR — see the PR body.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: kubestellar-hive[bot] <kubestellar-hive[bot]@users.noreply.github.com>
This was referenced Aug 28, 2026
hanthor
approved these changes
Sep 2, 2026
hanthor
left a comment
Member
There was a problem hiding this comment.
New tests/test_system_just.bats (24 cases) for toggle-testing, toggle-vms, install-system-flatpaks, including the lts/lts-hwe vs. stable collapse-prevention cases and libvirt.conf uri_default stripping. CI test green; validate fails only on title-lint.
Generated by Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cluster claimed
File under test:
system_files/bluefin/usr/share/ublue-os/just/system.justRecipes:
toggle-testing,toggle-vms,install-system-flatpaksFiles changed:
tests/test_system_just.bats(new),Justfile(one line)No other file is touched. In particular this PR does not modify
.github/workflows/unit-tests.yml— see Known follow-up below.Why
system.justis 388 lines and the largest file in the repo with zero testcoverage.
toggle-testingbuilds the image ref passed tobootc switch --enforce-container-sigpolicy; a wrong channel mapping moves auser's machine to the wrong image, and today nothing catches that.
What
tests/test_system_just.batsextracts each recipe body from the justfile into astandalone script and runs it against mocked
jq,gum,pkexec,bootc,flatpak,brewandjust. Nothing on the host is read or written. 24 tests:toggle-testingostree-image-signed:docker://,ostree-unverified-registry:, bare ref); both declined prompts are no-ops; switch goes throughpkexectoggle-vmsuri_defaultline stripped fromlibvirt.conf; declined prompts are no-opsinstall-system-flatpaksconfirm=0skips the prompt,confirm=1requires it; declining installs nothing;TARGET_FLATPAK_FILEoverride honouredThe
lts-testing → ltsandlts-hwe-testing → lts-hwecases specifically pinthe
${IMAGE_TAG/-testing/}branch, which must not collapse the LTS channelsdown to
stable.Verification
Mutation-checked: flipping the
lts-hwemapping totestingfails the suite,so the tests bite rather than merely execute.
Known follow-up — CI wiring
The new file is wired into
just test, but not into.github/workflows/unit-tests.yml: the hive App token lacks theworkflowspermission and GitHub rejects the push. A maintainer adding this one step makes
it run in CI:
Same blocker applies to #968 (9 test files already in
tests/and injust testthatunit-tests.ymlnever runs — all 95 of those tests wereconfirmed passing locally while investigating this).
Overlap check
Compared against every open PR in the snapshot. Nearest neighbours:
[sec-check]permissions block) and [sec-check] fix: declare top-level permissions: {} in e2e.yml pr-e2e.yml promotion-candidate-e2e.yml #969/[scanner] fix: use valid brew tap trust commands #978/feat: add richer Bluefin fastfetch colors #980/fix: add consistent bootc sudo policy #932 — nonetouch
system.just,tests/or theJustfile. [sec-check] fix: unit-tests.yml add permissions block (contents: read) #961 editsunit-tests.yml, which this PR deliberately leaves alone, so there is noconflict.
system.justrecipes.Disjoint.
Filed by the quality agent (hold-gated mode). Human review required — do not merge on my account.
— hive: agent=quality backend=copilot model=claude-opus-5