Skip to content

fix(e2e): resolve the Darwin fixture path on bash 3.2 - #3798

Merged
SuperQ merged 2 commits into
prometheus:masterfrom
SaiPisey2:fix/e2e-darwin-fixture-path
Aug 31, 2026
Merged

fix(e2e): resolve the Darwin fixture path on bash 3.2#3798
SuperQ merged 2 commits into
prometheus:masterfrom
SaiPisey2:fix/e2e-darwin-fixture-path

Conversation

@SaiPisey2

Copy link
Copy Markdown
Contributor

Split out of #3767 as requested.

Two fixes to end-to-end-test.sh, both about running the suite on a Darwin host.

The Darwin fixture path is not resolved on bash 3.2

fixture_metrics="${fixture_metrics::-4}-${GOHOSTOS}.txt"

A negative substring length needs bash 4.2. macOS still ships bash 3.2, where that expansion fails:

$ /bin/bash -c 'v=collector/fixtures/e2e-output.txt; echo "${v::-4}"'
/bin/bash: -4: substring expression < 0

generated_metrics on the line above uses plain interpolation and is resolved correctly, so the generated file is the Darwin one while fixture_metrics still points at the Linux fixture. Running ./end-to-end-test.sh -u on a Mac therefore overwrites collector/fixtures/e2e-output.txt with Darwin output — in my case rewriting 5330 lines of it before I noticed.

${fixture_metrics%.txt} is equivalent and works on both. Verified under bash 3.2.57 and 5.3.15, and both still pass bash -n.

node_thermal_temperature_celsius is per-machine

Its sensor names and its values both depend on the hardware, so anyone regenerating the Darwin fixture on a real Mac gets the whole sensor list as a diff rather than the intended change. It is stripped along with the other non-deterministic metrics now.

This makes no difference in CI, which reports no thermal sensors at all — it only matters when the suite is run on real hardware, which is exactly what the -u instructions ask for.

Unrelated and left alone: the sed -i /pattern/d calls in that same loop need an extension argument on BSD sed, so the stripping aborts on stock macOS. It behaves the same way on master, so it is not something this PR introduces.

The per-OS fixture path was built with "${fixture_metrics::-4}". A
negative substring length needs bash 4.2, and macOS still ships bash 3.2,
where the expansion fails, fixture_metrics keeps pointing at the Linux
fixture, and ./end-to-end-test.sh -u run on a Mac overwrites
collector/fixtures/e2e-output.txt with Darwin output.

"${fixture_metrics%.txt}" is equivalent and works on both.

Also strip node_thermal_temperature_celsius along with the other
non-deterministic metrics. Its sensor names and values are per-machine,
so a developer running the suite on real hardware sees the whole sensor
list as a diff. The CI runner reports no thermal sensors, so this makes
no difference there.

Signed-off-by: SaiPisey2 <piseysai0202@gmail.com>
@SaiPisey2

Copy link
Copy Markdown
Contributor Author

Thanks for the review @TheMeier. The workflows are still pending approval, so DCO is the only check that has run — could someone kick off the rest when convenient?

Comment thread end-to-end-test.sh Outdated
Signed-off-by: Ben Kochie <superq@gmail.com>

@SuperQ SuperQ 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.

Thanks

@SuperQ
SuperQ merged commit a4e08d1 into prometheus:master Aug 31, 2026
17 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.

3 participants