Skip to content

test: add hermetic self-tests for the gitops-repo-audit skill scripts #28

Description

@devantler

🤖 Generated by the Daily AI Assistant

Problem

The gitops-repo-audit skill bundles three non-trivial Bash helper scripts that ship to users but have zero test coverage — there is no .test.sh alongside any of them, and CI never executes them:

The repo's only script test is the root-level scripts/validate-manifests.test.sh (added in #26), which the CI lint-scripts job runs. The skill-bundled scripts are outside that job's scope, so a regression in any of them — a broken exit code, a missed deprecation marker, an arg-parsing change — would land green and reach users.

This is the last remaining gap in the "every guard/helper script gets a hermetic self-test" holistic thread (previously delivered for validate-manifests.sh #26, plus run-mockery, rename-placeholders, check-readme-index, is-superseded, check-upstream-skills across the suite).

Proposed direction

Mirror the established *.test.sh pattern (hermetic: no network, no real flux/git/kubeconform — stub each required binary on PATH, like the offline gh-stub idiom used for check-upstream-skills.test.sh):

  1. Add check-deprecated.test.sh — assert the four error paths (missing -d, non-existent dir, missing flux CLI, usage on -h) and the deprecation exit-code contract (stub flux to emit output with vs. without ✚/-> → exit 1 vs 0).
  2. Add discover.test.sh and validate.test.sh covering their core logic against fixture repos with stubbed external tools.
  3. Extend the CI lint-scripts job to discover and run *.test.sh under plugins/**/skills/**/scripts/ (not just the repo root), so future bundled scripts are auto-covered.

Tests must pin real behaviour and edge cases — no vacuous assertions, no weakening to make them pass.

Rough size

Small–medium. check-deprecated.test.sh is a clean first installment (~47-line script, pure arg/exit-code logic); discover.sh/validate.sh need fixture repos + more stubs. Can ship incrementally (one script-test per PR) or as one PR; the CI-job extension is a few lines.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions