[quality] test(default.just): BATS coverage for bios, bios-info, enroll-secure-boot-key, toggle-user-motd, check-local-overrides, check-idle-power-draw, benchmark - #1048
Open
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
…heck-local-overrides
system_files/shared/usr/share/ublue-os/just/default.just had exactly one
recipe under test (clean-system, via tests/test_clean_system_podman_path.bats).
The remaining recipes — including a firmware reboot and a Secure Boot MOK
enrollment — had none.
Adds tests/test_default_just.bats with 23 tests covering:
- bios EFI guard, gum-confirmed `systemctl reboot
--firmware-setup`, and the declined path
- bios-info all four dmidecode fields read under sudo
- enroll-secure-boot-key `mokutil --timeout -1` ordering, akmods-ublue.der
import, enrollment password guidance
- toggle-user-motd shim delegates to `uwelcome toggle`
- check-local-overrides /usr/etc vs /etc divergence and only-in-/etc
reporting, quiet when trees match, NO_COLOR=1
palette suppression, identity/credential excludes
- check-idle-power-draw powerstat availability guard and `-a -r` invocation
- benchmark stress-ng present path, brew install-on-accept,
exit-on-decline
Each shebang recipe body is extracted verbatim and executed against stubbed
binaries, with /sys/firmware/efi and the /usr/etc /etc diff operands redirected
into a sandbox, so real control flow is exercised rather than grepped.
One test documents a live gap rather than asserting desired behaviour:
check-local-overrides hardcodes `diff --color="always"`, so NO_COLOR=1
suppresses only the recipe's own palette and diff still emits ANSI escapes.
Pinning it makes a future fix visible.
Scope is deliberately disjoint from open work: device-info is left to
PR #1003, shared.just to PR #1034, and system.just to PR #1031. The Justfile
line is inserted next to the existing default.just test rather than appended,
to avoid colliding with PR #1031's append.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <sec-check[bot]@users.noreply.github.com>
hanthor
approved these changes
Sep 2, 2026
hanthor
left a comment
Member
There was a problem hiding this comment.
Thorough tests/test_default_just.bats (23 cases) for previously-untested bios, bios-info, enroll-secure-boot-key, check-local-overrides, check-idle-power-draw, benchmark — verified against the actual default.just content, assertions match real recipe behavior including documenting a NO_COLOR gap rather than hiding it. 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.
Test Improvement
Adds
tests/test_default_just.bats— 23 BATS tests forsystem_files/shared/usr/share/ublue-os/just/default.just.Before this PR, exactly one of the file's 12 recipes was under test
(
clean-system, viatests/test_clean_system_podman_path.bats). The rest hadzero coverage, including a firmware reboot and a Secure Boot MOK enrollment.
Recipes claimed by this PR
biossystemctl reboot --firmware-setup; declined confirmation does not rebootbios-infodmidecode -sfields read undersudo bash; every field is labelledenroll-secure-boot-keymokutil --timeout -1precedes the import;akmods-ublue.deris the imported cert; enrollment password guidance is printedtoggle-user-motduwelcome togglecheck-local-overrides/etcreporting; content divergence reporting; silence when trees match;NO_COLOR=1palette suppression; palette applied when unset; identity/credential--excludesetcheck-idle-power-drawpowerstatguard exits 1 without invoking it; present path runspowerstat -a -rbenchmarkstress-ngpresent runs the 1m matrix load without touching brew; accept path runsbrew install/brew linkthen the load; decline path exits 0 with no installMethod
Each shebang recipe body is extracted verbatim from
default.justand executedagainst stubbed
gum,sudo,systemctl,dmidecode,mokutil,powerstat,stress-ng,brew, anduwelcome./sys/firmware/efiand the/usr/etc /etcdiff operands are redirected into a sandbox with
sed, so real control flow isexercised instead of grepped.
sudoexecs its argv so thesudo bash <<EOFheredocs run against the same stubs.
Incidental finding pinned, not fixed
check-local-overrideshardcodesdiff --color="always".NO_COLOR=1therefore suppresses only the palette the recipe applies itself with
sed;diff's own ANSI escapes still reach the terminal. One test documents thatcurrent behaviour so a future fix is visible. No production code is changed by
this PR.
Disjointness
Explicitly claims only the seven recipes listed above in
default.just, plusthe new test file.
device-info(default.just) — left to PR [scanner] fix: remove sudo from device info status #1003, not touched or asserted on.clean-system(default.just) — already owned bytests/test_clean_system_podman_path.bats.shared.just— left to PR [quality] test: BATS coverage for shared.just (powerwash, toggle-tpm2) #1034.system.just— left to PR [quality] test(system.just): BATS coverage for toggle-testing, toggle-vms, install-system-flatpaks #1031.apps.just— left to PRs [scanner] fix: use valid brew tap trust commands #978, [scanner] fix: configure opt-in bluespeed tools #1007, [scanner] fix: add Bluespeed bootstrap recipe #1018.changelog.just/ublue-image-repo— left to PR [architect] refactor: single source of truth for image-name → upstream repo routing #1045.Justfile: one line,bats tests/test_default_just.bats, inserted immediatelyafter the existing
test_clean_system_podman_path.batsline rather thanappended to the end of the recipe, specifically so it does not collide with
PR #1031's append at the tail of the same recipe.
.github/workflows/unit-tests.ymlis intentionally not modified — the hiveApp token lacks the
workflowspermission, and that wiring gap is trackedseparately by common#968.
Verification
Related Issue
Refs #968 (the workflow-wiring half of the gap remains open).
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5