mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
One test of 800 has been failing every run: TestGenerateConfigFiles_InlineReplaceError,
"An error is expected but got nil".
The test is correct and the assertion is right. It proves generateConfigFiles
reports a failure when it cannot write the README back, and it induces that
failure by chmod'ing the file to 0400. Root ignores permission bits, so the write
SUCCEEDS, the function returns nil, and require.Error fails. The premise simply
does not hold for uid 0 — nothing about the code under test is wrong.
CI runs this container as root, so it failed on every run rather than
intermittently, which is why it reads as a broken build rather than an
environment mismatch. Measured both ways in the same image:
as root (uid 0): FAIL go.opentelemetry.io/collector/cmd/mdatagen/internal
as uid 1000: ok go.opentelemetry.io/collector/cmd/mdatagen/internal
So the guard is os.Geteuid() == 0 -> t.Skip, the standard idiom for a test whose
setup depends on being denied something. The coverage is not lost; it still runs
for every developer and any non-root CI. Weakening the assertion, or dropping the
chmod, would have made the test pass while proving nothing.
Whole package as root after the change: all mdatagen packages ok.