fleetd CI: unreadableFileIsUnknown is red on main under root #614
Reference in New Issue
Block a user
Delete Branch "worker/task-7-e34002-7"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
LeadContextGaugeTest.unreadableFileIsUnknown is RED on main in Gitea CI (root inside the container ignores the read bit that setReadable(false) clears, so the file opens anyway and the gauge reports OK instead of UNKNOWN). Measured: CI run 1887, job 3104, commit
fa62e99on main, failure at LeadContextGaugeTest.java:142 (expected UNKNOWN, was OK).Fix is test-only: after setReadable(false) (kept as the setup guard for a filesystem that refuses the chmod), assert Files.isReadable(file) is false via assumeFalse before constructing the gauge, with a comment explaining a skip here means "could not create the condition", not "the behaviour is fine". The finally block that restores the bit is unchanged, so @TempDir cleanup still works.
Production code (LeadContextGauge.java) is untouched.
Tests run (mvn -o clean install, fleetd/): Tests run: 1841, Failures: 0, Errors: 0, Skipped: 0 -- BUILD SUCCESS. LeadContextGaugeTest itself: Tests run: 9, Failures: 0, Errors: 0, Skipped: 0 (confirms the assumption does not skip on this non-root Mac).
Mutation proof: temporarily made the IOException catch in LeadContextGauge.readUncached return an OK Reading instead of UNKNOWN, ran mvn -o test -Dtest=LeadContextGaugeTest -- unreadableFileIsUnknown FAILED (expected: but was: , Tests run: 9, Failures: 1). Reverted the production file with git checkout and confirmed git diff --stat shows only the test file changed before committing.