Skip to content

Make the vault and broker-api-k8s integration suites runnable on macOS - #7197

Merged
sorindumitru merged 2 commits into
spiffe:mainfrom
samuraixwandering:integration-suites-portable-shell
Aug 8, 2026
Merged

sorindumitru merged 2 commits into
spiffe:mainfrom
samuraixwandering:integration-suites-portable-shell

Conversation

@samuraixwandering

Copy link
Copy Markdown
Contributor

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included? (the changed files are the integration suites themselves; all three were run end to end, below)
  • Documentation updated? (not needed)

Affected functionality

The key-manager-vault, upstream-authority-vault and broker-api-k8s integration suites. No production code is touched and there is no behaviour change on Linux.

Description of change

These suites cannot run on a macOS host without installing GNU replacements first. CI only runs them on ubuntu-22.04, so the gap is invisible there.

  • timeout 30s bash -c '...' in both vault suites becomes the bounded polling idiom wait-for-rollout already uses in k8s/01-apply-config, since macOS does not ship timeout. One deliberate difference: the budget is a check count now rather than wall-clock time, matching that suite, and it calls fail-now with a reason instead of dying at bare exit 124 under set -e.
  • date -ud "1 minute 30 second" +%s becomes $(( $(date -u +%s) + 90 )), since BSD date has no -d. Line 10 of the same script already compares against date -u +%s, so both sides agree.
  • readarray becomes a while IFS= read -r loop, since it is a bash 4+ builtin and macOS ships bash 3.2 as /bin/bash. Kept as a separate commit: unlike the other two it has a workaround needing no repo change, so it is easy to drop if you would rather leave broker-api-k8s alone.

Verification

Run on Darwin 25.6.0 arm64 with PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin, which carries no GNU tools. Gated before running: bash is 3.2.57, timeout is absent, date -d is rejected, readarray is unavailable.

On unmodified main (6215e5995) the reported failure reproduces, after the kind cluster comes up healthy:

01-setup-vault: line 70: timeout: command not found

On this branch, same host and same PATH:

Suite Result
upstream-authority-vault passed
key-manager-vault passed
broker-api-k8s passed

The changed paths are exercised rather than skipped. The poll loop obtains a real certificate from k8s, 04-verify-token-renewal.sh runs a real deadline loop and reports token renewal is verified, and broker-api-k8s comes up as a three node cluster so the read loop parses three distinct node UIDs.

Which issue this PR fixes

fixes #7174

macOS does not ship timeout at all, and BSD date has no -d, so both vault
suites fail partway through a run on a macOS host.

Replace the timeout wrapper with the bounded polling idiom already used by
wait-for-rollout in the k8s suite. That reports a reason when the wait is
exhausted, rather than dying at bare exit 124 under set -e. Note the bound
is now a check count rather than wall-clock time, matching the k8s suite.

Replace the date -d arithmetic with $(( $(date -u +%s) + 90 )). The loop it
feeds already compares against date -u +%s, so both sides agree.

No behaviour change on Linux.

Signed-off-by: samuraiXwandering <[email protected]>
readarray is a bash 4+ builtin and macOS ships bash 3.2 as /bin/bash, so
broker-api-k8s fails on a macOS host unless a newer bash is put on PATH.

Unlike the vault changes this one has a workaround that needs no repo
change, so it is kept as a separate commit and can be dropped. The
existing [ -n ] guard below already tolerates the empty-element
difference between the two forms.

Signed-off-by: samuraiXwandering <[email protected]>

@sorindumitru sorindumitru left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @samuraixwandering!

@sorindumitru sorindumitru added this to the 1.15.3 milestone Aug 8, 2026
@sorindumitru
sorindumitru added this pull request to the merge queue Aug 8, 2026
Merged via the queue into spiffe:main with commit b91176e Aug 8, 2026
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integration suites require GNU coreutils and bash 4+ to run on a macOS host

2 participants