From 6c5f7c0003ccbf99a00b8ec12b52e0ea97521f83 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Tue, 13 Feb 2018 06:55:35 +1100 Subject: [PATCH] ctdb-tests: Remove unused functions and stubs Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/tests/eventscripts/scripts/local.sh | 52 ----------- ctdb/tests/eventscripts/stubs/netstat | 109 ----------------------- ctdb/tests/eventscripts/stubs/nmap | 75 ---------------- 3 files changed, 236 deletions(-) delete mode 100755 ctdb/tests/eventscripts/stubs/netstat delete mode 100755 ctdb/tests/eventscripts/stubs/nmap diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh index 472f5c500d5..7823b1f1e56 100644 --- a/ctdb/tests/eventscripts/scripts/local.sh +++ b/ctdb/tests/eventscripts/scripts/local.sh @@ -85,13 +85,6 @@ setup_date () export FAKE_DATE_OUTPUT="$1" } -setup_generic () -{ - setup_shares - setup_dbdir - setup_date -} - setup_tcp_listen () { export FAKE_TCP_LISTEN="$*" @@ -246,17 +239,6 @@ ipv4_host_addr_to_net () # CTDB fakery -# Evaluate an expression that probably calls functions or uses -# variables from the CTDB functions file. This is used for test -# initialisation. -eventscript_call () -{ - ( - . "$CTDB_BASE/functions" - "$@" - ) -} - setup_numnodes () { export FAKE_CTDB_NUMNODES="${1:-3}" @@ -299,22 +281,6 @@ ctdb_set_pnn () mkdir -p "$CTDB_SCRIPT_VARDIR" } -setup_ctdb () -{ - setup_generic - - setup_public_addresses -} - -validate_percentage () -{ - case "$1" in - [0-9]|[0-9][0-9]|100) return 0 ;; - *) echo "WARNING: ${1} is an invalid percentage${2:+\" in }${2}${2:+\"}" - return 1 - esac -} - ctdb_get_interfaces () { # The echo/subshell forces all the output onto 1 line. @@ -363,13 +329,6 @@ ctdb_get_1_public_address () ctdb_get_my_public_addresses | { head -n 1 ; cat >/dev/null ; } } -ctdb_not_implemented () -{ - export CTDB_NOT_IMPLEMENTED="$1" - ctdb_not_implemented="\ -DEBUG: ctdb: command \"$1\" not implemented in stub" -} - # Check the routes against those that are expected. $1 is the number # of assigned IPs to use (, all), defaulting to 1. If $2 is # "default" then expect default routes to have been added. @@ -416,17 +375,6 @@ EOF ###################################################################### -setup_nfs_ganesha () -{ - setup_nfs "$@" - export CTDB_NFS_CALLOUT="${CTDB_BASE}/nfs-ganesha-callout" - if [ "$1" != "down" ] ; then - export CTDB_MANAGES_NFS="yes" - fi - - export CTDB_NFS_SKIP_SHARE_CHECK="yes" -} - nfs_load_config () { diff --git a/ctdb/tests/eventscripts/stubs/netstat b/ctdb/tests/eventscripts/stubs/netstat deleted file mode 100755 index bd542bb09f7..00000000000 --- a/ctdb/tests/eventscripts/stubs/netstat +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash - -prog="netstat" - -# Pretty that we're the shell and that this command could not be -# found. -if [ "$FAKE_NETSTAT_NOT_FOUND" = "yes" ] ; then - echo "sh: ${prog}: command not found" >&2 - exit 127 -fi - -usage () -{ - cat >&2 <&2 - exit 127 -fi - -usage () -{ - cat >&2 <[, ...] - -A fake nmap stub that prints items depending on the variable -FAKE_TCP_LISTEN and the ports specified. - -Note that all options apart from -p are ignored. - -EOF - exit 1 -} - -ports="" - -parse_options () -{ - _temp=$(getopt -n "$prog" -a -o "np:" -l help -l PS: -l oG: -- "$@") - - [ $? != 0 ] && usage - - eval set -- "$_temp" - - while true ; do - case "$1" in - -n) shift ;; - --oG|--PS) shift 2 ;; - -p) ports="${ports}${ports:+ }${2//,/ }" ; shift 2 ;; - --) shift ; break ;; - -h|--help|*) usage ;; # * shouldn't happen, so this is reasonable. - esac - done - - [ $# -gt 0 ] && usage - - [ -n "$ports" ] || usage -} - -# For printing out... -args="$*" - -parse_options "$@" - -port_states="" - -for p in $ports ; do - pn=$(getent services "$p" | sed -e 's@[[:space:]].*@@') - for i in $FAKE_TCP_LISTEN ; do - lp="${i##*:}" - if [ "$p" = "$lp" ] ; then - port_states="${port_states}${port_states:+, }${p}/open/tcp//${pn}///" - continue 2 - fi - done - port_states="${port_states}${port_states:+, }${p}/closed/tcp//${pn}///" -done - -cat <