Do the same with the alternative code for real clusters.
Both of these can now be used by other test suites.
Fix some basic shellcheck warnings (e.g. avoid word-splitting by
quoting) while moving code and add the new files to the shellcheck
test.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
shellcheck_test -s sh \
"${TEST_SCRIPTS_DIR}/common.sh" \
"${TEST_SCRIPTS_DIR}/script_install_paths.sh"
+
+shellcheck_test -s bash \
+ "${TEST_SCRIPTS_DIR}/integration_local_daemons.bash" \
+ "${TEST_SCRIPTS_DIR}/integration_real_cluster.bash"
#######################################
-_service_ctdb ()
-{
- cmd="$1"
-
- if [ -e /etc/redhat-release ] ; then
- service ctdb "$cmd"
- else
- /etc/init.d/ctdb "$cmd"
- fi
-}
-
-# Stop/start CTDB on all nodes. Override for local daemons.
-ctdb_stop_all ()
-{
- onnode -p all $CTDB_TEST_WRAPPER _service_ctdb stop
-}
-ctdb_start_all ()
-{
- onnode -p all $CTDB_TEST_WRAPPER _service_ctdb start
-}
-
-setup_ctdb ()
-{
- ctdb_enable_cluster_test_event_scripts
-}
-
-start_ctdb_1 ()
-{
- onnode "$1" $CTDB_TEST_WRAPPER _service_ctdb start
-}
-
-stop_ctdb_1 ()
-{
- onnode "$1" $CTDB_TEST_WRAPPER _service_ctdb stop
-}
-
-restart_ctdb_1 ()
-{
- onnode "$1" $CTDB_TEST_WRAPPER _service_ctdb restart
-}
-
ctdb_init ()
{
local i
db_ctdb_tstore $1 "$2" "$_key" "$_value"
}
-#######################################
-
-# Enables all of the event scripts used in cluster tests, except for
-# the mandatory scripts
-ctdb_enable_cluster_test_event_scripts ()
-{
- local scripts="
- 06.nfs
- 10.interface
- 49.winbind
- 50.samba
- 60.nfs
- "
-
- local s
- for s in $scripts ; do
- try_command_on_node all ctdb event script enable legacy "$s"
- done
-}
-
########################################
# Make sure that $CTDB is set.
: ${CTDB:=ctdb}
+if [ -z "$TEST_LOCAL_DAEMONS" ] ; then
+ . "${TEST_SCRIPTS_DIR}/integration_real_cluster.bash"
+else
+ . "${TEST_SCRIPTS_DIR}/integration_local_daemons.bash"
+fi
+
+
local="${CTDB_TEST_SUITE_DIR}/scripts/local.bash"
if [ -r "$local" ] ; then
. "$local"
--- /dev/null
+# Hey Emacs, this is a -*- shell-script -*- !!! :-)
+
+#######################################
+
+# Enables all of the event scripts used in cluster tests, except for
+# the mandatory scripts
+_ctdb_enable_cluster_test_event_scripts ()
+{
+ local scripts="
+ 06.nfs
+ 10.interface
+ 49.winbind
+ 50.samba
+ 60.nfs
+ "
+
+ local s
+ for s in $scripts ; do
+ try_command_on_node all ctdb event script enable legacy "$s"
+ done
+}
+
+setup_ctdb ()
+{
+ _ctdb_enable_cluster_test_event_scripts
+}
+
+#######################################
+
+_service_ctdb ()
+{
+ cmd="$1"
+
+ if [ -e /etc/redhat-release ] ; then
+ service ctdb "$cmd"
+ else
+ /etc/init.d/ctdb "$cmd"
+ fi
+}
+
+# Stop/start CTDB on all nodes. Override for local daemons.
+ctdb_stop_all ()
+{
+ onnode -p all "$CTDB_TEST_WRAPPER" _service_ctdb stop
+}
+ctdb_start_all ()
+{
+ onnode -p all "$CTDB_TEST_WRAPPER" _service_ctdb start
+}
+
+start_ctdb_1 ()
+{
+ onnode "$1" "$CTDB_TEST_WRAPPER" _service_ctdb start
+}
+
+stop_ctdb_1 ()
+{
+ onnode "$1" "$CTDB_TEST_WRAPPER" _service_ctdb stop
+}
+
+restart_ctdb_1 ()
+{
+ onnode "$1" "$CTDB_TEST_WRAPPER" _service_ctdb restart
+}
+++ /dev/null
-if [ -n "$TEST_LOCAL_DAEMONS" ] ; then
- . "${CTDB_TEST_SUITE_DIR}/scripts/local_daemons.bash"
-fi
bld.INSTALL_FILES(bld.env.CTDB_TEST_DATADIR, 'tests/%s' % fmode[0],
destname=fmode[0], chmod=fmode[1])
- # Install tests/scripts directory without test_wrap
+ # Install tests/scripts directory, excluding files that need munging
test_scripts = [
'common.sh',
'integration.bash',
+ 'integration_local_daemons.bash',
+ 'integration_real_cluster.bash',
'unit.sh'
]