Skip to content

The three refutations in wrappers.bats that asserted nothing - #12

Merged
marcos-mendez merged 1 commit into
masterfrom
test/wrappers-negations
Sep 29, 2026
Merged

marcos-mendez merged 1 commit into
masterfrom
test/wrappers-negations

Conversation

@marcos-mendez

@marcos-mendez marcos-mendez commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

tests/wrappers.bats came in with #6 after the sweep in Keel-Linux/tracker#19. Three of its seven bare negations were not the last command of their test. A bats test passes or fails on the exit status of its last command, and bash's errexit ignores a negated command, so ! cmd anywhere else is never checked:

  • line 267, "refuses a target that is not a WordPress": that wp-cli is never called for a refused target;
  • line 325, "USER in the environment does not decide who owns wp-content": that nothing under wp-content is handed to root;
  • line 337, "WPROOT in the environment does not decide what this script rewrites": that the updater never runs chown -R root:root /.

All seven are run ! now, with bats_require_minimum_version 1.5.0. The four that were last in their test are converted too, so that no line only works because of where it sits.

Test plan

  • For each of the seven, making that one command succeed turns its test red. Each fails with status 1 (grep found no match), not 2 (file missing).
  • Real mutations of keel-wordpress-update for the three that were dead: calling wp-cli before the target check, chowning wp-content/uploads to root, and chowning /. Each turns this branch red and leaves master green.
  • The extended gate from Negations that assert, and a gate so the class cannot come back .github#14 (6372ac2) reports nothing; on master it reports these three lines.
  • bats -r tests green.
  • Tests ship nothing, so no changelog entry.

Part of Keel-Linux/tracker#19. Must merge before Keel-Linux/.github#14.

tests/wrappers.bats came in with #6 after the sweep of tracker#19, and three
of its seven bare negations were not the last command of their test, so bash
did not apply errexit to them and they asserted nothing: that USER=root in
the environment does not hand wp-content to root, that WPROOT=/ in the
environment does not make the updater chown / , and that a refused update
target is never chowned. All seven are `run !` now, with
bats_require_minimum_version 1.5.0, the four in final position included, so
no line's meaning depends on its position.

Each of the seven goes red when the command it refutes is made to succeed,
and each fails with status 1 (grep found nothing), not 2 (no file).
@marcos-mendez
marcos-mendez merged commit 4c377ee into master Sep 29, 2026
3 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.

1 participant