--- /dev/null
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "list nodes via command"
+
+cat > "${CTDB_BASE}/ctdb.conf" <<EOF
+[cluster]
+ nodes list = !${CTDB_BASE}/nodes.sh
+EOF
+test_cleanup rm -rf "${CTDB_BASE}/ctdb.conf"
+
+cat > "${CTDB_BASE}/nodes.sh" <<EOF
+#!/bin/sh
+for x in 41 42 43; do
+ echo 192.168.20.\$x
+done
+EOF
+test_cleanup rm -rf "${CTDB_BASE}/nodes.sh"
+chmod +x "${CTDB_BASE}/nodes.sh"
+
+required_result 0 <<EOF
+192.168.20.41
+192.168.20.42
+192.168.20.43
+EOF
+
+simple_test
--- /dev/null
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "list nodes command fails"
+
+cat > "${CTDB_BASE}/ctdb.conf" <<EOF
+[cluster]
+ nodes list = !${CTDB_BASE}/nodes.sh
+EOF
+test_cleanup rm -rf "${CTDB_BASE}/ctdb.conf"
+
+cat > "${CTDB_BASE}/nodes.sh" <<EOF
+#!/bin/sh
+echo "error: foo" >&2
+exit 1
+EOF
+test_cleanup rm -rf "${CTDB_BASE}/nodes.sh"
+chmod +x "${CTDB_BASE}/nodes.sh"
+
+
+f="${CTDB_BASE}/nodes.sh"
+
+required_result 1 <<EOF
+error: foo
+${TEST_DATE_STAMP}Failed to read nodes from "!${f}"
+EOF
+
+simple_test
--- /dev/null
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "list nodes command invalid"
+
+cat > "${CTDB_BASE}/ctdb.conf" <<EOF
+[cluster]
+ nodes list = !${CTDB_BASE}/nodes.sh
+EOF
+test_cleanup rm -rf "${CTDB_BASE}/ctdb.conf"
+
+
+f="${CTDB_BASE}/nodes.sh"
+
+required_result 1 <<EOF
+sys_popenv: ERROR executing command '${f}': No such file or directory
+${TEST_DATE_STAMP}Failed to read nodes from "!${f}"
+EOF
+
+simple_test
--- /dev/null
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "list nodes command with bad output"
+
+cat > "${CTDB_BASE}/ctdb.conf" <<EOF
+[cluster]
+ nodes list = !${CTDB_BASE}/nodes.sh
+EOF
+test_cleanup rm -rf "${CTDB_BASE}/ctdb.conf"
+
+# ctdb certainly doesn't understand xml
+cat > "${CTDB_BASE}/nodes.sh" <<EOF
+#!/bin/sh
+echo "<nodes>"
+echo "<node id="0" name="192.168.20.41" />"
+echo "<node id="1" name="192.168.20.42" />"
+echo "</nodes>"
+EOF
+test_cleanup rm -rf "${CTDB_BASE}/nodes.sh"
+chmod +x "${CTDB_BASE}/nodes.sh"
+
+
+f="${CTDB_BASE}/nodes.sh"
+
+required_result 1 <<EOF
+Invalid node address <nodes>
+${TEST_DATE_STAMP}Failed to read nodes from "!${f}"
+EOF
+
+simple_test
--- /dev/null
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "list nodes command valid output, but script still fails"
+
+cat > "${CTDB_BASE}/ctdb.conf" <<EOF
+[cluster]
+ nodes list = !${CTDB_BASE}/nodes.sh
+EOF
+test_cleanup rm -rf "${CTDB_BASE}/ctdb.conf"
+
+cat > "${CTDB_BASE}/nodes.sh" <<EOF
+#!/bin/sh
+for x in 41 42 43; do
+ echo 192.168.20.\$x
+done
+exit 2
+EOF
+test_cleanup rm -rf "${CTDB_BASE}/nodes.sh"
+chmod +x "${CTDB_BASE}/nodes.sh"
+
+
+f="${CTDB_BASE}/nodes.sh"
+
+required_result 0 <<EOF
+192.168.20.41
+192.168.20.42
+192.168.20.43
+EOF
+
+simple_test
--- /dev/null
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "list nodes command with argument"
+
+cat > "${CTDB_BASE}/ctdb.conf" <<EOF
+[cluster]
+ nodes list = !/usr/bin/printf %s\\n%s\\n 192.168.20.41 192.168.20.42
+EOF
+test_cleanup rm -rf "${CTDB_BASE}/ctdb.conf"
+
+required_result 0 <<EOF
+192.168.20.41
+192.168.20.42
+EOF
+
+simple_test