Przeglądaj źródła

feat(travici): various improvements to travisci (#2135)

* feat(travis-ci): update ubuntu build
* fix(travisci): remove sources ubuntu-toolchain-r-test
* fix(travisci): re-add ppa:ubuntu-toolchain-r
* fix(travisci): session name no longer contains .sh
* fix(travisci): update all $servicename to use $gameservername
* feat(travisci): test nodejs support
* feat(travisci): add gamedig
* fix(travisci): specify node.js v10
* feat(travisci): add query raw
* feat(travisci): improve test numbering and visual
* feat(travisci): add test result n/a
* feat(travisci): add serverip info to test 5.0 monitor
Daniel Gibbs 7 lat temu
rodzic
commit
c3d2b9c31f
4 zmienionych plików z 338 dodań i 111 usunięć
  1. 6 5
      .travis.yml
  2. 112 33
      tests/tests_fctrserver.sh
  3. 107 39
      tests/tests_jc2server.sh
  4. 113 34
      tests/tests_ts3server.sh

+ 6 - 5
.travis.yml

@@ -1,14 +1,15 @@
 language: bash
-dist: trusty
+dist: xenial
 sudo: required
-
+language: node_js
+node_js:
+  - 10
 before_script:
     - curl -L "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/shunit2/shunit2-2.1.6.tgz" | tar zx
-
+install:
+  npm install gamedig
 addons:
   apt:
-    sources:
-    - ubuntu-toolchain-r-test
     packages:
     - mailutils
     - postfix

+ 112 - 33
tests/tests_fctrserver.sh

@@ -13,7 +13,7 @@ shortname="fctr"
 gameservername="fctrserver"
 rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
 selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
-servicename="${selfname}"
+servicename="${gameservername}"
 lockselfname=".${servicename}.lock"
 lgsmdir="${rootdir}/lgsm"
 logdir="${rootdir}/log"
@@ -467,11 +467,16 @@ echo "Testing Branch: $TRAVIS_BRANCH"
 echo "================================="
 
 echo ""
-echo "0.1 - Create log dir's"
-echo "================================="
+echo "0.0 - Pre-test Tasks"
+echo "=================================================================="
 echo "Description:"
 echo "Create log dir's"
 echo ""
+
+echo ""
+echo "0.1 - Create log dir's"
+echo "================================="
+echo ""
 (
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
 	BASH_XTRACEFD="5"
@@ -500,11 +505,15 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "1.0 - start - no files"
+echo "1.0 - Pre-install tests"
+echo "=================================================================="
+echo ""
+
+echo "1.1 - start - no files"
 echo "================================="
 echo "Description:"
 echo "test script reaction to missing server files."
-echo "Command: ./fctrserver start"
+echo "Command: ./${gameservername} start"
 echo ""
 # Allows for testing not on Travis CI
 if [ ! -v TRAVIS ]; then
@@ -524,11 +533,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "1.1 - getopt"
+echo "1.2 - getopt"
 echo "================================="
 echo "Description:"
 echo "displaying options messages."
-echo "Command: ./fctrserver"
+echo "Command: ./${gameservername}"
 echo ""
 (
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
@@ -542,11 +551,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "1.2 - getopt with incorrect args"
+echo "1.3 - getopt with incorrect args"
 echo "================================="
 echo "Description:"
 echo "displaying options messages."
-echo "Command: ./fctrserver abc123"
+echo "Command: ./${gameservername} abc123"
 echo ""
 getopt="abc123"
 (
@@ -560,12 +569,16 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "2.0 - Instalation"
+echo "=================================================================="
+
 echo ""
 echo "2.0 - install"
 echo "================================="
 echo "Description:"
 echo "install ${gamename} server."
-echo "Command: ./fctrserver auto-install"
+echo "Command: ./${gameservername} auto-install"
 (
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
 	BASH_XTRACEFD="5"
@@ -577,12 +590,16 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "3.0 - Start/Stop/Restart Tests"
+echo "=================================================================="
+
 echo ""
 echo "3.1 - start"
 echo "================================="
 echo "Description:"
 echo "start ${gamename} server."
-echo "Command: ./fctrserver start"
+echo "Command: ./${gameservername} start"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -601,7 +618,7 @@ echo "3.2 - start - online"
 echo "================================="
 echo "Description:"
 echo "start ${gamename} server while already running."
-echo "Command: ./fctrserver start"
+echo "Command: ./${gameservername} start"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -620,7 +637,7 @@ echo "3.3 - start - updateonstart"
 echo "================================="
 echo "Description:"
 echo "will update server on start."
-echo "Command: ./fctrserver start"
+echo "Command: ./${gameservername} start"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -639,7 +656,7 @@ echo "3.4 - stop"
 echo "================================="
 echo "Description:"
 echo "stop ${gamename} server."
-echo "Command: ./fctrserver stop"
+echo "Command: ./${gameservername} stop"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -658,7 +675,7 @@ echo "3.5 - stop - offline"
 echo "================================="
 echo "Description:"
 echo "stop ${gamename} server while already stopped."
-echo "Command: ./fctrserver stop"
+echo "Command: ./${gameservername} stop"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -677,7 +694,7 @@ echo "3.6 - restart"
 echo "================================="
 echo "Description:"
 echo "restart ${gamename}."
-echo "Command: ./fctrserver restart"
+echo "Command: ./${gameservername} restart"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -696,7 +713,7 @@ echo "3.7 - restart - offline"
 echo "================================="
 echo "Description:"
 echo "restart ${gamename} while already stopped."
-echo "Command: ./fctrserver restart"
+echo "Command: ./${gameservername} restart"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -710,12 +727,16 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "4.0 - Update Tests"
+echo "=================================================================="
+
 echo ""
 echo "4.1 - update"
 echo "================================="
 echo "Description:"
 echo "check for updates."
-echo "Command: ./fctrserver update"
+echo "Command: ./${gameservername} update"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -729,12 +750,20 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "5.0 - Monitor Tests"
+echo "=================================================================="
+
+echo ""
+echo "Server IP - Port: ${ip}:${port}"
+echo "Server IP - Query Port: ${ip}:${queryport}"
+
 echo ""
 echo "5.1 - monitor - online"
 echo "================================="
 echo "Description:"
 echo "run monitor server while already running."
-echo "Command: ./fctrserver monitor"
+echo "Command: ./${gameservername} monitor"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -753,7 +782,7 @@ echo "5.2 - monitor - offline - with lockfile"
 echo "================================="
 echo "Description:"
 echo "run monitor while server is offline with lockfile."
-echo "Command: ./fctrserver monitor"
+echo "Command: ./${gameservername} monitor"
 requiredstatus="OFFLINE"
 fn_setstatus
 fn_print_info_nl "creating lockfile."
@@ -774,7 +803,7 @@ echo "5.3 - monitor - offline - no lockfile"
 echo "================================="
 echo "Description:"
 echo "run monitor while server is offline with no lockfile."
-echo "Command: ./fctrserver monitor"
+echo "Command: ./${gameservername} monitor"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -789,11 +818,34 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "6.0 - details"
+echo "5.4 - test-alert"
+echo "================================="
+echo "Description:"
+echo "run monitor while server is offline with no lockfile."
+echo "Command: ./${gameservername} test-alert"
+requiredstatus="OFFLINE"
+fn_setstatus
+(
+	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+	BASH_XTRACEFD="5"
+	set -x
+	command_test_alert.sh
+)
+fn_test_result_fail
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "6.0 - Details Tests"
+echo "=================================================================="
+
+echo ""
+echo "6.1 - details"
 echo "================================="
 echo "Description:"
 echo "display details."
-echo "Command: ./fctrserver details"
+echo "Command: ./${gameservername} details"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -808,11 +860,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "6.1 - post details"
+echo "6.2 - postdetails"
 echo "================================="
 echo "Description:"
 echo "post details."
-echo "Command: ./fctrserver postdetails"
+echo "Command: ./${gameservername} postdetails"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -827,11 +879,15 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "7.0 - backup"
+echo "7.0 - Backup Tests"
+echo "=================================================================="
+
+echo ""
+echo "7.1 - backup"
 echo "================================="
 echo "Description:"
 echo "run a backup."
-echo "Command: ./fctrserver backup"
+echo "Command: ./${gameservername} backup"
 requiredstatus="ONLINE"
 fn_setstatus
 echo "test de-activated until issue #1839 fixed"
@@ -842,11 +898,15 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "8.0 - dev - detect glibc"
+echo "8.0 - Development Tools Tests"
+echo "=================================================================="
+
+echo ""
+echo "8.1 - dev - detect glibc"
 echo "================================="
 echo "Description:"
 echo "detect glibc."
-echo "Command: ./fctrserver detect-glibc"
+echo "Command: ./${gameservername} detect-glibc"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -861,11 +921,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "8.1 - dev - detect ldd"
+echo "8.2 - dev - detect ldd"
 echo "================================="
 echo "Description:"
 echo "detect ldd."
-echo "Command: ./fctrserver detect-ldd"
+echo "Command: ./${gameservername} detect-ldd"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -880,11 +940,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "8.2 - dev - detect deps"
+echo "8.3 - dev - detect deps"
 echo "================================="
 echo "Description:"
 echo "detect dependencies."
-echo "Command: ./fctrserver detect-deps"
+echo "Command: ./${gameservername} detect-deps"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -898,6 +958,25 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "8.4 - dev - query-raw"
+echo "================================="
+echo "Description:"
+echo "raw query output."
+echo "Command: ./${gameservername} query-raw"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+	BASH_XTRACEFD="5"
+	set -x
+	command_dev_query_raw.sh
+)
+fn_test_result_na
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
 echo ""
 echo "================================="
 echo "Server Tests - Complete!"

+ 107 - 39
tests/tests_jc2server.sh

@@ -13,7 +13,7 @@ shortname="jc2"
 gameservername="jc2server"
 rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
 selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
-servicename="${selfname}"
+servicename="${gameservername}"
 lockselfname=".${servicename}.lock"
 lgsmdir="${rootdir}/lgsm"
 logdir="${rootdir}/log"
@@ -359,7 +359,7 @@ else
 	fi
 
 	# Prevents running of core_exit.sh for Travis.
-	if [ "${travistest}" != "1" ]; then
+	if [ -z "${travistest}" ]; then
 		getopt=$1
 		core_getopt.sh
 	fi
@@ -452,6 +452,14 @@ fn_test_result_fail(){
 	fi
 }
 
+# test result n/a
+fn_test_result_na(){
+	echo "================================="
+	echo "Expected result: N/A"
+	echo "Actual result: N/A"
+	fn_print_fail_nl "TEST N/A"
+}
+
 echo "================================="
 echo "Travis CI Tests"
 echo "Linux Game Server Manager"
@@ -467,11 +475,16 @@ echo "Testing Branch: $TRAVIS_BRANCH"
 echo "================================="
 
 echo ""
-echo "0.1 - Create log dir's"
-echo "================================="
+echo "0.0 - Pre-test Tasks"
+echo "=================================================================="
 echo "Description:"
 echo "Create log dir's"
 echo ""
+
+echo ""
+echo "0.1 - Create log dir's"
+echo "================================="
+echo ""
 (
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
 	BASH_XTRACEFD="5"
@@ -500,11 +513,15 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "1.0 - start - no files"
+echo "1.0 - Pre-install tests"
+echo "=================================================================="
+echo ""
+
+echo "1.1 - start - no files"
 echo "================================="
 echo "Description:"
 echo "test script reaction to missing server files."
-echo "Command: ./jc2server start"
+echo "Command: ./${gameservername} start"
 echo ""
 # Allows for testing not on Travis CI
 if [ ! -v TRAVIS ]; then
@@ -524,11 +541,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "1.1 - getopt"
+echo "1.2 - getopt"
 echo "================================="
 echo "Description:"
 echo "displaying options messages."
-echo "Command: ./jc2server"
+echo "Command: ./${gameservername}"
 echo ""
 (
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
@@ -542,11 +559,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "1.2 - getopt with incorrect args"
+echo "1.3 - getopt with incorrect args"
 echo "================================="
 echo "Description:"
 echo "displaying options messages."
-echo "Command: ./jc2server abc123"
+echo "Command: ./${gameservername} abc123"
 echo ""
 getopt="abc123"
 (
@@ -560,12 +577,16 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "2.0 - Instalation"
+echo "=================================================================="
+
 echo ""
 echo "2.0 - install"
 echo "================================="
 echo "Description:"
 echo "install ${gamename} server."
-echo "Command: ./jc2server auto-install"
+echo "Command: ./${gameservername} auto-install"
 (
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
 	BASH_XTRACEFD="5"
@@ -577,12 +598,16 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "3.0 - Start/Stop/Restart Tests"
+echo "=================================================================="
+
 echo ""
 echo "3.1 - start"
 echo "================================="
 echo "Description:"
 echo "start ${gamename} server."
-echo "Command: ./jc2server start"
+echo "Command: ./${gameservername} start"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -601,7 +626,7 @@ echo "3.2 - start - online"
 echo "================================="
 echo "Description:"
 echo "start ${gamename} server while already running."
-echo "Command: ./jc2server start"
+echo "Command: ./${gameservername} start"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -620,7 +645,7 @@ echo "3.3 - start - updateonstart"
 echo "================================="
 echo "Description:"
 echo "will update server on start."
-echo "Command: ./jc2server start"
+echo "Command: ./${gameservername} start"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -639,7 +664,7 @@ echo "3.4 - stop"
 echo "================================="
 echo "Description:"
 echo "stop ${gamename} server."
-echo "Command: ./jc2server stop"
+echo "Command: ./${gameservername} stop"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -658,7 +683,7 @@ echo "3.5 - stop - offline"
 echo "================================="
 echo "Description:"
 echo "stop ${gamename} server while already stopped."
-echo "Command: ./jc2server stop"
+echo "Command: ./${gameservername} stop"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -677,7 +702,7 @@ echo "3.6 - restart"
 echo "================================="
 echo "Description:"
 echo "restart ${gamename}."
-echo "Command: ./jc2server restart"
+echo "Command: ./${gameservername} restart"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -696,7 +721,7 @@ echo "3.7 - restart - offline"
 echo "================================="
 echo "Description:"
 echo "restart ${gamename} while already stopped."
-echo "Command: ./jc2server restart"
+echo "Command: ./${gameservername} restart"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -710,12 +735,16 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "4.0 - Update Tests"
+echo "=================================================================="
+
 echo ""
 echo "4.1 - update"
 echo "================================="
 echo "Description:"
 echo "check for updates."
-echo "Command: ./jc2server update"
+echo "Command: ./${gameservername} update"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -879,12 +908,20 @@ travisip=$(ip -o -4 addr|grep eth0|awk '{print $4}'|grep -oe '\([0-9]\{1,3\}\.\?
 sed -i "/BindIP/c\BindIP                      = \"${travisip}\"," "${serverfiles}/config.lua"
 echo "IP: ${travisip}"
 
+echo ""
+echo "5.0 - Monitor Tests"
+echo "=================================================================="
+
+echo ""
+echo "Server IP - Port: ${ip}:${port}"
+echo "Server IP - Query Port: ${ip}:${queryport}"
+
 echo ""
 echo "5.1 - monitor - online"
 echo "================================="
 echo "Description:"
 echo "run monitor server while already running."
-echo "Command: ./jc2server monitor"
+echo "Command: ./${gameservername} monitor"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -903,7 +940,7 @@ echo "5.2 - monitor - offline - with lockfile"
 echo "================================="
 echo "Description:"
 echo "run monitor while server is offline with lockfile."
-echo "Command: ./jc2server monitor"
+echo "Command: ./${gameservername} monitor"
 requiredstatus="OFFLINE"
 fn_setstatus
 fn_print_info_nl "creating lockfile."
@@ -924,7 +961,7 @@ echo "5.3 - monitor - offline - no lockfile"
 echo "================================="
 echo "Description:"
 echo "run monitor while server is offline with no lockfile."
-echo "Command: ./jc2server monitor"
+echo "Command: ./${gameservername} monitor"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -939,12 +976,12 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "5.4 - monitor - query_gsquery.py failure"
+echo "5.4 - test-alert"
 echo "================================="
 echo "Description:"
-echo "query_gsquery.py will fail to query port."
-echo "Command: ./jc2server monitor"
-requiredstatus="ONLINE"
+echo "run monitor while server is offline with no lockfile."
+echo "Command: ./${gameservername} test-alert"
+requiredstatus="OFFLINE"
 fn_setstatus
 cp "${servercfgfullpath}" "config.lua"
 sed -i 's/[0-9]\+/0/' "${servercfgfullpath}"
@@ -952,7 +989,7 @@ sed -i 's/[0-9]\+/0/' "${servercfgfullpath}"
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
 	BASH_XTRACEFD="5"
 	set -x
-	command_monitor.sh
+	command_test_alert.sh
 )
 fn_test_result_fail
 echo "run order"
@@ -965,11 +1002,15 @@ cp -v "config.lua" "${servercfgfullpath}"
 echo "================================="
 
 echo ""
-echo "6.0 - details"
+echo "6.0 - Details Tests"
+echo "=================================================================="
+
+echo ""
+echo "6.1 - details"
 echo "================================="
 echo "Description:"
 echo "display details."
-echo "Command: ./jc2server details"
+echo "Command: ./${gameservername} details"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -984,11 +1025,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "6.1 - post details"
+echo "6.2 - postdetails"
 echo "================================="
 echo "Description:"
 echo "post details."
-echo "Command: ./jc2server postdetails"
+echo "Command: ./${gameservername} postdetails"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -1003,11 +1044,15 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "7.0 - backup"
+echo "7.0 - Backup Tests"
+echo "=================================================================="
+
+echo ""
+echo "7.1 - backup"
 echo "================================="
 echo "Description:"
 echo "run a backup."
-echo "Command: ./jc2server backup"
+echo "Command: ./${gameservername} backup"
 requiredstatus="ONLINE"
 fn_setstatus
 echo "test de-activated until issue #1839 fixed"
@@ -1018,11 +1063,15 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "8.0 - dev - detect glibc"
+echo "8.0 - Development Tools Tests"
+echo "=================================================================="
+
+echo ""
+echo "8.1 - dev - detect glibc"
 echo "================================="
 echo "Description:"
 echo "detect glibc."
-echo "Command: ./jc2server detect-glibc"
+echo "Command: ./${gameservername} detect-glibc"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -1037,11 +1086,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "8.1 - dev - detect ldd"
+echo "8.2 - dev - detect ldd"
 echo "================================="
 echo "Description:"
 echo "detect ldd."
-echo "Command: ./jc2server detect-ldd"
+echo "Command: ./${gameservername} detect-ldd"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -1056,11 +1105,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "8.2 - dev - detect deps"
+echo "8.3 - dev - detect deps"
 echo "================================="
 echo "Description:"
 echo "detect dependencies."
-echo "Command: ./jc2server detect-deps"
+echo "Command: ./${gameservername} detect-deps"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -1074,6 +1123,25 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "8.4 - dev - query-raw"
+echo "================================="
+echo "Description:"
+echo "raw query output."
+echo "Command: ./${gameservername} query-raw"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+	BASH_XTRACEFD="5"
+	set -x
+	command_dev_query_raw.sh
+)
+fn_test_result_na
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
 echo ""
 echo "================================="
 echo "Server Tests - Complete!"

+ 113 - 34
tests/tests_ts3server.sh

@@ -13,7 +13,7 @@ shortname="ts3"
 gameservername="ts3server"
 rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
 selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
-servicename="${selfname}"
+servicename="${gameservername}"
 lockselfname=".${servicename}.lock"
 lgsmdir="${rootdir}/lgsm"
 logdir="${rootdir}/log"
@@ -359,7 +359,7 @@ else
 	fi
 
 	# Prevents running of core_exit.sh for Travis.
-	if [ "${travistest}" != "1" ]; then
+	if [ -z "${travistest}" ]; then
 		getopt=$1
 		core_getopt.sh
 	fi
@@ -467,11 +467,16 @@ echo "Testing Branch: $TRAVIS_BRANCH"
 echo "================================="
 
 echo ""
-echo "0.1 - Create log dir's"
-echo "================================="
+echo "0.0 - Pre-test Tasks"
+echo "=================================================================="
 echo "Description:"
 echo "Create log dir's"
 echo ""
+
+echo ""
+echo "0.1 - Create log dir's"
+echo "================================="
+echo ""
 (
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
 	BASH_XTRACEFD="5"
@@ -500,11 +505,15 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "1.0 - start - no files"
+echo "1.0 - Pre-install tests"
+echo "=================================================================="
+echo ""
+
+echo "1.1 - start - no files"
 echo "================================="
 echo "Description:"
 echo "test script reaction to missing server files."
-echo "Command: ./ts3server start"
+echo "Command: ./${gameservername} start"
 echo ""
 # Allows for testing not on Travis CI
 if [ ! -v TRAVIS ]; then
@@ -524,11 +533,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "1.1 - getopt"
+echo "1.2 - getopt"
 echo "================================="
 echo "Description:"
 echo "displaying options messages."
-echo "Command: ./ts3server"
+echo "Command: ./${gameservername}"
 echo ""
 (
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
@@ -542,11 +551,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "1.2 - getopt with incorrect args"
+echo "1.3 - getopt with incorrect args"
 echo "================================="
 echo "Description:"
 echo "displaying options messages."
-echo "Command: ./ts3server abc123"
+echo "Command: ./${gameservername} abc123"
 echo ""
 getopt="abc123"
 (
@@ -560,12 +569,16 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "2.0 - Instalation"
+echo "=================================================================="
+
 echo ""
 echo "2.0 - install"
 echo "================================="
 echo "Description:"
 echo "install ${gamename} server."
-echo "Command: ./ts3server auto-install"
+echo "Command: ./${gameservername} auto-install"
 (
 	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
 	BASH_XTRACEFD="5"
@@ -577,12 +590,16 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "3.0 - Start/Stop/Restart Tests"
+echo "=================================================================="
+
 echo ""
 echo "3.1 - start"
 echo "================================="
 echo "Description:"
 echo "start ${gamename} server."
-echo "Command: ./ts3server start"
+echo "Command: ./${gameservername} start"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -601,7 +618,7 @@ echo "3.2 - start - online"
 echo "================================="
 echo "Description:"
 echo "start ${gamename} server while already running."
-echo "Command: ./ts3server start"
+echo "Command: ./${gameservername} start"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -620,7 +637,7 @@ echo "3.3 - start - updateonstart"
 echo "================================="
 echo "Description:"
 echo "will update server on start."
-echo "Command: ./ts3server start"
+echo "Command: ./${gameservername} start"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -639,7 +656,7 @@ echo "3.4 - stop"
 echo "================================="
 echo "Description:"
 echo "stop ${gamename} server."
-echo "Command: ./ts3server stop"
+echo "Command: ./${gameservername} stop"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -658,7 +675,7 @@ echo "3.5 - stop - offline"
 echo "================================="
 echo "Description:"
 echo "stop ${gamename} server while already stopped."
-echo "Command: ./ts3server stop"
+echo "Command: ./${gameservername} stop"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -677,7 +694,7 @@ echo "3.6 - restart"
 echo "================================="
 echo "Description:"
 echo "restart ${gamename}."
-echo "Command: ./ts3server restart"
+echo "Command: ./${gameservername} restart"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -696,7 +713,7 @@ echo "3.7 - restart - offline"
 echo "================================="
 echo "Description:"
 echo "restart ${gamename} while already stopped."
-echo "Command: ./ts3server restart"
+echo "Command: ./${gameservername} restart"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -710,12 +727,16 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "4.0 - Update Tests"
+echo "=================================================================="
+
 echo ""
 echo "4.1 - update"
 echo "================================="
 echo "Description:"
 echo "check for updates."
-echo "Command: ./ts3server update"
+echo "Command: ./${gameservername} update"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -729,12 +750,20 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "5.0 - Monitor Tests"
+echo "=================================================================="
+
+echo ""
+echo "Server IP - Port: ${ip}:${port}"
+echo "Server IP - Query Port: ${ip}:${queryport}"
+
 echo ""
 echo "5.1 - monitor - online"
 echo "================================="
 echo "Description:"
 echo "run monitor server while already running."
-echo "Command: ./ts3server monitor"
+echo "Command: ./${gameservername} monitor"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -753,7 +782,7 @@ echo "5.2 - monitor - offline - with lockfile"
 echo "================================="
 echo "Description:"
 echo "run monitor while server is offline with lockfile."
-echo "Command: ./ts3server monitor"
+echo "Command: ./${gameservername} monitor"
 requiredstatus="OFFLINE"
 fn_setstatus
 fn_print_info_nl "creating lockfile."
@@ -774,7 +803,7 @@ echo "5.3 - monitor - offline - no lockfile"
 echo "================================="
 echo "Description:"
 echo "run monitor while server is offline with no lockfile."
-echo "Command: ./ts3server monitor"
+echo "Command: ./${gameservername} monitor"
 requiredstatus="OFFLINE"
 fn_setstatus
 (
@@ -789,11 +818,34 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "6.0 - details"
+echo "5.4 - test-alert"
+echo "================================="
+echo "Description:"
+echo "run monitor while server is offline with no lockfile."
+echo "Command: ./${gameservername} test-alert"
+requiredstatus="OFFLINE"
+fn_setstatus
+(
+	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+	BASH_XTRACEFD="5"
+	set -x
+	command_test_alert.sh
+)
+fn_test_result_fail
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
+echo ""
+echo "6.0 - Details Tests"
+echo "=================================================================="
+
+echo ""
+echo "6.1 - details"
 echo "================================="
 echo "Description:"
 echo "display details."
-echo "Command: ./ts3server details"
+echo "Command: ./${gameservername} details"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -808,11 +860,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "6.1 - post details"
+echo "6.2 - postdetails"
 echo "================================="
 echo "Description:"
 echo "post details."
-echo "Command: ./ts3server postdetails"
+echo "Command: ./${gameservername} postdetails"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -827,11 +879,15 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "7.0 - backup"
+echo "7.0 - Backup Tests"
+echo "=================================================================="
+
+echo ""
+echo "7.1 - backup"
 echo "================================="
 echo "Description:"
 echo "run a backup."
-echo "Command: ./jc2server backup"
+echo "Command: ./${gameservername} backup"
 requiredstatus="ONLINE"
 fn_setstatus
 echo "test de-activated until issue #1839 fixed"
@@ -842,11 +898,15 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "8.0 - dev - detect glibc"
+echo "8.0 - Development Tools Tests"
+echo "=================================================================="
+
+echo ""
+echo "8.1 - dev - detect glibc"
 echo "================================="
 echo "Description:"
 echo "detect glibc."
-echo "Command: ./jc2server detect-glibc"
+echo "Command: ./${gameservername} detect-glibc"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -861,11 +921,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "8.1 - dev - detect ldd"
+echo "8.2 - dev - detect ldd"
 echo "================================="
 echo "Description:"
 echo "detect ldd."
-echo "Command: ./jc2server detect-ldd"
+echo "Command: ./${gameservername} detect-ldd"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -880,11 +940,11 @@ echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
 echo ""
-echo "8.2 - dev - detect deps"
+echo "8.3 - dev - detect deps"
 echo "================================="
 echo "Description:"
 echo "detect dependencies."
-echo "Command: ./jc2server detect-deps"
+echo "Command: ./${gameservername} detect-deps"
 requiredstatus="ONLINE"
 fn_setstatus
 (
@@ -898,6 +958,25 @@ echo "run order"
 echo "================="
 grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
 
+echo ""
+echo "8.4 - dev - query-raw"
+echo "================================="
+echo "Description:"
+echo "raw query output."
+echo "Command: ./${gameservername} query-raw"
+requiredstatus="ONLINE"
+fn_setstatus
+(
+	exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log"
+	BASH_XTRACEFD="5"
+	set -x
+	command_dev_query_raw.sh
+)
+fn_test_result_na
+echo "run order"
+echo "================="
+grep functionfile= "${TRAVIS_BUILD_DIR}/dev-debug.log" | sed 's/functionfile=//g'
+
 echo ""
 echo "================================="
 echo "Server Tests - Complete!"