Skip to content

[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
mainfrom
quality/test-default-just
Open

[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
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-default-just

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds tests/test_default_just.bats — 23 BATS tests for
system_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, via tests/test_clean_system_podman_path.bats). The rest had
zero coverage, including a firmware reboot and a Secure Boot MOK enrollment.

Recipes claimed by this PR

Recipe What is covered
bios legacy-BIOS guard exits 1 and never reboots; EFI + confirm issues systemctl reboot --firmware-setup; declined confirmation does not reboot
bios-info all four dmidecode -s fields read under sudo bash; every field is labelled
enroll-secure-boot-key mokutil --timeout -1 precedes the import; akmods-ublue.der is the imported cert; enrollment password guidance is printed
toggle-user-motd shim body is exactly uwelcome toggle
check-local-overrides only-in-/etc reporting; content divergence reporting; silence when trees match; NO_COLOR=1 palette suppression; palette applied when unset; identity/credential --exclude set
check-idle-power-draw missing-powerstat guard exits 1 without invoking it; present path runs powerstat -a -r
benchmark stress-ng present runs the 1m matrix load without touching brew; accept path runs brew install/brew link then the load; decline path exits 0 with no install

Method

Each shebang recipe body is extracted verbatim from default.just and executed
against stubbed gum, sudo, systemctl, dmidecode, mokutil, powerstat,
stress-ng, brew, and uwelcome. /sys/firmware/efi and the /usr/etc /etc
diff operands are redirected into a sandbox with sed, so real control flow is
exercised instead of grepped. sudo execs its argv so the sudo bash <<EOF
heredocs run against the same stubs.

Incidental finding pinned, not fixed

check-local-overrides hardcodes diff --color="always". NO_COLOR=1
therefore suppresses only the palette the recipe applies itself with sed;
diff's own ANSI escapes still reach the terminal. One test documents that
current 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, plus
the new test file.

Justfile: one line, bats tests/test_default_just.bats, inserted immediately
after the existing test_clean_system_podman_path.bats line rather than
appended 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.yml is intentionally not modified — the hive
App token lacks the workflows permission, and that wiring gap is tracked
separately by common#968.

Verification

$ bats tests/test_default_just.bats
1..23
ok 1 .. ok 23

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

…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 hanthor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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

Labels

hold Work is intentionally paused. quality testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant