Просмотр исходного кода

fix(travis): add various fixes to travis tests (#2827)

Daniel Gibbs 6 лет назад
Родитель
Сommit
b88f8d2981

+ 1 - 1
lgsm/functions/command_backup.sh

@@ -30,7 +30,7 @@ fn_backup_trap(){
 fn_backup_check_lockfile(){
 	if [ -f "${lockdir}/.backup.lock" ]; then
 		fn_print_info_nl "Lock file found: Backup is currently running"
-		fn_script_log_error "Lock file found: Backup is currently running: ${tmpdir}/.backup.lock"
+		fn_script_log_error "Lock file found: Backup is currently running: ${lockdir}/.backup.lock"
 		core_exit.sh
 	fi
 }

+ 4 - 4
lgsm/functions/command_monitor.sh

@@ -12,7 +12,7 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 fn_monitor_check_lockfile(){
 	# Monitor does not run it lockfile is not found.
-	if [ ! -f "${rootdir}/${lockselfname}" ]; then
+	if [ ! -f "${lockdir}/${selfname}.lock" ]; then
 		fn_print_dots "Checking lockfile: "
 		fn_print_checking_eol
 		fn_script_log_info "Checking lockfile: CHECKING"
@@ -26,8 +26,8 @@ fn_monitor_check_lockfile(){
 	fi
 
 	# Fix if lockfile is not unix time or contains letters
-	if [[ "$(cat "${rootdir}/${lockselfname}")" =~ [A-Za-z] ]]; then
-			date '+%s' > "${rootdir}/${lockselfname}"
+	if [[ "$(cat "${lockdir}/${selfname}.lock")" =~ [A-Za-z] ]]; then
+			date '+%s' > "${lockdir}/${selfname}.lock"
 	fi
 }
 
@@ -108,7 +108,7 @@ for queryattempt in {1..5}; do
 	fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : QUERYING"
 	fn_sleep_time
 	# querydelay
-	if [ "$(cat "${rootdir}/${lockselfname}")" -gt "$(date "+%s" -d "${querydelay} mins ago")" ]; then
+	if [ "$(cat "${lockdir}/${selfname}.lock")" -gt "$(date "+%s" -d "${querydelay} mins ago")" ]; then
 		fn_print_ok "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: "
 		fn_print_delay_eol_nl
 		fn_script_log_info "Querying port: ${querymethod}: ${ip}:${queryport} : ${queryattempt} : DELAY"

+ 114 - 22
tests/tests_fctrserver.sh

@@ -41,14 +41,17 @@ configdirserver="${configdir}/${gameservername}"
 configdirdefault="${lgsmdir}/config-default"
 userinput="${1}"
 
-# Allows for testing not on Travis CI
-if [ ! -v TRAVIS ]; then
+# Allows for testing not on Travis CI.
+# if using travis for tests
+if [ -n "${TRAVIS}" ]; then
+	selfname="travis"
+# if not using travis for tests
+else
 	TRAVIS_BRANCH="develop"
 	TRAVIS_BUILD_DIR="${rootdir}"
-else
-	selfname="travis"
-	travistest="1"
+
 fi
+travistest="1"
 
 ## GitHub Branch Select
 # Allows for the use of different function files
@@ -353,19 +356,24 @@ else
 				fi
 			fi
 		fi
+		# shellcheck source=/dev/null
 		source "${configdirserver}/_default.cfg"
 		# Load the common.cfg config. If missing download it.
 		if [ ! -f "${configdirserver}/common.cfg" ]; then
 			fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
 			source "${configdirserver}/common.cfg"
 		else
+			# shellcheck source=/dev/null
 			source "${configdirserver}/common.cfg"
 		fi
 		# Load the instance.cfg config. If missing download it.
 		if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then
 			fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
 			source "${configdirserver}/${selfname}.cfg"
 		else
+			# shellcheck source=/dev/null
 			source "${configdirserver}/${selfname}.cfg"
 		fi
 
@@ -377,7 +385,7 @@ else
 	# Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off.
 	fn_ansi_loader
 	# Prevents running of core_exit.sh for Travis-CI.
-	if [ -z "${travistest}" ]; then
+	if [ "${travistest}" != "1" ]; then
 		getopt=$1
 		core_getopt.sh
 	fi
@@ -392,15 +400,6 @@ fn_currentstatus_tmux(){
 	fi
 }
 
-fn_currentstatus_ts3(){
-	check_status.sh
-	if [ "${status}" != "0" ]; then
-		currentstatus="ONLINE"
-	else
-		currentstatus="OFFLINE"
-	fi
-}
-
 fn_setstatus(){
 	fn_currentstatus_tmux
 	echo""
@@ -490,10 +489,61 @@ echo -e ""
 echo -e "================================="
 echo -e "Server Tests"
 echo -e "Using: ${gamename}"
-echo -e "Testing Branch: $TRAVIS_BRANCH"
+echo -e "Testing Branch: ${TRAVIS_BRANCH}"
 echo -e "================================="
 
 echo -e ""
+echo -e "Tests Summary"
+echo -e "================================="
+echo -e "0.0 - Pre-test Tasks"
+echo -e "0.1 - Create log dir's"
+echo -e "0.2 - Enable dev-debug"
+echo -e ""
+echo -e "1.0 - Pre-install tests"
+echo -e "1.1 - start - no files"
+echo -e "1.2 - getopt"
+echo -e "1.3 - getopt with incorrect args"
+echo -e ""
+echo -e "2.0 - Installation"
+echo -e "2.1 - install"
+echo -e ""
+echo -e "3.0 - Start/Stop/Restart Tests"
+echo -e "3.1 - start"
+echo -e "3.2 - start - online"
+echo -e "3.3 - start - updateonstart"
+echo -e "3.4 - stop"
+echo -e "3.5 - stop - offline"
+echo -e "3.6 - restart"
+echo -e "3.7 - restart - offline"
+echo -e ""
+echo -e "4.0 - Update Tests"
+echo -e "4.1 - update"
+echo -e "4.2 - update-lgsm"
+echo -e ""
+echo -e "5.0 - Monitor Tests"
+echo -e "5.1 - monitor - online"
+echo -e "5.2 - monitor - offline - with lockfile"
+echo -e "5.3 - monitor - offline - no lockfile"
+echo -e "5.4 - test-alert"
+echo -e ""
+echo -e "6.0 - Details Tests"
+echo -e "6.1 - details"
+echo -e "6.2 - postdetails"
+echo -e ""
+echo -e "7.0 - Backup Tests"
+echo -e "7.1 - backup"
+echo -e ""
+echo -e "8.0 - Development Tools Tests"
+echo -e "8.1 - dev - detect glibc"
+echo -e "8.2 - dev - detect ldd"
+echo -e "8.3 - dev - detect deps"
+echo -e "8.4 - dev - query-raw"
+
+echo -e ""
+echo -e "9.0 - Donate"
+echo -e "9.1 - donate"
+echo -e ""
+
 echo -e "0.0 - Pre-test Tasks"
 echo -e "=================================================================="
 echo -e "Description:"
@@ -543,7 +593,7 @@ echo -e "test script reaction to missing server files."
 echo -e "Command: ./${gameservername} start"
 echo -e ""
 # Allows for testing not on Travis CI
-if [ ! -v TRAVIS ]; then
+if [ -z "${TRAVIS}" ]; then
 (
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
 	BASH_XTRACEFD="5"
@@ -601,7 +651,7 @@ echo -e "2.0 - Installation"
 echo -e "=================================================================="
 
 echo -e ""
-echo -e "2.0 - install"
+echo -e "2.1 - install"
 echo -e "================================="
 echo -e "Description:"
 echo -e "install ${gamename} server."
@@ -777,10 +827,31 @@ echo -e "run order"
 echo -e "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo -e ""
+echo -e "4.2 - update-lgsm"
+echo -e "================================="
+echo -e "Description:"
+echo -e "update LinuxGSM."
+echo -e ""
+echo -e "Command: ./jc2server update-lgam"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+	BASH_XTRACEFD="5"
+	set -x
+	command_update_linuxgsm.sh
+)
+fn_test_result_pass
+echo -e "run order"
+echo -e "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
 echo -e ""
 echo -e "5.0 - Monitor Tests"
 echo -e "=================================================================="
 echo -e ""
+info_config.sh
 echo -e "Server IP - Port: ${ip}:${port}"
 echo -e "Server IP - Query Port: ${ip}:${queryport}"
 
@@ -1003,6 +1074,30 @@ echo -e "run order"
 echo -e "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo -e ""
+
+echo -e "9.0 - Donate"
+echo -e "=================================================================="
+
+echo -e ""
+echo -e "9.1 - donate"
+echo -e "================================="
+echo -e "Description:"
+echo -e "donate."
+echo -e "Command: ./${gameservername} donate"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+	BASH_XTRACEFD="5"
+	set -x
+	command_donate.sh
+)
+fn_test_result_pass
+echo -e "run order"
+echo -e "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
 echo -e ""
 echo -e "================================="
 echo -e "Server Tests - Complete!"
@@ -1010,8 +1105,5 @@ echo -e "Using: ${gamename}"
 echo -e "================================="
 requiredstatus="OFFLINE"
 fn_setstatus
-if [ ! -v TRAVIS ]; then
-	fn_print_info "Tidying up directories."
-	rm -rfv "${serverfiles:?}"
-fi
+
 core_exit.sh

+ 116 - 24
tests/tests_jc2server.sh

@@ -41,14 +41,16 @@ configdirserver="${configdir}/${gameservername}"
 configdirdefault="${lgsmdir}/config-default"
 userinput="${1}"
 
-# Allows for testing not on Travis CI
-if [ ! -v TRAVIS ]; then
+# Allows for testing not on Travis CI.
+# if using travis for tests
+if [ -n "${TRAVIS}" ]; then
+	selfname="travis"
+# if not using travis for tests
+else
 	TRAVIS_BRANCH="develop"
 	TRAVIS_BUILD_DIR="${rootdir}"
-else
-	selfname="travis"
-	travistest="1"
 fi
+travistest="1"
 
 ## GitHub Branch Select
 # Allows for the use of different function files
@@ -242,7 +244,7 @@ fn_install_file(){
 	if [ -e "${local_filename}" ]; then
 		i=2
 	while [ -e "${local_filename}-${i}" ] ; do
-		let i++
+		(( i++ ))
 	done
 		local_filename="${local_filename}-${i}"
 	fi
@@ -353,19 +355,24 @@ else
 				fi
 			fi
 		fi
+		# shellcheck source=/dev/null
 		source "${configdirserver}/_default.cfg"
 		# Load the common.cfg config. If missing download it.
 		if [ ! -f "${configdirserver}/common.cfg" ]; then
 			fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
 			source "${configdirserver}/common.cfg"
 		else
+			# shellcheck source=/dev/null
 			source "${configdirserver}/common.cfg"
 		fi
 		# Load the instance.cfg config. If missing download it.
 		if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then
 			fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
 			source "${configdirserver}/${selfname}.cfg"
 		else
+			# shellcheck source=/dev/null
 			source "${configdirserver}/${selfname}.cfg"
 		fi
 
@@ -377,7 +384,7 @@ else
 	# Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off.
 	fn_ansi_loader
 	# Prevents running of core_exit.sh for Travis-CI.
-	if [ -z "${travistest}" ]; then
+	if [ "${travistest}" != "1" ]; then
 		getopt=$1
 		core_getopt.sh
 	fi
@@ -392,15 +399,6 @@ fn_currentstatus_tmux(){
 	fi
 }
 
-fn_currentstatus_ts3(){
-	check_status.sh
-	if [ "${status}" != "0" ]; then
-		currentstatus="ONLINE"
-	else
-		currentstatus="OFFLINE"
-	fi
-}
-
 fn_setstatus(){
 	fn_currentstatus_tmux
 	echo""
@@ -490,9 +488,64 @@ echo -e ""
 echo -e "================================="
 echo -e "Server Tests"
 echo -e "Using: ${gamename}"
-echo -e "Testing Branch: $TRAVIS_BRANCH"
+echo -e "Testing Branch: ${TRAVIS_BRANCH}"
 echo -e "================================="
-
+echo -e ""
+echo -e "Tests Summary"
+echo -e "================================="
+echo -e "0.0 - Pre-test Tasks"
+echo -e "0.1 - Create log dir's"
+echo -e "0.2 - Enable dev-debug"
+echo -e ""
+echo -e "1.0 - Pre-install tests"
+echo -e "1.1 - start - no files"
+echo -e "1.2 - getopt"
+echo -e "1.3 - getopt with incorrect args"
+echo -e ""
+echo -e "2.0 - Installation"
+echo -e "2.1 - install"
+echo -e ""
+echo -e "3.0 - Start/Stop/Restart Tests"
+echo -e "3.1 - start"
+echo -e "3.2 - start - online"
+echo -e "3.3 - start - updateonstart"
+echo -e "3.4 - stop"
+echo -e "3.5 - stop - offline"
+echo -e "3.6 - restart"
+echo -e "3.7 - restart - offline"
+echo -e ""
+echo -e "4.0 - Update Tests"
+echo -e "4.1 - update"
+echo -e "4.2 - update  - change buildid"
+echo -e "4.3 - update  - change buildid - online"
+echo -e "4.4 - update  - remove appmanifest file"
+echo -e "4.5 - force-update"
+echo -e "4.6 - force-update - online"
+echo -e "4.7 - validate"
+echo -e "4.8 - validate - online"
+echo -e "4.9 - update-lgsm"
+echo -e ""
+echo -e "5.0 - Monitor Tests"
+echo -e "5.1 - monitor - online"
+echo -e "5.2 - monitor - offline - with lockfile"
+echo -e "5.3 - monitor - offline - no lockfile"
+echo -e "5.4 - test-alert"
+echo -e ""
+echo -e "6.0 - Details Tests"
+echo -e "6.1 - details"
+echo -e "6.2 - postdetails"
+echo -e ""
+echo -e "7.0 - Backup Tests"
+echo -e "7.1 - backup"
+echo -e ""
+echo -e "8.0 - Development Tools Tests"
+echo -e "8.1 - dev - detect glibc"
+echo -e "8.2 - dev - detect ldd"
+echo -e "8.3 - dev - detect deps"
+echo -e "8.4 - dev - query-raw"
+echo -e ""
+echo -e "9.0 - Donate"
+echo -e "9.1 - donate"
 echo -e ""
 echo -e "0.0 - Pre-test Tasks"
 echo -e "=================================================================="
@@ -543,7 +596,7 @@ echo -e "test script reaction to missing server files."
 echo -e "Command: ./${gameservername} start"
 echo -e ""
 # Allows for testing not on Travis CI
-if [ ! -v TRAVIS ]; then
+if [ -z "${TRAVIS}" ]; then
 (
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
 	BASH_XTRACEFD="5"
@@ -601,7 +654,7 @@ echo -e "2.0 - Installation"
 echo -e "=================================================================="
 
 echo -e ""
-echo -e "2.0 - install"
+echo -e "2.1 - install"
 echo -e "================================="
 echo -e "Description:"
 echo -e "install ${gamename} server."
@@ -917,6 +970,26 @@ echo -e "run order"
 echo -e "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo -e ""
+echo -e "4.9 - update-lgsm"
+echo -e "================================="
+echo -e "Description:"
+echo -e "update LinuxGSM."
+echo -e ""
+echo -e "Command: ./jc2server update-lgam"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+	BASH_XTRACEFD="5"
+	set -x
+	command_update_linuxgsm.sh
+)
+fn_test_result_pass
+echo -e "run order"
+echo -e "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
 echo -e ""
 echo -e "Inserting IP address"
 echo -e "================================="
@@ -1165,6 +1238,29 @@ echo -e "run order"
 echo -e "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo -e ""
+echo -e "9.0 - Donate"
+echo -e "=================================================================="
+
+echo -e ""
+echo -e "9.1 - donate"
+echo -e "================================="
+echo -e "Description:"
+echo -e "donate."
+echo -e "Command: ./${gameservername} donate"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+	BASH_XTRACEFD="5"
+	set -x
+	command_donate.sh
+)
+fn_test_result_pass
+echo -e "run order"
+echo -e "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
 echo -e ""
 echo -e "================================="
 echo -e "Server Tests - Complete!"
@@ -1172,8 +1268,4 @@ echo -e "Using: ${gamename}"
 echo -e "================================="
 requiredstatus="OFFLINE"
 fn_setstatus
-if [ ! -v TRAVIS ]; then
-	fn_print_info "Tidying up directories."
-	rm -rfv "${serverfiles:?}"
-fi
 core_exit.sh

+ 112 - 23
tests/tests_mcserver.sh

@@ -41,14 +41,17 @@ configdirserver="${configdir}/${gameservername}"
 configdirdefault="${lgsmdir}/config-default"
 userinput="${1}"
 
-# Allows for testing not on Travis CI
-if [ ! -v TRAVIS ]; then
+# Allows for testing not on Travis CI.
+# if using travis for tests
+if [ -n "${TRAVIS}" ]; then
+	selfname="travis"
+# if not using travis for tests
+else
 	TRAVIS_BRANCH="develop"
 	TRAVIS_BUILD_DIR="${rootdir}"
-else
-	selfname="travis"
-	travistest="1"
+
 fi
+travistest="1"
 
 ## GitHub Branch Select
 # Allows for the use of different function files
@@ -242,7 +245,7 @@ fn_install_file(){
 	if [ -e "${local_filename}" ]; then
 		i=2
 	while [ -e "${local_filename}-${i}" ] ; do
-		let i++
+		(( i++ ))
 	done
 		local_filename="${local_filename}-${i}"
 	fi
@@ -353,19 +356,24 @@ else
 				fi
 			fi
 		fi
+		# shellcheck source=/dev/null
 		source "${configdirserver}/_default.cfg"
 		# Load the common.cfg config. If missing download it.
 		if [ ! -f "${configdirserver}/common.cfg" ]; then
 			fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
 			source "${configdirserver}/common.cfg"
 		else
+			# shellcheck source=/dev/null
 			source "${configdirserver}/common.cfg"
 		fi
 		# Load the instance.cfg config. If missing download it.
 		if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then
 			fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
 			source "${configdirserver}/${selfname}.cfg"
 		else
+			# shellcheck source=/dev/null
 			source "${configdirserver}/${selfname}.cfg"
 		fi
 
@@ -377,7 +385,7 @@ else
 	# Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off.
 	fn_ansi_loader
 	# Prevents running of core_exit.sh for Travis-CI.
-	if [ -z "${travistest}" ]; then
+	if [ "${travistest}" != "1" ]; then
 		getopt=$1
 		core_getopt.sh
 	fi
@@ -392,15 +400,6 @@ fn_currentstatus_tmux(){
 	fi
 }
 
-fn_currentstatus_ts3(){
-	check_status.sh
-	if [ "${status}" != "0" ]; then
-		currentstatus="ONLINE"
-	else
-		currentstatus="OFFLINE"
-	fi
-}
-
 fn_setstatus(){
 	fn_currentstatus_tmux
 	echo""
@@ -490,8 +489,57 @@ echo -e ""
 echo -e "================================="
 echo -e "Server Tests"
 echo -e "Using: ${gamename}"
-echo -e "Testing Branch: $TRAVIS_BRANCH"
+echo -e "Testing Branch: ${TRAVIS_BRANCH}"
+echo -e "================================="
+echo -e ""
+echo -e "Tests Summary"
 echo -e "================================="
+echo -e "0.0 - Pre-test Tasks"
+echo -e "0.1 - Create log dir's"
+echo -e "0.2 - Enable dev-debug"
+echo -e ""
+echo -e "1.0 - Pre-install tests"
+echo -e "1.1 - start - no files"
+echo -e "1.2 - getopt"
+echo -e "1.3 - getopt with incorrect args"
+echo -e ""
+echo -e "2.0 - Installation"
+echo -e "2.1 - install"
+echo -e ""
+echo -e "3.0 - Start/Stop/Restart Tests"
+echo -e "3.1 - start"
+echo -e "3.2 - start - online"
+echo -e "3.3 - start - updateonstart"
+echo -e "3.4 - stop"
+echo -e "3.5 - stop - offline"
+echo -e "3.6 - restart"
+echo -e "3.7 - restart - offline"
+echo -e ""
+echo -e "4.0 - Update Tests"
+echo -e "4.1 - update"
+echo -e "4.2 - update-lgsm"
+echo -e ""
+echo -e "5.0 - Monitor Tests"
+echo -e "5.1 - monitor - online"
+echo -e "5.2 - monitor - offline - with lockfile"
+echo -e "5.3 - monitor - offline - no lockfile"
+echo -e "5.4 - test-alert"
+echo -e ""
+echo -e "6.0 - Details Tests"
+echo -e "6.1 - details"
+echo -e "6.2 - postdetails"
+echo -e ""
+echo -e "7.0 - Backup Tests"
+echo -e "7.1 - backup"
+echo -e ""
+echo -e "8.0 - Development Tools Tests"
+echo -e "8.1 - dev - detect glibc"
+echo -e "8.2 - dev - detect ldd"
+echo -e "8.3 - dev - detect deps"
+echo -e "8.4 - dev - query-raw"
+echo -e ""
+echo -e "9.0 - Donate"
+echo -e "9.1 - donate"
 
 echo -e ""
 echo -e "0.0 - Pre-test Tasks"
@@ -543,7 +591,7 @@ echo -e "test script reaction to missing server files."
 echo -e "Command: ./${gameservername} start"
 echo -e ""
 # Allows for testing not on Travis CI
-if [ ! -v TRAVIS ]; then
+if [ -z "${TRAVIS}" ]; then
 (
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
 	BASH_XTRACEFD="5"
@@ -601,7 +649,7 @@ echo -e "2.0 - Installation"
 echo -e "=================================================================="
 
 echo -e ""
-echo -e "2.0 - install"
+echo -e "2.1 - install"
 echo -e "================================="
 echo -e "Description:"
 echo -e "install ${gamename} server."
@@ -786,6 +834,26 @@ echo -e "run order"
 echo -e "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo -e ""
+echo -e "4.2 - update-lgsm"
+echo -e "================================="
+echo -e "Description:"
+echo -e "update LinuxGSM."
+echo -e ""
+echo -e "Command: ./jc2server update-lgam"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+	BASH_XTRACEFD="5"
+	set -x
+	command_update_linuxgsm.sh
+)
+fn_test_result_pass
+echo -e "run order"
+echo -e "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
 echo -e ""
 echo -e "Inserting IP address"
 echo -e "================================="
@@ -804,6 +872,7 @@ echo -e ""
 echo -e "5.0 - Monitor Tests"
 echo -e "=================================================================="
 echo -e ""
+info_config.sh
 echo -e "Server IP - Port: ${ip}:${port}"
 echo -e "Server IP - Query Port: ${ip}:${queryport}"
 
@@ -1050,6 +1119,29 @@ echo -e "run order"
 echo -e "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo -e ""
+echo -e "9.0 - Donate"
+echo -e "=================================================================="
+
+echo -e ""
+echo -e "9.1 - donate"
+echo -e "================================="
+echo -e "Description:"
+echo -e "donate."
+echo -e "Command: ./${gameservername} donate"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+	BASH_XTRACEFD="5"
+	set -x
+	command_donate.sh
+)
+fn_test_result_pass
+echo -e "run order"
+echo -e "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
 echo -e ""
 echo -e "================================="
 echo -e "Server Tests - Complete!"
@@ -1057,8 +1149,5 @@ echo -e "Using: ${gamename}"
 echo -e "================================="
 requiredstatus="OFFLINE"
 fn_setstatus
-if [ ! -v TRAVIS ]; then
-	fn_print_info "Tidying up directories."
-	rm -rfv "${serverfiles:?}"
-fi
+
 core_exit.sh

+ 113 - 24
tests/tests_ts3server.sh

@@ -41,14 +41,17 @@ configdirserver="${configdir}/${gameservername}"
 configdirdefault="${lgsmdir}/config-default"
 userinput="${1}"
 
-# Allows for testing not on Travis CI
-if [ ! -v TRAVIS ]; then
+# Allows for testing not on Travis CI.
+# if using travis for tests
+if [ -n "${TRAVIS}" ]; then
+	selfname="travis"
+# if not using travis for tests
+else
 	TRAVIS_BRANCH="develop"
 	TRAVIS_BUILD_DIR="${rootdir}"
-else
-	selfname="travis"
-	travistest="1"
+
 fi
+travistest="1"
 
 ## GitHub Branch Select
 # Allows for the use of different function files
@@ -353,19 +356,24 @@ else
 				fi
 			fi
 		fi
+		# shellcheck source=/dev/null
 		source "${configdirserver}/_default.cfg"
 		# Load the common.cfg config. If missing download it.
 		if [ ! -f "${configdirserver}/common.cfg" ]; then
 			fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
 			source "${configdirserver}/common.cfg"
 		else
+			# shellcheck source=/dev/null
 			source "${configdirserver}/common.cfg"
 		fi
 		# Load the instance.cfg config. If missing download it.
 		if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then
 			fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
 			source "${configdirserver}/${selfname}.cfg"
 		else
+			# shellcheck source=/dev/null
 			source "${configdirserver}/${selfname}.cfg"
 		fi
 
@@ -377,7 +385,7 @@ else
 	# Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off.
 	fn_ansi_loader
 	# Prevents running of core_exit.sh for Travis-CI.
-	if [ -z "${travistest}" ]; then
+	if [ "${travistest}" != "1" ]; then
 		getopt=$1
 		core_getopt.sh
 	fi
@@ -392,24 +400,15 @@ fn_currentstatus_tmux(){
 	fi
 }
 
-fn_currentstatus_ts3(){
-	check_status.sh
-	if [ "${status}" != "0" ]; then
-		currentstatus="ONLINE"
-	else
-		currentstatus="OFFLINE"
-	fi
-}
-
 fn_setstatus(){
-	fn_currentstatus_ts3
+	fn_currentstatus_tmux
 	echo""
 	echo -e "Required status: ${requiredstatus}"
 	counter=0
 	echo -e "Current status:  ${currentstatus}"
 	while [  "${requiredstatus}" != "${currentstatus}" ]; do
 		counter=$((counter+1))
-		fn_currentstatus_ts3
+		fn_currentstatus_tmux
 		echo -en "New status:  ${currentstatus}\\r"
 
 		if [ "${requiredstatus}" == "ONLINE" ]; then
@@ -490,9 +489,58 @@ echo -e ""
 echo -e "================================="
 echo -e "Server Tests"
 echo -e "Using: ${gamename}"
-echo -e "Testing Branch: $TRAVIS_BRANCH"
+echo -e "Testing Branch: ${TRAVIS_BRANCH}"
 echo -e "================================="
 
+echo -e ""
+echo -e "Tests Summary"
+echo -e "================================="
+echo -e "0.0 - Pre-test Tasks"
+echo -e "0.1 - Create log dir's"
+echo -e "0.2 - Enable dev-debug"
+echo -e ""
+echo -e "1.0 - Pre-install tests"
+echo -e "1.1 - start - no files"
+echo -e "1.2 - getopt"
+echo -e "1.3 - getopt with incorrect args"
+echo -e ""
+echo -e "2.0 - Installation"
+echo -e "2.1 - install"
+echo -e ""
+echo -e "3.0 - Start/Stop/Restart Tests"
+echo -e "3.1 - start"
+echo -e "3.2 - start - online"
+echo -e "3.3 - start - updateonstart"
+echo -e "3.4 - stop"
+echo -e "3.5 - stop - offline"
+echo -e "3.6 - restart"
+echo -e "3.7 - restart - offline"
+echo -e ""
+echo -e "4.0 - Update Tests"
+echo -e "4.1 - update"
+echo -e "4.2 - update-lgsm"
+echo -e ""
+echo -e "5.0 - Monitor Tests"
+echo -e "5.1 - monitor - online"
+echo -e "5.2 - monitor - offline - with lockfile"
+echo -e "5.3 - monitor - offline - no lockfile"
+echo -e "5.4 - test-alert"
+echo -e ""
+echo -e "6.0 - Details Tests"
+echo -e "6.1 - details"
+echo -e "6.2 - postdetails"
+echo -e ""
+echo -e "7.0 - Backup Tests"
+echo -e "7.1 - backup"
+echo -e ""
+echo -e "8.0 - Development Tools Tests"
+echo -e "8.1 - dev - detect glibc"
+echo -e "8.2 - dev - detect ldd"
+echo -e "8.3 - dev - detect deps"
+echo -e "8.4 - dev - query-raw"
+echo -e ""
+echo -e "9.0 - Donate"
+echo -e "9.1 - donate"
 echo -e ""
 echo -e "0.0 - Pre-test Tasks"
 echo -e "=================================================================="
@@ -543,7 +591,7 @@ echo -e "test script reaction to missing server files."
 echo -e "Command: ./${gameservername} start"
 echo -e ""
 # Allows for testing not on Travis CI
-if [ ! -v TRAVIS ]; then
+if [ -z "${TRAVIS}" ]; then
 (
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
 	BASH_XTRACEFD="5"
@@ -601,7 +649,7 @@ echo -e "2.0 - Installation"
 echo -e "=================================================================="
 
 echo -e ""
-echo -e "2.0 - install"
+echo -e "2.1 - install"
 echo -e "================================="
 echo -e "Description:"
 echo -e "install ${gamename} server."
@@ -777,10 +825,31 @@ echo -e "run order"
 echo -e "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo -e ""
+echo -e "4.2 - update-lgsm"
+echo -e "================================="
+echo -e "Description:"
+echo -e "update LinuxGSM."
+echo -e ""
+echo -e "Command: ./jc2server update-lgam"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+	BASH_XTRACEFD="5"
+	set -x
+	command_update_linuxgsm.sh
+)
+fn_test_result_pass
+echo -e "run order"
+echo -e "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
 echo -e ""
 echo -e "5.0 - Monitor Tests"
 echo -e "=================================================================="
 echo -e ""
+info_config.sh
 echo -e "Server IP - Port: ${ip}:${port}"
 echo -e "Server IP - Query Port: ${ip}:${queryport}"
 
@@ -1003,6 +1072,29 @@ echo -e "run order"
 echo -e "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo -e ""
+echo -e "9.0 - Donate"
+echo -e "=================================================================="
+
+echo -e ""
+echo -e "9.1 - donate"
+echo -e "================================="
+echo -e "Description:"
+echo -e "donate."
+echo -e "Command: ./${gameservername} donate"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+	BASH_XTRACEFD="5"
+	set -x
+	command_donate.sh
+)
+fn_test_result_pass
+echo -e "run order"
+echo -e "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
 echo -e ""
 echo -e "================================="
 echo -e "Server Tests - Complete!"
@@ -1010,8 +1102,5 @@ echo -e "Using: ${gamename}"
 echo -e "================================="
 requiredstatus="OFFLINE"
 fn_setstatus
-if [ ! -v TRAVIS ]; then
-	fn_print_info "Tidying up directories."
-	rm -rfv "${serverfiles:?}"
-fi
+
 core_exit.sh