test(bash): handle expected env diff
Bash / shellcheck (push) Successful in 9s
changelog / changelog (push) Successful in 16s
Bash / bash-unittest (push) Successful in 36s
Helm / helm-lint (push) Successful in 10s
Helm / helm-unittest (push) Successful in 31s

Bats now honors errexit inside functions run through run. Treat diff status 1 as expected environment changes so the helper returns the script status.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
volker.raschekandCopilot committed 2026-12-04 23:19:13 +01:00
1 parent a5579c167e
commit 6cc089ba9c
1 file changed
+7 -1
@@ -68,7 +68,13 @@ function execute_test_script() {
currentEnvsAfter=$(env | sort)
# diff as unified +/- output without context before/after
diff --unified=0 <(echo "$currentEnvsBefore") <(echo "$currentEnvsAfter")
local diffStatus
if diff --unified=0 <(echo "$currentEnvsBefore") <(echo "$currentEnvsAfter"); then
:
else
diffStatus=$?
[[ $diffStatus == 1 ]] || return "$diffStatus"
fi
exit $exitCode
}