Skip to content

Commit 0e53596

Browse files
edsantiagomheon
authored andcommitted
buildah-bud tests: add arg sanity check
Fix bad design decision (mine) by adding a simple usage check to 'skip' and 'skip_if_remote' functions: if invoked without test-name args, fail loudly and immediately. Background: yeah, their usage is not intuitive. Making the first arg be a comment helps with _reading_ the code, but not _writing_ new additions. A developer in a hurry could write "skip this-test" and, until now, that would be a silent NOP. Tested by adding broken skip/skip_if_remote calls inline; I confirm that the line number and funcname usage is correct. Signed-off-by: Ed Santiago <[email protected]>
1 parent 96ccd69 commit 0e53596

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/buildah-bud/apply-podman-deltas

+6-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ function _skip() {
6161
local skip=$1; shift
6262
local reason=$1; shift
6363

64-
# All further arguments are test names
64+
# All further arguments are test names. Make sure we're invoked with some!
65+
if [[ -z "$*" ]]; then
66+
echo "$ME: FATAL: Invalid use of '${FUNCNAME[1]}' at line ${BASH_LINENO[1]}: missing test-name argument(s)." >&2
67+
exit 1
68+
fi
69+
6570
for t in "$@"; do
6671
if fgrep -qx "@test \"$t\" {" $BUD; then
6772
$ECHO "@test \"$t\" : $skip \"$reason\""

0 commit comments

Comments
 (0)