From 1bbc4fad434a850565fb4f74e529f8824840988a Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 12 Oct 2018 14:41:42 +1100 Subject: ctdb-tools: Detect unknown node number If there aren't enough addresses in the list then the shift will silently fail and the printed address will be the unshifted value of $1, which is incorrect/unexpected. So, sanity check the node number. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/tests/onnode/0010.sh | 13 +++++++++++++ ctdb/tests/onnode/0011.sh | 13 +++++++++++++ ctdb/tools/onnode | 8 ++++++-- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100755 ctdb/tests/onnode/0010.sh create mode 100755 ctdb/tests/onnode/0011.sh (limited to 'ctdb') diff --git a/ctdb/tests/onnode/0010.sh b/ctdb/tests/onnode/0010.sh new file mode 100755 index 00000000000..241cf58aa69 --- /dev/null +++ b/ctdb/tests/onnode/0010.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +cmd="$ONNODE 4 hostname" + +define_test "$cmd" "invalid pnn 4" + +required_result 1 <