A negation in tests/postfix-local.bats asserts nothing, and COVERAGE.md is wrong about which ones do #9
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Keel-Linux/common#9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
A bats test body has no assertions of its own: its verdict is the exit status of the last command it ran. Bash does not apply errexit to a negated command, so
! cmdon its own line decides the test when it is the final command of the body and is inert everywhere else.tests/postfix-local.batshas three bare negations. One is inert, line 96, in "stops at the first failing postconf":The test is named for stopping at the first failure, and the assertion that the banner was never set is the one that says it stopped. That one did not run. A script that carried on past the failing
postconfand set the banner anyway would pass this test.Lines 66 and 97 are last in their bodies and do assert. That distinction is worth stating because
COVERAGE.mdonfix/keel-apt-identity(#8) says all three are inert, which is wrong about two of the three, and that text needs correcting wherever it lands.What to do
Write every negation
run ! cmd, withbats_require_minimum_version 1.5.0, which asserts wherever it stands — the two in final position included. A file that mixes the two forms leaves a reader to work out which half is real, and adding one line after a final-position!silently disables it.Test plan
shellcheck --severity=error --include=SC2314overtests/*.batsreports nothing.bats tests/postfix-local.batsgreen with the inert assertion live.tests/coverage.shat the committed threshold of 100.COVERAGE.mdship nothing, sopackage / changelogpasses by reporting that nothing that ships changed.