Fix unit tests aborting on bash 3.2 - #1505
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @corioliskraft! |
|
Hi @corioliskraft. Thanks for your PR. I'm waiting for a stackitcloud member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Script hack/test.sh sets nounset and expands test_flags at line 27.
Outside CI that array is empty, and bash 3.2 treats the expansion of an
empty array as an unbound variable, so make verify aborts before it runs
a test. macOS ships bash 3.2.57 as /bin/bash.
Guard the expansion so it disappears when the array is empty. This
matches the ${timeout_flag:+...} guard in the same line.
881283c to
33dc20b
Compare
How to categorize this PR?
/kind bug
What this PR does / why we need it:
Script
hack/test.shsetsnounsetat line 4 and expandstest_flagsat line 27. OutsideCI that array is empty, and bash 3.2 treats the expansion of an empty array as an unbound
variable. Therefore
make verifyaborts before it runs a test:macOS ships bash 3.2.57 as
/bin/bash, so every contributor on a stock macOS machine hitsthis at CONTRIBUTING step 4.
This PR guards the expansion, so it disappears when the array is empty. This matches the
${timeout_flag:+...}guard in the same line. Prow is not affected either way, becausethere
CIandARTIFACTSare set andtest_flagsis never empty.Which issue(s) this PR fixes:
Fixes #1504
Special notes for your reviewer:
The behavior of the guard on bash 3.2.57:
The second command shows that the elements stay separate arguments. The form uses
+andnot
:+, because the test must be "set" and not "set and not empty".make verifypasses on macOS 15.7.7, arm64, with bash 3.2.57.Breaking changes:
None.