feat: improve testing framework and add CI - #48
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes the Bash-based test suite self-checking (assertions + deterministic offline fixtures) and adds GitHub Actions CI to run ShellCheck and the suite across supported Bash versions.
Changes:
- Introduces a tiny assertion helper (
tests/assert.sh) and converts existing tests into self-checking unit/E2E scripts. - Refactors the test entrypoint to auto-discover
*.test.shunit tests and explicitly run E2E tests. - Adds a CI workflow to run ShellCheck and the test suite in
bash:4.1andbash:5.2, and updates docs + attributes accordingly.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/templating.sh | Converts templating checks into deterministic, self-checking assertions using ell_echo. |
| tests/redaction.sh | Removes legacy non-asserting redaction script (replaced by plugin unit test). |
| tests/piping.sh | Removes legacy piping script (replaced by helpers/piping.test.sh). |
| tests/parse_output.sh | Adds self-checking parsing tests using file:// fixtures and a helper runner. |
| tests/logging.sh | Removes legacy logging script (replaced by helpers/logging.test.sh). |
| tests/entry.sh | Makes suite runnable from any checkout path; auto-discovers unit tests and runs E2E tests. |
| tests/docker.sh | Runs the suite in both bash container versions and propagates combined status. |
| tests/assert.sh | Adds new assertion library used by unit/E2E tests. |
| README.md | Documents the new test layout, local/Docker usage, and CI behavior. |
| plugins/redaction/50_post_input.test.sh | Adds unit tests for redaction plugin, asserting secrets are removed and markers inserted. |
| helpers/render_to_text.test.sh | Fixes the awk script path now that the test is co-located in helpers/. |
| helpers/piping.test.sh | Adds unit tests for helpers/piping.sh. |
| helpers/logging.test.sh | Adds unit tests for helpers/logging.sh including stderr-only guarantees. |
| helpers/json.test.sh | Adds unit tests for the pure-bash JSON parser (paths, escapes, unicode, validity). |
| .github/workflows/ci.yml | Adds CI: ShellCheck (errors blocking, warnings non-blocking) + test matrix across bash versions. |
| .gitattributes | Ensures consistent LF endings for workflow YAML files. |
Comments suppressed due to low confidence (1)
tests/assert.sh:88
- assert_not_contains has the same glob-pattern issue as assert_contains: needles containing characters like '[' are treated as patterns rather than literal substrings. This can cause false failures/passes (e.g. redaction marker checks). Escape glob metacharacters in the needle before matching.
# assert_not_contains <name> <haystack> <needle>
# Succeeds if <haystack> does NOT contain the literal substring <needle>.
# Useful for security assertions: "the secret must not survive".
assert_not_contains() {
local name="${1}" haystack="${2}" needle="${3}";
case "${haystack}" in
*"${needle}"*)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Resolves #33