|
@@ -1,20 +1,50 @@
|
|
|
#!/bin/bash
|
|
#!/bin/bash
|
|
|
-# TravisCI Tests
|
|
|
|
|
|
|
+# TravisCI Tests: Teamspeak 3
|
|
|
# Server Management Script
|
|
# Server Management Script
|
|
|
# Author: Daniel Gibbs
|
|
# Author: Daniel Gibbs
|
|
|
# Website: https://gameservermanagers.com
|
|
# Website: https://gameservermanagers.com
|
|
|
-version="071115"
|
|
|
|
|
|
|
+version="101716"
|
|
|
|
|
+
|
|
|
|
|
+if [ -f ".dev-debug" ]; then
|
|
|
|
|
+ exec 5>dev-debug.log
|
|
|
|
|
+ BASH_XTRACEFD="5"
|
|
|
|
|
+ set -x
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
|
|
|
|
|
#### Variables ####
|
|
#### Variables ####
|
|
|
|
|
|
|
|
-# Alert Email
|
|
|
|
|
|
|
+# Notification Alerts
|
|
|
# (on|off)
|
|
# (on|off)
|
|
|
|
|
+
|
|
|
|
|
+# Email
|
|
|
emailalert="off"
|
|
emailalert="off"
|
|
|
-email=""
|
|
|
|
|
|
|
+email="email@example.com"
|
|
|
|
|
+
|
|
|
|
|
+# Pushbullet
|
|
|
|
|
+# https://www.pushbullet.com/#settings
|
|
|
|
|
+pushbulletalert="off"
|
|
|
|
|
+pushbullettoken="accesstoken"
|
|
|
|
|
|
|
|
# Start Variables
|
|
# Start Variables
|
|
|
updateonstart="off"
|
|
updateonstart="off"
|
|
|
|
|
|
|
|
|
|
+fn_parms(){
|
|
|
|
|
+parms=""
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+#### Advanced Variables ####
|
|
|
|
|
+
|
|
|
|
|
+# Github Branch Select
|
|
|
|
|
+# Allows for the use of different function files
|
|
|
|
|
+# from a different repo and/or branch.
|
|
|
|
|
+githubuser="dgibbs64"
|
|
|
|
|
+githubrepo="linuxgsm"
|
|
|
|
|
+githubbranch="$TRAVIS_BRANCH"
|
|
|
|
|
+
|
|
|
|
|
+# Steam
|
|
|
|
|
+appid="261140"
|
|
|
|
|
+
|
|
|
# Server Details
|
|
# Server Details
|
|
|
gamename="Teamspeak 3"
|
|
gamename="Teamspeak 3"
|
|
|
servername="Teamspeak 3 Server"
|
|
servername="Teamspeak 3 Server"
|
|
@@ -24,6 +54,9 @@ servicename="ts3-server"
|
|
|
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
|
|
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
|
|
|
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
|
|
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
|
|
|
lockselfname=".${servicename}.lock"
|
|
lockselfname=".${servicename}.lock"
|
|
|
|
|
+lgsmdir="${rootdir}/lgsm"
|
|
|
|
|
+functionsdir="${lgsmdir}/functions"
|
|
|
|
|
+libdir="${lgsmdir}/lib"
|
|
|
filesdir="${rootdir}/serverfiles"
|
|
filesdir="${rootdir}/serverfiles"
|
|
|
systemdir="${filesdir}"
|
|
systemdir="${filesdir}"
|
|
|
executabledir="${filesdir}"
|
|
executabledir="${filesdir}"
|
|
@@ -34,7 +67,6 @@ servercfgfullpath="${servercfgdir}/${servercfg}"
|
|
|
servercfgdefault="${servercfgdir}/lgsm-default.ini"
|
|
servercfgdefault="${servercfgdir}/lgsm-default.ini"
|
|
|
backupdir="${rootdir}/backups"
|
|
backupdir="${rootdir}/backups"
|
|
|
|
|
|
|
|
-
|
|
|
|
|
# Logging
|
|
# Logging
|
|
|
logdays="7"
|
|
logdays="7"
|
|
|
gamelogdir="${filesdir}/logs"
|
|
gamelogdir="${filesdir}/logs"
|
|
@@ -45,67 +77,66 @@ emaillog="${scriptlogdir}/${servicename}-email.log"
|
|
|
|
|
|
|
|
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
|
|
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
|
|
|
|
|
|
|
|
-#### Advanced Variables ####
|
|
|
|
|
-
|
|
|
|
|
-# Github Branch Select
|
|
|
|
|
-# Allows for the use of different function files
|
|
|
|
|
-# from a different repo and/or branch.
|
|
|
|
|
-githubuser="dgibbs64"
|
|
|
|
|
-githubrepo="linuxgsm"
|
|
|
|
|
-githubbranch="$TRAVIS_BRANCH"
|
|
|
|
|
|
|
|
|
|
##### Script #####
|
|
##### Script #####
|
|
|
# Do not edit
|
|
# Do not edit
|
|
|
|
|
|
|
|
-fn_getgithubfile(){
|
|
|
|
|
-filename=$1
|
|
|
|
|
-exec=$2
|
|
|
|
|
-fileurl=${3:-$filename}
|
|
|
|
|
-filepath="${rootdir}/${filename}"
|
|
|
|
|
-filedir=$(dirname "${filepath}")
|
|
|
|
|
-# If the function file is missing, then download
|
|
|
|
|
-if [ ! -f "${filepath}" ]; then
|
|
|
|
|
|
|
+# Fetches core_dl for file downloads
|
|
|
|
|
+fn_fetch_core_dl(){
|
|
|
|
|
+github_file_url_dir="lgsm/functions"
|
|
|
|
|
+github_file_url_name="${functionfile}"
|
|
|
|
|
+filedir="${functionsdir}"
|
|
|
|
|
+filename="${github_file_url_name}"
|
|
|
|
|
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
|
|
+# If the file is missing, then download
|
|
|
|
|
+if [ ! -f "${filedir}/${filename}" ]; then
|
|
|
if [ ! -d "${filedir}" ]; then
|
|
if [ ! -d "${filedir}" ]; then
|
|
|
- mkdir "${filedir}"
|
|
|
|
|
|
|
+ mkdir -p "${filedir}"
|
|
|
fi
|
|
fi
|
|
|
- githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
|
|
|
|
|
echo -e " fetching ${filename}...\c"
|
|
echo -e " fetching ${filename}...\c"
|
|
|
- if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
|
|
|
|
|
- :
|
|
|
|
|
|
|
+ # Check curl exists and use available path
|
|
|
|
|
+ curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
|
|
|
|
|
+ for curlcmd in ${curlpaths}
|
|
|
|
|
+ do
|
|
|
|
|
+ if [ -x "${curlcmd}" ]; then
|
|
|
|
|
+ break
|
|
|
|
|
+ fi
|
|
|
|
|
+ done
|
|
|
|
|
+ # If curl exists download file
|
|
|
|
|
+ if [ "$(basename ${curlcmd})" == "curl" ]; then
|
|
|
|
|
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
|
|
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
|
|
+ echo -e "\e[0;31mFAIL\e[0m\n"
|
|
|
|
|
+ echo "${curlfetch}"
|
|
|
|
|
+ echo -e "${githuburl}\n"
|
|
|
|
|
+ exit 1
|
|
|
|
|
+ else
|
|
|
|
|
+ echo -e "\e[0;32mOK\e[0m"
|
|
|
|
|
+ fi
|
|
|
else
|
|
else
|
|
|
echo -e "\e[0;31mFAIL\e[0m\n"
|
|
echo -e "\e[0;31mFAIL\e[0m\n"
|
|
|
echo "Curl is not installed!"
|
|
echo "Curl is not installed!"
|
|
|
echo -e ""
|
|
echo -e ""
|
|
|
- exit
|
|
|
|
|
- fi
|
|
|
|
|
- curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
|
|
|
|
|
- if [ $? -ne 0 ]; then
|
|
|
|
|
- echo -e "\e[0;31mFAIL\e[0m\n"
|
|
|
|
|
- echo "${curl}"
|
|
|
|
|
- echo -e "${githuburl}\n"
|
|
|
|
|
- exit
|
|
|
|
|
- else
|
|
|
|
|
- echo -e "\e[0;32mOK\e[0m"
|
|
|
|
|
|
|
+ exit 1
|
|
|
fi
|
|
fi
|
|
|
- if [ "${exec}" ]; then
|
|
|
|
|
- chmod +x "${filepath}"
|
|
|
|
|
- fi
|
|
|
|
|
-fi
|
|
|
|
|
-if [ "${exec}" ]; then
|
|
|
|
|
- source "${filepath}"
|
|
|
|
|
|
|
+ chmod +x "${filedir}/${filename}"
|
|
|
fi
|
|
fi
|
|
|
|
|
+source "${filedir}/${filename}"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-fn_runfunction(){
|
|
|
|
|
- fn_getgithubfile "functions/${functionfile}" 1
|
|
|
|
|
|
|
+core_dl.sh(){
|
|
|
|
|
+# Functions are defined in core_functions.sh.
|
|
|
|
|
+functionfile="${FUNCNAME}"
|
|
|
|
|
+fn_fetch_core_dl
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
core_functions.sh(){
|
|
core_functions.sh(){
|
|
|
# Functions are defined in core_functions.sh.
|
|
# Functions are defined in core_functions.sh.
|
|
|
functionfile="${FUNCNAME}"
|
|
functionfile="${FUNCNAME}"
|
|
|
-fn_runfunction
|
|
|
|
|
|
|
+fn_fetch_core_dl
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+core_dl.sh
|
|
|
core_functions.sh
|
|
core_functions.sh
|
|
|
|
|
|
|
|
fn_currentstatus_tmux(){
|
|
fn_currentstatus_tmux(){
|
|
@@ -118,7 +149,7 @@ fn_currentstatus_tmux(){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
fn_currentstatus_ts3(){
|
|
fn_currentstatus_ts3(){
|
|
|
-check_status.sh
|
|
|
|
|
|
|
+ check_status.sh
|
|
|
if [ "${status}" != "0" ]; then
|
|
if [ "${status}" != "0" ]; then
|
|
|
currentstatus="ONLINE"
|
|
currentstatus="ONLINE"
|
|
|
else
|
|
else
|
|
@@ -138,9 +169,9 @@ fn_setstatus(){
|
|
|
echo -ne "New status: ${currentstatus}\\r"
|
|
echo -ne "New status: ${currentstatus}\\r"
|
|
|
|
|
|
|
|
if [ "${requiredstatus}" == "ONLINE" ]; then
|
|
if [ "${requiredstatus}" == "ONLINE" ]; then
|
|
|
- (command_start.sh)
|
|
|
|
|
|
|
+ (command_start.sh > /dev/null 2>&1)
|
|
|
else
|
|
else
|
|
|
- (command_stop.sh)
|
|
|
|
|
|
|
+ (command_stop.sh > /dev/null 2>&1)
|
|
|
fi
|
|
fi
|
|
|
if [ "${counter}" -gt "5" ]; then
|
|
if [ "${counter}" -gt "5" ]; then
|
|
|
currentstatus="FAIL"
|
|
currentstatus="FAIL"
|
|
@@ -157,6 +188,44 @@ fn_setstatus(){
|
|
|
sleep 0.5
|
|
sleep 0.5
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+# End of every test will expect the result to either pass or fail
|
|
|
|
|
+# If the script does not do as intended the whole test will fail
|
|
|
|
|
+# if excpecting a pass
|
|
|
|
|
+fn_test_result_pass(){
|
|
|
|
|
+ if [ $? != 0 ]; then
|
|
|
|
|
+ echo "================================="
|
|
|
|
|
+ echo "Expected result: PASS"
|
|
|
|
|
+ echo "Actual result: FAIL"
|
|
|
|
|
+ fn_print_fail_nl "TEST FAILED"
|
|
|
|
|
+ exitcode=1
|
|
|
|
|
+ core_exit.sh
|
|
|
|
|
+ else
|
|
|
|
|
+ echo "================================="
|
|
|
|
|
+ echo "Expected result: PASS"
|
|
|
|
|
+ echo "Actual result: PASS"
|
|
|
|
|
+ fn_print_ok_nl "TEST PASSED"
|
|
|
|
|
+ echo ""
|
|
|
|
|
+ fi
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+# if excpecting a fail
|
|
|
|
|
+fn_test_result_fail(){
|
|
|
|
|
+ if [ $? == 0 ]; then
|
|
|
|
|
+ echo "================================="
|
|
|
|
|
+ echo "Expected result: FAIL"
|
|
|
|
|
+ echo "Actual result: PASS"
|
|
|
|
|
+ fn_print_fail_nl "TEST FAILED"
|
|
|
|
|
+ exitcode=1
|
|
|
|
|
+ core_exit.sh
|
|
|
|
|
+ else
|
|
|
|
|
+ echo "================================="
|
|
|
|
|
+ echo "Expected result: FAIL"
|
|
|
|
|
+ echo "Actual result: FAIL"
|
|
|
|
|
+ fn_print_ok_nl "TEST PASSED"
|
|
|
|
|
+ echo ""
|
|
|
|
|
+ fi
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "TravisCI Tests"
|
|
echo "TravisCI Tests"
|
|
|
echo "Linux Game Server Manager"
|
|
echo "Linux Game Server Manager"
|
|
@@ -164,232 +233,229 @@ echo "by Daniel Gibbs"
|
|
|
echo "https://gameservermanagers.com"
|
|
echo "https://gameservermanagers.com"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo ""
|
|
echo ""
|
|
|
-sleep 1
|
|
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Server Tests"
|
|
echo "Server Tests"
|
|
|
echo "Using: ${gamename}"
|
|
echo "Using: ${gamename}"
|
|
|
|
|
+echo "Testing Branch: $TRAVIS_BRANCH"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo ""
|
|
echo ""
|
|
|
-sleep 1
|
|
|
|
|
|
|
+
|
|
|
|
|
+echo "0.1 - Create log dir's"
|
|
|
|
|
+echo "================================="
|
|
|
|
|
+echo "Description:"
|
|
|
|
|
+echo "Create log dir's"
|
|
|
|
|
+echo ""
|
|
|
|
|
+(install_logs.sh)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+echo "0.2 - Enable dev-debug"
|
|
|
|
|
+echo "================================="
|
|
|
|
|
+echo "Description:"
|
|
|
|
|
+echo "Enable dev-debug"
|
|
|
|
|
+echo ""
|
|
|
|
|
+(command_dev_debug.sh)
|
|
|
|
|
+fn_test_result_pass
|
|
|
|
|
|
|
|
echo "1.0 - start - no files"
|
|
echo "1.0 - start - no files"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "test script reaction to missing server files."
|
|
echo "test script reaction to missing server files."
|
|
|
|
|
+echo "Command: ./jc2server start"
|
|
|
echo ""
|
|
echo ""
|
|
|
(command_start.sh)
|
|
(command_start.sh)
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
|
|
+fn_test_result_fail
|
|
|
|
|
+
|
|
|
echo ""
|
|
echo ""
|
|
|
echo "1.1 - getopt"
|
|
echo "1.1 - getopt"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "displaying options messages."
|
|
echo "displaying options messages."
|
|
|
|
|
+echo "Command: ./jc2server"
|
|
|
echo ""
|
|
echo ""
|
|
|
(core_getopt.sh)
|
|
(core_getopt.sh)
|
|
|
|
|
+fn_test_result_pass
|
|
|
|
|
+
|
|
|
echo ""
|
|
echo ""
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
|
|
+echo "1.2 - getopt with incorrect args"
|
|
|
|
|
+echo "================================="
|
|
|
|
|
+echo "Description:"
|
|
|
|
|
+echo "displaying options messages."
|
|
|
|
|
+echo "Command: ./jc2server abc123"
|
|
|
echo ""
|
|
echo ""
|
|
|
|
|
+getopt="abc123"
|
|
|
|
|
+(core_getopt.sh)
|
|
|
|
|
+fn_test_result_fail
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+echo ""
|
|
|
echo "2.0 - install"
|
|
echo "2.0 - install"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "install ${gamename} server."
|
|
echo "install ${gamename} server."
|
|
|
-fn_autoinstall
|
|
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
-echo ""
|
|
|
|
|
-
|
|
|
|
|
|
|
+echo "Command: ./jc2server auto-install"
|
|
|
|
|
+(fn_autoinstall)
|
|
|
|
|
+fn_test_result_pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+echo ""
|
|
|
echo "3.1 - start"
|
|
echo "3.1 - start"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "start ${gamename} server."
|
|
echo "start ${gamename} server."
|
|
|
|
|
+echo "Command: ./jc2server start"
|
|
|
requiredstatus="OFFLINE"
|
|
requiredstatus="OFFLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
-command_start.sh
|
|
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
|
|
+(command_start.sh)
|
|
|
|
|
+fn_test_result_pass
|
|
|
|
|
+
|
|
|
echo ""
|
|
echo ""
|
|
|
echo "3.2 - start - online"
|
|
echo "3.2 - start - online"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "start ${gamename} server while already running."
|
|
echo "start ${gamename} server while already running."
|
|
|
|
|
+echo "Command: ./jc2server start"
|
|
|
requiredstatus="ONLINE"
|
|
requiredstatus="ONLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
(command_start.sh)
|
|
(command_start.sh)
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
|
|
+fn_test_result_fail
|
|
|
|
|
+
|
|
|
echo ""
|
|
echo ""
|
|
|
echo "3.3 - start - updateonstart"
|
|
echo "3.3 - start - updateonstart"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "will update server on start."
|
|
echo "will update server on start."
|
|
|
|
|
+echo "Command: ./jc2server start"
|
|
|
requiredstatus="OFFLINE"
|
|
requiredstatus="OFFLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
-(
|
|
|
|
|
- updateonstart="on"
|
|
|
|
|
- command_start.sh
|
|
|
|
|
-)
|
|
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
|
|
+(updateonstart="on";command_start.sh)
|
|
|
|
|
+fn_test_result_pass
|
|
|
|
|
+
|
|
|
echo ""
|
|
echo ""
|
|
|
echo "3.4 - stop"
|
|
echo "3.4 - stop"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "stop ${gamename} server."
|
|
echo "stop ${gamename} server."
|
|
|
|
|
+echo "Command: ./jc2server stop"
|
|
|
requiredstatus="ONLINE"
|
|
requiredstatus="ONLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
-command_stop.sh
|
|
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
|
|
+(command_stop.sh)
|
|
|
|
|
+fn_test_result_pass
|
|
|
|
|
+
|
|
|
echo ""
|
|
echo ""
|
|
|
echo "3.5 - stop - offline"
|
|
echo "3.5 - stop - offline"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "stop ${gamename} server while already stopped."
|
|
echo "stop ${gamename} server while already stopped."
|
|
|
|
|
+echo "Command: ./jc2server stop"
|
|
|
requiredstatus="OFFLINE"
|
|
requiredstatus="OFFLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
(command_stop.sh)
|
|
(command_stop.sh)
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
|
|
+fn_test_result_fail
|
|
|
|
|
+
|
|
|
echo ""
|
|
echo ""
|
|
|
echo "3.6 - restart"
|
|
echo "3.6 - restart"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "restart ${gamename}."
|
|
echo "restart ${gamename}."
|
|
|
|
|
+echo "Command: ./jc2server restart"
|
|
|
requiredstatus="ONLINE"
|
|
requiredstatus="ONLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
-command_restart.sh
|
|
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
|
|
+(command_restart.sh)
|
|
|
|
|
+fn_test_result_pass
|
|
|
|
|
+
|
|
|
echo ""
|
|
echo ""
|
|
|
echo "3.7 - restart - offline"
|
|
echo "3.7 - restart - offline"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "restart ${gamename} while already stopped."
|
|
echo "restart ${gamename} while already stopped."
|
|
|
|
|
+echo "Command: ./jc2server restart"
|
|
|
requiredstatus="OFFLINE"
|
|
requiredstatus="OFFLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
-command_restart.sh
|
|
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
-echo ""
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+(command_restart.sh)
|
|
|
|
|
+fn_test_result_pass
|
|
|
|
|
|
|
|
echo "4.1 - update"
|
|
echo "4.1 - update"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "check for updates."
|
|
echo "check for updates."
|
|
|
|
|
+echo "Command: ./jc2server update"
|
|
|
requiredstatus="OFFLINE"
|
|
requiredstatus="OFFLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
-update_check.sh
|
|
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
-echo ""
|
|
|
|
|
-echo "4.1 - update - old version"
|
|
|
|
|
-echo "================================="
|
|
|
|
|
-echo "Description:"
|
|
|
|
|
-echo "change the version number tricking LGSM to update."
|
|
|
|
|
-requiredstatus="OFFLINE"
|
|
|
|
|
-sed -i 's/[0-9]\+/0/g' ${gamelogdir}/ts3server*_0.log
|
|
|
|
|
-fn_setstatus
|
|
|
|
|
-update_check.sh
|
|
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
-echo ""
|
|
|
|
|
|
|
+(command_update.sh)
|
|
|
|
|
+fn_test_result_pass
|
|
|
|
|
|
|
|
|
|
+echo ""
|
|
|
echo "5.1 - monitor - online"
|
|
echo "5.1 - monitor - online"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "run monitor server while already running."
|
|
echo "run monitor server while already running."
|
|
|
|
|
+echo "Command: ./jc2server monitor"
|
|
|
requiredstatus="ONLINE"
|
|
requiredstatus="ONLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
(command_monitor.sh)
|
|
(command_monitor.sh)
|
|
|
|
|
+fn_test_result_pass
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
echo ""
|
|
echo ""
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
-echo ""
|
|
|
|
|
-echo "5.2 - monitor - offline - no lockfile"
|
|
|
|
|
|
|
+echo "5.2 - monitor - offline - with lockfile"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
-echo "run monitor while server is offline with no lockfile."
|
|
|
|
|
|
|
+echo "run monitor while server is offline with lockfile."
|
|
|
|
|
+echo "Command: ./jc2server monitor"
|
|
|
requiredstatus="OFFLINE"
|
|
requiredstatus="OFFLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
|
|
+fn_print_info_nl "creating lockfile."
|
|
|
|
|
+date > "${rootdir}/${lockselfname}"
|
|
|
(command_monitor.sh)
|
|
(command_monitor.sh)
|
|
|
|
|
+fn_test_result_pass
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
echo ""
|
|
echo ""
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
-echo ""
|
|
|
|
|
-echo "5.3 - monitor - offline - with lockfile"
|
|
|
|
|
|
|
+echo "5.3 - monitor - offline - no lockfile"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "run monitor while server is offline with no lockfile."
|
|
echo "run monitor while server is offline with no lockfile."
|
|
|
|
|
+echo "Command: ./jc2server monitor"
|
|
|
requiredstatus="OFFLINE"
|
|
requiredstatus="OFFLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
-fn_print_info_nl "creating lockfile."
|
|
|
|
|
-date > "${rootdir}/${lockselfname}"
|
|
|
|
|
(command_monitor.sh)
|
|
(command_monitor.sh)
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
|
|
+fn_test_result_fail
|
|
|
|
|
+
|
|
|
echo ""
|
|
echo ""
|
|
|
echo "5.4 - monitor - gsquery.py failure"
|
|
echo "5.4 - monitor - gsquery.py failure"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "gsquery.py will fail to query port."
|
|
echo "gsquery.py will fail to query port."
|
|
|
|
|
+echo "Command: ./jc2server monitor"
|
|
|
requiredstatus="ONLINE"
|
|
requiredstatus="ONLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
sed -i 's/[0-9]\+/0/' "${servercfgfullpath}"
|
|
sed -i 's/[0-9]\+/0/' "${servercfgfullpath}"
|
|
|
(command_monitor.sh)
|
|
(command_monitor.sh)
|
|
|
|
|
+fn_test_result_fail
|
|
|
echo ""
|
|
echo ""
|
|
|
-fn_print_info_nl "Reseting ${servercfg}."
|
|
|
|
|
|
|
+fn_print_info_nl "Re-generating ${servercfg}."
|
|
|
install_config.sh
|
|
install_config.sh
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
-echo ""
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+echo "================================="
|
|
|
|
|
|
|
|
|
|
+echo ""
|
|
|
echo "6.0 - details"
|
|
echo "6.0 - details"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Description:"
|
|
echo "Description:"
|
|
|
echo "display details."
|
|
echo "display details."
|
|
|
|
|
+echo "Command: ./jc2server details"
|
|
|
requiredstatus="ONLINE"
|
|
requiredstatus="ONLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
-command_details.sh
|
|
|
|
|
-echo ""
|
|
|
|
|
-echo "Test complete!"
|
|
|
|
|
-sleep 1
|
|
|
|
|
-echo ""
|
|
|
|
|
|
|
+(command_details.sh)
|
|
|
|
|
+fn_test_result_pass
|
|
|
|
|
|
|
|
|
|
+echo ""
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
echo "Server Tests - Complete!"
|
|
echo "Server Tests - Complete!"
|
|
|
echo "Using: ${gamename}"
|
|
echo "Using: ${gamename}"
|
|
|
echo "================================="
|
|
echo "================================="
|
|
|
-echo ""
|
|
|
|
|
requiredstatus="OFFLINE"
|
|
requiredstatus="OFFLINE"
|
|
|
fn_setstatus
|
|
fn_setstatus
|
|
|
sleep 1
|
|
sleep 1
|
|
|
fn_print_info "Tidying up directories."
|
|
fn_print_info "Tidying up directories."
|
|
|
sleep 1
|
|
sleep 1
|
|
|
-rm -rfv ${serverfiles}
|
|
|
|
|
-echo "END"
|
|
|
|
|
|
|
+rm -rfv "${serverfiles}"
|
|
|
|
|
+core_exit.sh
|