chore: add basic automated testing framework - #101
Open
gbartolini wants to merge 1 commit into
Open
Conversation
gbartolini
requested review from
fcanovai,
leonardoce and
mnencia
as code owners
July 30, 2026 05:10
…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
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.
Adds shellcheck/shfmt static analysis, bats unit tests, and dry-run golden-file tests, wired into a GitHub Actions workflow.
Closes #100