Skip to content

[quality] test: unit coverage for scripts/build-iso.sh named-arg wrapper — tests/test_build_iso_args.py - #148

Open
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-build-iso-args
Open

[quality] test: unit coverage for scripts/build-iso.sh named-arg wrapper — tests/test_build_iso_args.py#148
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-build-iso-args

Conversation

@kubestellar-hive

Copy link
Copy Markdown

Test Improvement

Adds tests/test_build_iso_args.py — the first behavioural coverage for scripts/build-iso.sh.

Exact ground claimed by this PR

  • File under test: scripts/build-iso.sh (33-line named-flag wrapper) — argument parsing loop, required-flag guard, and the exec delegation to live/src/build-iso.sh.
  • New file added: tests/test_build_iso_args.py (only file added or changed).
  • Read-only references (not modified): .github/workflows/test-plain-install.yml call site, live/src/build-iso.sh existence check.

Why it matters

scripts/build-iso.sh translates the named-flag interface used by .github/workflows/test-plain-install.yml:

scripts/build-iso.sh --squashfs <sfs> --boot-tar <tar> --output <iso>

into the positional interface of live/src/build-iso.sh:

live/src/build-iso.sh <boot-tar> <squashfs> <output-iso>

The two interfaces order boot tar and rootfs squashfs differently. A slip in the wrapper swaps them, which still produces an ISO — one that only fails hours later in the QEMU plain-install E2E lane, with no unit signal.

What the 13 tests cover

TestArgumentTranslation

  • flags map to the documented <boot-tar> <squashfs> <output-iso> order
  • flag order on the command line does not change positional order (3 subtests)
  • values containing spaces stay single arguments
  • last occurrence of a repeated flag wins
  • the delegate exit status is propagated (the wrapper execs, so a failed build must not report success)

TestArgumentValidation

  • no arguments prints usage and exits non-zero
  • each of --squashfs, --boot-tar, --output is individually required (3 subtests)
  • a flag given without a value fails instead of consuming the next flag (3 subtests)
  • unknown flags (e.g. --oci-image) are rejected
  • a stray positional path is rejected

TestWorkflowContract

  • wrapper and delegate exist, wrapper passes bash -n
  • test-plain-install.yml passes exactly the flag set the wrapper accepts

Method

Each test copies the real wrapper into a temporary <root>/scripts + <root>/live/src tree whose delegate is a recording stub, because the wrapper resolves its delegate as "$(dirname "$0")/../live/src/build-iso.sh". The real live/src/build-iso.sh (needs xorriso, mtools, root) is never executed — the suite stays fast and hermetic and needs no new CI dependencies.

Verification

Disjointness with open PRs

No production code changes.


Filed by quality agent (hold-gated mode). Human review required — do not merge automatically.

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

scripts/build-iso.sh translates the named-flag interface used by
.github/workflows/test-plain-install.yml into the positional interface of
live/src/build-iso.sh. The two interfaces order their arguments differently
(--squashfs/--boot-tar vs <boot-tar> <squashfs>), so a slip in the wrapper
silently swaps the rootfs squashfs and the boot tar and yields an ISO that
builds cleanly and then fails to boot in the QEMU E2E lane.

Adds tests/test_build_iso_args.py: 13 tests running the wrapper against a
recording stub delegate in a temporary scripts/ + live/src/ tree, covering
positional translation, flag-order independence, repeated flags, values with
spaces, exit-status propagation, required-flag enforcement, missing flag
values, unknown and stray positional arguments, and a contract test that
test-plain-install.yml passes exactly the flag set the wrapper accepts.

No production code changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
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.

0 participants