[quality] test: add BATS unit tests for bootc-build/preflight/action.yml - #436
Open
kubestellar-hive[bot] wants to merge 1 commit into
Open
[quality] test: add BATS unit tests for bootc-build/preflight/action.yml#436kubestellar-hive[bot] wants to merge 1 commit into
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
Adds tests/bats/test_preflight.bats — 24 cases covering the three inline run: blocks of bootc-build/preflight/action.yml, which had zero coverage: normalize (registry/owner/image-name lowercasing, optional image-ref), registry auth (podman login success/failure, token-on-stdin, stderr suppression), and required-secrets validation (missing/empty detection, whitespace stripping in the comma list). podman is stubbed on PATH, so the suite needs no container runtime, registry, or network. Snippets are machine-verified byte-for-byte copies of the action.yml run blocks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
hanthor
approved these changes
Sep 2, 2026
hanthor
left a comment
Member
There was a problem hiding this comment.
BATS coverage for bootc-build/preflight/action.yml. Verified the embedded snippets match the live action file. Notably tests a real security property — that the registry token is only ever passed via stdin, never argv, and stderr is suppressed around it — not just happy-path coverage. CI green (5/5).
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/bats/test_preflight.bats— 24 BATS cases covering the three inlinerun:blocks inbootc-build/preflight/action.yml, which previously had zero test coverage.action.ymlNormalize image reference${INPUT_REGISTRY,,}/${GITHUB_REPOSITORY_OWNER,,}lowercasing intoregistry-lowercase;image-refemitted only whenimage-nameis non-empty; image name lowercased; embedded slash preserved;image-refalways prefixed byregistry-lowercase; key=value shape ofGITHUB_OUTPUTValidate registry authpodman loginsuccess → exit 0 + "Registry auth OK"; failure →::error::Registry auth failed for <registry>+ exit 1 and no success message; exact argvlogin <registry> -u <actor> --password-stdin; token arrives on stdin and never on the command line;2>/dev/nullsuppression means podman stderr cannot leak to the job log; non-default registry named in the annotationValidate required secrets::error::; unset var and set-but-empty var both reported as missing; every missing name listed space-separated; present names not listed; whitespace around the comma list stripped (" ALPHA , BETA "); single-entry list; a var set to whitespace counts as presentpodmanis stubbed onPATH(recording argv + stdin, configurable exit code), so the suite needs no container runtime, registry, network, or credentials.The three snippets under test are byte-for-byte copies of the
action.ymlrun blocks, defined with quoted heredocs and machine-verified against the YAML — this follows the convention established intests/bats/test_detect_changes.batsandtests/bats/test_create_manifest.bats, so the tests break if the action logic changes without updating them.Picked up automatically by the existing
batsjob in.github/workflows/unit-tests.yml(tests/**path filter). No production code, workflow, or docs files are touched.Verification
Claimed ground / overlap check
Claims exactly one new file:
tests/bats/test_preflight.bats, testingbootc-build/preflight/action.ymlonly.Checked against every open hold-gated PR in this repo:
actions#428(quality) claimstests/bats/test_create_manifest.bats/bootc-build/create-manifest/action.yml— different action, different test file.actions#427claimsbootc-build/scan-image/action.yml,tests/bats/test_scan_image.bats,docs/skills/*.md— disjoint.actions#431(architect) claimsscripts/render_pr_body.py,scripts/render_gate_section.py,tests/conftest.py,tests/test_render_single_source.py— disjoint (Python,scripts/).actions#434(sec-check) claims.github/actions/install-cosign/action.yml— disjoint.actions#435claimsdocs/skills/*.md— disjoint; this PR deliberately edits no docs.actions#426claims.github/workflows/pkg-cadence.yml— disjoint.bootc-build/preflight/ortests/bats/.Related Issue
Refs #429 (9 bootc-build composite actions with zero BATS coverage) — this PR covers
preflightonly; the tracker stays open for the remaining actions.Filed by quality agent (hold-gated mode). Human review required — do not merge without review.
— hive: agent=quality backend=copilot model=claude-opus-5