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

Merge pull request #1644 from GameServerManagers/feature/travis-tests

Feature/travis tests
Daniel Gibbs 8 лет назад
Родитель
Сommit
66ef90b33c
3 измененных файлов с 140 добавлено и 43 удалено
  1. 19 7
      .travis.yml
  2. 63 15
      tests/tests_jc2server.sh
  3. 58 21
      tests/tests_ts3server.sh

+ 19 - 7
.travis.yml

@@ -11,14 +11,26 @@ addons:
     sources:
     - ubuntu-toolchain-r-test
     packages:
-    - tmux
     - mailutils
-    - postfix 
-    - lib32gcc1 
-    - libstdc++6 
-    - libstdc++6:i386 
-    - telnet 
-    - expect
+    - postfix
+    - curl
+    - wget
+    - file
+    - bzip2
+    - gzip
+    - unzip
+    - bsdmainutils
+    - python
+    - util-linux
+    - ca-certificates
+    - binutils
+    - bc
+    - tmux
+    - lib32gcc1
+    - libstdc++6
+    - libstdc++6:i386
+    - net-tools
+    - iproute2
 
 script:
 

+ 63 - 15
tests/tests_jc2server.sh

@@ -423,7 +423,7 @@ fn_setstatus(){
 
 # 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
+# if expecting a pass
 fn_test_result_pass(){
 	if [ $? != 0 ]; then
 		echo "================================="
@@ -441,7 +441,7 @@ fn_test_result_pass(){
 	fi
 }
 
-# if excpecting a fail
+# if expecting a fail
 fn_test_result_fail(){
 	if [ $? == 0 ]; then
 		echo "================================="
@@ -528,7 +528,6 @@ echo "Command: ./jc2server auto-install"
 (fn_autoinstall)
 fn_test_result_pass
 
-
 echo ""
 echo "3.1 - start"
 echo "================================="
@@ -701,16 +700,14 @@ fn_setstatus
 fn_test_result_pass
 
 echo ""
-echo "4.9 - update-functions"
+echo "Inserting IP address"
 echo "================================="
 echo "Description:"
-echo "runs update-functions."
-echo ""
-echo "Command: ./jc2server update-functions"
-requiredstatus="OFFLINE"
-fn_setstatus
-(command_update_functions.sh)
-fn_test_result_pass
+echo "Inserting Travis IP in to config."
+echo "Allows monitor to work"
+travisip=$(ip -o -4 addr|grep eth0|awk '{print $4}'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -v 127.0.0)
+sed -i "/BindIP/c\BindIP                      = \"${travisip}\"," "${serverfiles}/config.lua"
+echo "IP: ${travisip}"
 
 echo ""
 echo "5.1 - monitor - online"
@@ -723,7 +720,6 @@ fn_setstatus
 (command_monitor.sh)
 fn_test_result_pass
 
-
 echo ""
 echo "5.2 - monitor - offline - with lockfile"
 echo "================================="
@@ -737,7 +733,6 @@ date > "${rootdir}/${lockselfname}"
 (command_monitor.sh)
 fn_test_result_pass
 
-
 echo ""
 echo "5.3 - monitor - offline - no lockfile"
 echo "================================="
@@ -777,6 +772,61 @@ fn_setstatus
 (command_details.sh)
 fn_test_result_pass
 
+echo ""
+echo "6.1 - post details"
+echo "================================="
+echo "Description:"
+echo "post details."
+echo "Command: ./jc2server postdetails"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_postdetails.sh)
+fn_test_result_pass
+
+echo ""
+echo "7.0 - backup"
+echo "================================="
+echo "Description:"
+echo "run a backup."
+echo "Command: ./jc2server backup"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_backup.sh)
+fn_test_result_pass
+
+echo ""
+echo "8.0 - dev - detect glibc"
+echo "================================="
+echo "Description:"
+echo "detect glibc."
+echo "Command: ./jc2server detect-glibc"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_dev_detect_glibc.sh)
+fn_test_result_pass
+
+echo ""
+echo "8.1 - dev - detect ldd"
+echo "================================="
+echo "Description:"
+echo "detect ldd."
+echo "Command: ./jc2server detect-ldd"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_dev_detect_ldd.sh)
+fn_test_result_pass
+
+echo ""
+echo "8.2 - dev - detect deps"
+echo "================================="
+echo "Description:"
+echo "detect dependencies."
+echo "Command: ./jc2server detect-deps"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_dev_detect_deps.sh)
+fn_test_result_pass
+
 echo ""
 echo "================================="
 echo "Server Tests - Complete!"
@@ -784,8 +834,6 @@ echo "Using: ${gamename}"
 echo "================================="
 requiredstatus="OFFLINE"
 fn_setstatus
-sleep 1
 fn_print_info "Tidying up directories."
-sleep 1
 rm -rfv "${serverfiles}"
 core_exit.sh

+ 58 - 21
tests/tests_ts3server.sh

@@ -423,7 +423,7 @@ fn_setstatus(){
 
 # 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
+# if expecting a pass
 fn_test_result_pass(){
 	if [ $? != 0 ]; then
 		echo "================================="
@@ -441,7 +441,7 @@ fn_test_result_pass(){
 	fi
 }
 
-# if excpecting a fail
+# if expecting a fail
 fn_test_result_fail(){
 	if [ $? == 0 ]; then
 		echo "================================="
@@ -528,7 +528,6 @@ echo "Command: ./ts3server auto-install"
 (fn_autoinstall)
 fn_test_result_pass
 
-
 echo ""
 echo "3.1 - start"
 echo "================================="
@@ -606,29 +605,16 @@ fn_setstatus
 (command_restart.sh)
 fn_test_result_pass
 
-echo ""
 echo "4.1 - update"
 echo "================================="
 echo "Description:"
 echo "check for updates."
-echo "Command: ./jc2server update"
+echo "Command: ./ts3server update"
 requiredstatus="OFFLINE"
 fn_setstatus
 (command_update.sh)
 fn_test_result_pass
 
-echo ""
-echo "4.2 - update-functions"
-echo "================================="
-echo "Description:"
-echo "runs update-functions."
-echo ""
-echo "Command: ./jc2server update-functions"
-requiredstatus="OFFLINE"
-fn_setstatus
-(command_update_functions.sh)
-fn_test_result_pass
-
 echo ""
 echo "5.1 - monitor - online"
 echo "================================="
@@ -640,7 +626,6 @@ fn_setstatus
 (command_monitor.sh)
 fn_test_result_pass
 
-
 echo ""
 echo "5.2 - monitor - offline - with lockfile"
 echo "================================="
@@ -654,7 +639,6 @@ date > "${rootdir}/${lockselfname}"
 (command_monitor.sh)
 fn_test_result_pass
 
-
 echo ""
 echo "5.3 - monitor - offline - no lockfile"
 echo "================================="
@@ -677,6 +661,61 @@ fn_setstatus
 (command_details.sh)
 fn_test_result_pass
 
+echo ""
+echo "6.1 - post details"
+echo "================================="
+echo "Description:"
+echo "post details."
+echo "Command: ./jc2server postdetails"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_postdetails.sh)
+fn_test_result_pass
+
+echo ""
+echo "7.0 - backup"
+echo "================================="
+echo "Description:"
+echo "run a backup."
+echo "Command: ./jc2server backup"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_backup.sh)
+fn_test_result_pass
+
+echo ""
+echo "8.0 - dev - detect glibc"
+echo "================================="
+echo "Description:"
+echo "detect glibc."
+echo "Command: ./jc2server detect-glibc"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_dev_detect_glibc.sh)
+fn_test_result_pass
+
+echo ""
+echo "8.1 - dev - detect ldd"
+echo "================================="
+echo "Description:"
+echo "detect ldd."
+echo "Command: ./jc2server detect-ldd"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_dev_detect_ldd.sh)
+fn_test_result_pass
+
+echo ""
+echo "8.2 - dev - detect deps"
+echo "================================="
+echo "Description:"
+echo "detect dependencies."
+echo "Command: ./jc2server detect-deps"
+requiredstatus="ONLINE"
+fn_setstatus
+(command_dev_detect_deps.sh)
+fn_test_result_pass
+
 echo ""
 echo "================================="
 echo "Server Tests - Complete!"
@@ -684,8 +723,6 @@ echo "Using: ${gamename}"
 echo "================================="
 requiredstatus="OFFLINE"
 fn_setstatus
-sleep 1
 fn_print_info "Tidying up directories."
-sleep 1
 rm -rfv "${serverfiles}"
 core_exit.sh