Skip to content

chore: add basic automated testing framework - #101

Open
gbartolini wants to merge 1 commit into
mainfrom
dev/100
Open

chore: add basic automated testing framework#101
gbartolini wants to merge 1 commit into
mainfrom
dev/100

Conversation

@gbartolini

Copy link
Copy Markdown
Contributor

Adds shellcheck/shfmt static analysis, bats unit tests, and dry-run golden-file tests, wired into a GitHub Actions workflow.

Closes #100

@gbartolini gbartolini changed the title Add automated testing framework (tiers 1–3) chore: add automated testing framework (tiers 1–3) Jul 30, 2026
@gbartolini gbartolini changed the title chore: add automated testing framework (tiers 1–3) chore: add basic automated testing framework Jul 30, 2026
…sts, dry-run golden tests)

Adds scripts/test.sh as the local entry point, running shellcheck, shfmt -d,
and the full bats suite in sequence:

- tests/unit/: bats-core unit tests for the pure bash helpers in
  scripts/funcs_regions.sh and demo/funcs_render.sh (region parsing,
  cluster/context naming, the replica-chain ring math including the
  wrap-around case). No external tool dependency beyond bash builtins.

- tests/dryrun/: drives demo/setup.sh with DRY_RUN=true OUTPUT_DIR=...
  across the plugin/legacy x single/multi-region matrix, validating the
  rendered YAML (well-formed, no leftover ${...} placeholders) and diffing
  it against committed fixtures in tests/dryrun/golden/. demo/setup.sh
  checks for kind/kubectl/kubectl-cnpg/cmctl on PATH but never actually
  invokes them in DRY_RUN mode, so tests/helpers/stubs/ stands in for the
  real tools rather than requiring them to be installed.

- .github/workflows/test.yml: runs scripts/test.sh on ubuntu-latest for
  every PR and push to main, with pinned tool versions (shellcheck, shfmt,
  bats-core, yq) tracked by Renovate. Intended to become a required status
  check once verified — see follow-up.

- flake.nix: adds shellcheck/shfmt/bats/yq-go to the dev shell.

Tier 4 (real Kind cluster integration tests) is intentionally out of scope.

Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>

Assisted-by: Claude Sonnet 4.6
@gbartolini
gbartolini requested a review from a team as a code owner August 6, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add automated testing framework (static analysis, unit tests, dry-run template tests)

1 participant