Skip to content

Commit ed56999

Browse files
committed
fix(e2e): stop the history helpers clobbering a caller variable
Both helpers assigned "statuses" without scoping it, so sourcing the library and calling either one overwrote any variable of that name in the caller. Seven bats suites source this library and the e2e guard holds release history in variables of its own, so the collision was reachable rather than theoretical. Demonstrable in one line each: with a caller-set "statuses", both functions returned with it replaced by their own argument. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 776762f commit ed56999

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎hack/e2e-chainsaw/_lib/remediation-guard.sh‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@
6363
# explanation inside the release. Keeping that out of here leaves each helper
6464
# answering one question about one list of statuses.
6565

66+
# Both helpers scope "statuses", so sourcing this library and calling one
67+
# cannot overwrite a variable of that name in the caller. Seven suites source
68+
# it, and the e2e guard keeps release history in variables of its own.
6669
helmrelease_has_teardown() {
70+
local statuses
6771
statuses="$1"
6872
if [ -z "${statuses}" ]; then
6973
return 1
@@ -75,6 +79,7 @@ helmrelease_has_teardown() {
7579
}
7680

7781
helmrelease_has_remediation_cycle() {
82+
local statuses
7883
statuses="$1"
7984
if [ -z "${statuses}" ]; then
8085
return 1

0 commit comments

Comments
 (0)