Skip to content

[quality] test(apps.just): BATS coverage for install-opentabletdriver and cncf - #1064

Open
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-apps-just-otd-cncf
Open

[quality] test(apps.just): BATS coverage for install-opentabletdriver and cncf#1064
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-apps-just-otd-cncf

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Claimed ground

File under test: system_files/shared/usr/share/ublue-os/just/apps.just
Recipes claimed: install-opentabletdriver, cncfonly these two.
New file: tests/test_apps_just.bats (21 cases)
Also touched: Justfile (one added line in the test recipe)

Disjointness check against open PRs

apps.just is partially occupied ground, so this PR deliberately claims only
the recipes no open PR touches
:

Open PR Ground it holds in apps.just Overlap here
common#978 [scanner] fix: use valid brew tap trust commands brew tap --trust lines in install-jetbrains-toolbox, install-asus none
common#941 fix(brew): replace invalid brew tap --trust (+ tests/test_brew_tap_trust.bats) same brew tap --trust lines none
common#1048 [quality] test(default.just) default.just / tests/test_default_just.bats none
common#1034 [quality] test(shared.just) shared.just / tests/test_shared_just.bats none
common#1031 [quality] test(system.just) system.just / tests/test_system_just.bats none
common#1063 [architect] setup hook dispatch ublue-*-setup, hookrunner.sh none
common#1045 [architect] image-name → upstream routing bonedigger-report, changelog.just none

install-jetbrains-toolbox and install-asus are not covered by this PR.
A test in this file (apps.just recipes covered here do not call brew tap)
pins that scope boundary so a future edit cannot silently pull the brew-tap
recipes into this suite while #978/#941 are still open.

Justfile is also edited by #1048 and #1031, but each adds its own line to the
same test recipe list — a trivial textual conflict at worst, no semantic
overlap.

What this adds

apps.just (76 lines) had zero test coverage: no file under tests/
referenced it, and neither the Justfile test recipe nor
.github/workflows/unit-tests.yml executed anything against it.

tests/test_apps_just.bats extracts each recipe body into a standalone script
and runs it against a sandboxed PATH of mocks (gum, curl, sudo,
flatpak, systemctl, brew, ujust) with /etc/udev/rules.d,
/etc/modprobe.d, /usr/share/ublue-os/homebrew and $HOME redirected into a
per-test temp tree. This follows the existing pattern in
tests/test_update_just.bats. No network, no root, no host mutation.

install-opentabletdriver

  • gum confirm exit 0 → install branch; exit 1 → uninstall branch; exit 130
    (Ctrl-C) → neither branch runs and no flatpak call is made
  • the jq asset filter picks the .tar.gz release asset and not the .deb
    or .rpm decoys
  • the udev rule is copied 70-opentabletdriver.rules71-opentabletdriver.rules
  • blacklist hid_uclogic / blacklist wacom land in
    blacklist-opentabletdriver.conf
  • the mktemp -d extraction directory is removed
  • flatpak --system install / flatpak --system remove are issued on the
    correct branches
  • the user unit is written to $HOME/.config/systemd/user/ and enabled
  • uninstall makes no network calls and does not create the user unit

cncf

  • brew bundle --file=.../cncf.Brewfile is invoked with the curated Brewfile path
  • ujust --choose is skipped when stdin is not a tty, and the recipe still
    exits 0 (the || true tail)
  • a failing brew bundle does not abort the recipe (no set -e in this body)

Bug found while writing these tests

install-opentabletdriver writes the modprobe blacklist to
/etc/modprobe.d/blacklist-opentabletdriver.conf on install, but the uninstall
branch removes /etc/modprobe.d/blacklist-opentabletdriver.rules — a different
filename. Uninstalling leaves hid_uclogic and wacom permanently
blacklisted
, so the built-in tablet/Wacom drivers stay disabled after the
user has removed OpenTabletDriver.

Per hold-gated quality scope this PR does not fix the recipe. The test
install-opentabletdriver: uninstall targets the wrong modprobe filename (regression guard) pins the current (buggy) behaviour and carries a comment
saying to flip the assertion when the recipe is corrected. Filed separately as
an issue.

Not included

The matching step in .github/workflows/unit-tests.yml was prepared but had to
be dropped: the hive GitHub App token has no workflows permission, so pushing
a workflow edit is rejected. The suite is wired into the Justfile test
recipe only. A one-line CI step is needed as a follow-up:

      - name: Run bats (apps.just — install-opentabletdriver, cncf)
        run: bats tests/test_apps_just.bats

Verification

$ bats tests/test_apps_just.bats
1..21
ok 1 .. ok 21   # all pass

Filed by quality agent (hold-gated mode). Human review required — do not merge without review, and do not remove the hold label.

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

… and cncf

Adds tests/test_apps_just.bats — 21 cases covering the two apps.just
recipes that do not touch brew tap:

  install-opentabletdriver  (gum confirm dispatch, asset selection,
                             udev rule rename, modprobe blacklist,
                             tmpdir cleanup, flatpak install/remove,
                             user service unit, Ctrl-C exit 130)
  cncf                      (brew bundle Brewfile path, non-tty
                             ujust --choose skip, failure tolerance)

The install-jetbrains-toolbox and install-asus recipes in the same file
are deliberately left uncovered: their brew tap --trust lines are being
changed by other open PRs.

Wires the file into the Justfile test recipe.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: sec-check[bot] <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.

New tests/test_apps_just.bats only, scope matches the claim, exercises real control flow with mocked binaries, and correctly pins the existing blacklist uninstall mismatch as a regression guard rather than silently "fixing" it. CI test+E2E green; validate fails only on title-lint (bracket prefix), not a code issue.


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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant