mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
Rename test $SCRIPT to $TEST_SCRIPT
The test.sh file's $SCRIPT variable now clashes with the new init/msm file's $SCRIPT var. So I renamed it
This commit is contained in:
parent
0fbb6c7d47
commit
4a5c1a04d5
131
test.sh
131
test.sh
@ -8,21 +8,21 @@ TMP_DIR="/tmp/msmtest"
|
|||||||
TEST_RAM="256"
|
TEST_RAM="256"
|
||||||
|
|
||||||
# Exit codes
|
# Exit codes
|
||||||
declare -r EX_OK=0
|
EX_OK=0
|
||||||
declare -r EX_INVALID_USER=64
|
EX_INVALID_USER=64
|
||||||
declare -r EX_INVALID_COMMAND=65
|
EX_INVALID_COMMAND=65
|
||||||
declare -r EX_INVALID_ARGUMENT=66
|
EX_INVALID_ARGUMENT=66
|
||||||
declare -r EX_SERVER_STOPPED=67
|
EX_SERVER_STOPPED=67
|
||||||
declare -r EX_SERVER_RUNNING=68
|
EX_SERVER_RUNNING=68
|
||||||
declare -r EX_NAME_NOT_FOUND=69
|
EX_NAME_NOT_FOUND=69
|
||||||
declare -r EX_FILE_NOT_FOUND=70
|
EX_FILE_NOT_FOUND=70
|
||||||
declare -r EX_DUPLICATE_NAME=71
|
EX_DUPLICATE_NAME=71
|
||||||
declare -r EX_LOGS_NOT_ROLLED=72
|
EX_LOGS_NOT_ROLLED=72
|
||||||
declare -r EX_CONF_ERROR=73
|
EX_CONF_ERROR=73
|
||||||
|
|
||||||
oneTimeSetUp() {
|
oneTimeSetUp() {
|
||||||
# Variables used in tests
|
# Variables used in tests
|
||||||
SCRIPT="${MSM_SCRIPT:-${DIR}/init/msm}"
|
TEST_SCRIPT="${MSM_TEST_SCRIPT:-${DIR}/init/msm}"
|
||||||
export MSM_CONF="${TMP_DIR}/msm.conf"
|
export MSM_CONF="${TMP_DIR}/msm.conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,6 +38,7 @@ setUp() {
|
|||||||
echo "SERVER_STORAGE_PATH=\"${TMP_DIR}/servers\"" >> "$MSM_CONF"
|
echo "SERVER_STORAGE_PATH=\"${TMP_DIR}/servers\"" >> "$MSM_CONF"
|
||||||
echo "JAR_STORAGE_PATH=\"${TMP_DIR}/jars\"" >> "$MSM_CONF"
|
echo "JAR_STORAGE_PATH=\"${TMP_DIR}/jars\"" >> "$MSM_CONF"
|
||||||
echo "RAMDISK_STORAGE_PATH=\"${TMP_DIR}/fakeramdisk\"" >> "$MSM_CONF"
|
echo "RAMDISK_STORAGE_PATH=\"${TMP_DIR}/fakeramdisk\"" >> "$MSM_CONF"
|
||||||
|
echo "VERSIONING_STORAGE_PATH=\"${TMP_DIR}/versioning\"" >> "$MSM_CONF"
|
||||||
echo "WORLD_ARCHIVE_PATH=\"${TMP_DIR}/archives/worlds\"" >> "$MSM_CONF"
|
echo "WORLD_ARCHIVE_PATH=\"${TMP_DIR}/archives/worlds\"" >> "$MSM_CONF"
|
||||||
echo "LOG_ARCHIVE_PATH=\"${TMP_DIR}/archives/logs\"" >> "$MSM_CONF"
|
echo "LOG_ARCHIVE_PATH=\"${TMP_DIR}/archives/logs\"" >> "$MSM_CONF"
|
||||||
echo "BACKUP_ARCHIVE_PATH=\"${TMP_DIR}/archives/backups\"" >> "$MSM_CONF"
|
echo "BACKUP_ARCHIVE_PATH=\"${TMP_DIR}/archives/backups\"" >> "$MSM_CONF"
|
||||||
@ -46,7 +47,7 @@ setUp() {
|
|||||||
echo "DEFAULT_SCREEN_NAME=\"msmtest-{SERVER_NAME}\"" >> "$MSM_CONF"
|
echo "DEFAULT_SCREEN_NAME=\"msmtest-{SERVER_NAME}\"" >> "$MSM_CONF"
|
||||||
echo "DEFAULT_INVOCATION=\"java -Xmx${TEST_RAM}M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:+AggressiveOpts -jar {JAR} nogui\"" >> "$MSM_CONF"
|
echo "DEFAULT_INVOCATION=\"java -Xmx${TEST_RAM}M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:+AggressiveOpts -jar {JAR} nogui\"" >> "$MSM_CONF"
|
||||||
|
|
||||||
source $SCRIPT
|
source $TEST_SCRIPT
|
||||||
|
|
||||||
# Variables accessible by all tests, which are set by the stdall, stderr,
|
# Variables accessible by all tests, which are set by the stdall, stderr,
|
||||||
# stdout and quiet utility functions.
|
# stdout and quiet utility functions.
|
||||||
@ -135,7 +136,7 @@ quiet() {
|
|||||||
### "msm server list" tests
|
### "msm server list" tests
|
||||||
|
|
||||||
test_listing_no_servers() {
|
test_listing_no_servers() {
|
||||||
expect_stderr_empty $SCRIPT server list
|
expect_stderr_empty $TEST_SCRIPT server list
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +145,7 @@ test_listing_no_servers() {
|
|||||||
test_reserved_server_names() {
|
test_reserved_server_names() {
|
||||||
manager_property SERVER_STORAGE_PATH
|
manager_property SERVER_STORAGE_PATH
|
||||||
for name in "start" "stop" "restart" "server" "version" "jargroup" "all"; do
|
for name in "start" "stop" "restart" "server" "version" "jargroup" "all"; do
|
||||||
expect_stderr $SCRIPT server create $name
|
expect_stderr $TEST_SCRIPT server create $name
|
||||||
assertEquals "Incorrect exit code when creating server name \"$name\"." $EX_INVALID_ARGUMENT $EXIT_CODE
|
assertEquals "Incorrect exit code when creating server name \"$name\"." $EX_INVALID_ARGUMENT $EXIT_CODE
|
||||||
assertFalse "Server \"$name\" directory was created when it should not have been." "[ -d \"$SETTINGS_SERVER_STORAGE_PATH/$name\" ]"
|
assertFalse "Server \"$name\" directory was created when it should not have been." "[ -d \"$SETTINGS_SERVER_STORAGE_PATH/$name\" ]"
|
||||||
done
|
done
|
||||||
@ -152,7 +153,7 @@ test_reserved_server_names() {
|
|||||||
|
|
||||||
test_common_invalid_server_names() {
|
test_common_invalid_server_names() {
|
||||||
manager_property SERVER_STORAGE_PATH
|
manager_property SERVER_STORAGE_PATH
|
||||||
expect_stderr $SCRIPT server create "name with spaces"
|
expect_stderr $TEST_SCRIPT server create "name with spaces"
|
||||||
assertEquals "Incorrect exit code when creating server name \"name with spaces\"." $EX_INVALID_ARGUMENT $EXIT_CODE
|
assertEquals "Incorrect exit code when creating server name \"name with spaces\"." $EX_INVALID_ARGUMENT $EXIT_CODE
|
||||||
assertFalse "Server \"name with spaces\" directory was created when it should not have been." "[ -d \"$SETTINGS_SERVER_STORAGE_PATH/name with spaces\" ]"
|
assertFalse "Server \"name with spaces\" directory was created when it should not have been." "[ -d \"$SETTINGS_SERVER_STORAGE_PATH/name with spaces\" ]"
|
||||||
}
|
}
|
||||||
@ -160,7 +161,7 @@ test_common_invalid_server_names() {
|
|||||||
test_valid_edge_case_server_names() {
|
test_valid_edge_case_server_names() {
|
||||||
manager_property SERVER_STORAGE_PATH
|
manager_property SERVER_STORAGE_PATH
|
||||||
for name in "serverstart" "CapitalLetters" "0987654321" "name-with-dashes" "name_with_underscores" "Combination-of_different1Things2"; do
|
for name in "serverstart" "CapitalLetters" "0987654321" "name-with-dashes" "name_with_underscores" "Combination-of_different1Things2"; do
|
||||||
expect_stderr_empty $SCRIPT server create $name
|
expect_stderr_empty $TEST_SCRIPT server create $name
|
||||||
assertEquals "Incorrect exit code when creating server name \"$name\"." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code when creating server name \"$name\"." $EX_OK $EXIT_CODE
|
||||||
assertTrue "Server \"$name\" directory was NOT created when it should have been." "[ -d \"$SETTINGS_SERVER_STORAGE_PATH/$name\" ]"
|
assertTrue "Server \"$name\" directory was NOT created when it should have been." "[ -d \"$SETTINGS_SERVER_STORAGE_PATH/$name\" ]"
|
||||||
done
|
done
|
||||||
@ -168,7 +169,7 @@ test_valid_edge_case_server_names() {
|
|||||||
|
|
||||||
test_creating_server_without_any_jargroups() {
|
test_creating_server_without_any_jargroups() {
|
||||||
manager_property SERVER_STORAGE_PATH
|
manager_property SERVER_STORAGE_PATH
|
||||||
expect_stderr_empty $SCRIPT server create example
|
expect_stderr_empty $TEST_SCRIPT server create example
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
assertTrue "Server was not created." "[ -d \"$SETTINGS_SERVER_STORAGE_PATH/example\" ]"
|
assertTrue "Server was not created." "[ -d \"$SETTINGS_SERVER_STORAGE_PATH/example\" ]"
|
||||||
}
|
}
|
||||||
@ -176,9 +177,9 @@ test_creating_server_without_any_jargroups() {
|
|||||||
# Assumes: test_create_server_without_any_jargroups
|
# Assumes: test_create_server_without_any_jargroups
|
||||||
test_creating_server_when_that_name_already_exists() {
|
test_creating_server_when_that_name_already_exists() {
|
||||||
# Create server "example"
|
# Create server "example"
|
||||||
quiet $SCRIPT server create example
|
quiet $TEST_SCRIPT server create example
|
||||||
# Create another server called "example", should be prevented
|
# Create another server called "example", should be prevented
|
||||||
expect_stderr $SCRIPT server create example
|
expect_stderr $TEST_SCRIPT server create example
|
||||||
|
|
||||||
assertEquals "Incorrect exit code." $EX_DUPLICATE_NAME $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_DUPLICATE_NAME $EXIT_CODE
|
||||||
}
|
}
|
||||||
@ -187,12 +188,12 @@ test_creating_server_when_that_name_already_exists() {
|
|||||||
test_creating_server_with_jar_groups() {
|
test_creating_server_with_jar_groups() {
|
||||||
# Create the "minecraft" jar group, which is used by default when creating
|
# Create the "minecraft" jar group, which is used by default when creating
|
||||||
# new servers.
|
# new servers.
|
||||||
quiet $SCRIPT jargroup create minecraft "https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar"
|
quiet $TEST_SCRIPT jargroup create minecraft "https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar"
|
||||||
# Create a new server that will use the "minecraft" jar group.
|
# Create a new server that will use the "minecraft" jar group.
|
||||||
expect_stderr_empty $SCRIPT server create example
|
expect_stderr_empty $TEST_SCRIPT server create example
|
||||||
|
|
||||||
# Script must be sourced again to recognise the new server
|
# Script must be sourced again to recognise the new server
|
||||||
source $SCRIPT
|
source $TEST_SCRIPT
|
||||||
|
|
||||||
manager_property SERVER_STORAGE_PATH
|
manager_property SERVER_STORAGE_PATH
|
||||||
server_get_id "example"
|
server_get_id "example"
|
||||||
@ -208,14 +209,14 @@ test_creating_server_with_jar_groups() {
|
|||||||
### "msm server delete" tests
|
### "msm server delete" tests
|
||||||
|
|
||||||
test_deleting_server_that_does_not_exist() {
|
test_deleting_server_that_does_not_exist() {
|
||||||
expect_stderr $SCRIPT server delete example
|
expect_stderr $TEST_SCRIPT server delete example
|
||||||
assertEquals "Incorrect exit code." $EX_NAME_NOT_FOUND $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_NAME_NOT_FOUND $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
# Assumes: test_creating_server_without_any_jargroups
|
# Assumes: test_creating_server_without_any_jargroups
|
||||||
test_deleting_server_that_exists_and_is_stopped() {
|
test_deleting_server_that_exists_and_is_stopped() {
|
||||||
quiet $SCRIPT server create example
|
quiet $TEST_SCRIPT server create example
|
||||||
expect_stderr_empty $SCRIPT server delete example <<< "y"
|
expect_stderr_empty $TEST_SCRIPT server delete example <<< "y"
|
||||||
|
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
assertFalse "Server directory was not removed." "[ -d \"$SERVER_STORAGE_PATH/example\" ]"
|
assertFalse "Server directory was not removed." "[ -d \"$SERVER_STORAGE_PATH/example\" ]"
|
||||||
@ -224,14 +225,14 @@ test_deleting_server_that_exists_and_is_stopped() {
|
|||||||
### "msm server rename" tests
|
### "msm server rename" tests
|
||||||
|
|
||||||
test_renaming_server_that_does_not_exist() {
|
test_renaming_server_that_does_not_exist() {
|
||||||
expect_stderr $SCRIPT server rename example example_new_name
|
expect_stderr $TEST_SCRIPT server rename example example_new_name
|
||||||
assertEquals "Incorrect exit code." $EX_NAME_NOT_FOUND $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_NAME_NOT_FOUND $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
# Assumes: test_creating_server_without_any_jargroups
|
# Assumes: test_creating_server_without_any_jargroups
|
||||||
test_renaming_server_that_exists_and_is_stopped() {
|
test_renaming_server_that_exists_and_is_stopped() {
|
||||||
quiet $SCRIPT server create example
|
quiet $TEST_SCRIPT server create example
|
||||||
expect_stderr_empty $SCRIPT server rename example example_new_name
|
expect_stderr_empty $TEST_SCRIPT server rename example example_new_name
|
||||||
|
|
||||||
manager_property SERVER_STORAGE_PATH
|
manager_property SERVER_STORAGE_PATH
|
||||||
|
|
||||||
@ -247,64 +248,64 @@ test_renaming_server_that_exists_and_is_stopped() {
|
|||||||
### "msm <server> stop" tests
|
### "msm <server> stop" tests
|
||||||
|
|
||||||
test_stopped_server_stop() {
|
test_stopped_server_stop() {
|
||||||
quiet $SCRIPT server create stoppedserver
|
quiet $TEST_SCRIPT server create stoppedserver
|
||||||
expect_stdout $SCRIPT stoppedserver stop
|
expect_stdout $TEST_SCRIPT stoppedserver stop
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
### "msm <server> status" tests
|
### "msm <server> status" tests
|
||||||
|
|
||||||
test_stopped_server_status() {
|
test_stopped_server_status() {
|
||||||
quiet $SCRIPT server create stoppedserver
|
quiet $TEST_SCRIPT server create stoppedserver
|
||||||
expect_stdout $SCRIPT stoppedserver status
|
expect_stdout $TEST_SCRIPT stoppedserver status
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
### "msm <server> connected" tests
|
### "msm <server> connected" tests
|
||||||
|
|
||||||
test_stopped_server_connected() {
|
test_stopped_server_connected() {
|
||||||
quiet $SCRIPT server create stoppedserver
|
quiet $TEST_SCRIPT server create stoppedserver
|
||||||
expect_stdout $SCRIPT stoppedserver connected
|
expect_stdout $TEST_SCRIPT stoppedserver connected
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
### "msm <server> worlds list" tests
|
### "msm <server> worlds list" tests
|
||||||
|
|
||||||
test_stopped_server_worlds_list_none() {
|
test_stopped_server_worlds_list_none() {
|
||||||
quiet $SCRIPT server create stoppedserver
|
quiet $TEST_SCRIPT server create stoppedserver
|
||||||
expect_stdout $SCRIPT stoppedserver worlds list
|
expect_stdout $TEST_SCRIPT stoppedserver worlds list
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
### "msm <server> worlds load" tests
|
### "msm <server> worlds load" tests
|
||||||
|
|
||||||
test_stopped_server_worlds_load_none() {
|
test_stopped_server_worlds_load_none() {
|
||||||
quiet $SCRIPT server create stoppedserver
|
quiet $TEST_SCRIPT server create stoppedserver
|
||||||
expect_stdout $SCRIPT stoppedserver worlds load
|
expect_stdout $TEST_SCRIPT stoppedserver worlds load
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
### "msm <server> worlds ram" tests
|
### "msm <server> worlds ram" tests
|
||||||
|
|
||||||
test_stopped_server_worlds_ram_name_not_found() {
|
test_stopped_server_worlds_ram_name_not_found() {
|
||||||
quiet $SCRIPT server create stoppedserver
|
quiet $TEST_SCRIPT server create stoppedserver
|
||||||
expect_stderr $SCRIPT stoppedserver worlds ram non_existant_world_name
|
expect_stderr $TEST_SCRIPT stoppedserver worlds ram non_existant_world_name
|
||||||
assertEquals "Incorrect exit code." $EX_NAME_NOT_FOUND $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_NAME_NOT_FOUND $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
### "msm <server> worlds todisk" tests
|
### "msm <server> worlds todisk" tests
|
||||||
|
|
||||||
test_stopped_server_worlds_todisk_none() {
|
test_stopped_server_worlds_todisk_none() {
|
||||||
quiet $SCRIPT server create stoppedserver
|
quiet $TEST_SCRIPT server create stoppedserver
|
||||||
expect_stdout $SCRIPT stoppedserver worlds todisk
|
expect_stdout $TEST_SCRIPT stoppedserver worlds todisk
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
### "msm <server> worlds backup" tests
|
### "msm <server> worlds backup" tests
|
||||||
|
|
||||||
test_stopped_server_worlds_todisk_none() {
|
test_stopped_server_worlds_todisk_none() {
|
||||||
quiet $SCRIPT server create stoppedserver
|
quiet $TEST_SCRIPT server create stoppedserver
|
||||||
expect_stdout $SCRIPT stoppedserver worlds backup
|
expect_stdout $TEST_SCRIPT stoppedserver worlds backup
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,8 +316,8 @@ test_stopped_server_worlds_todisk_none() {
|
|||||||
### "msm <server> logroll" tests
|
### "msm <server> logroll" tests
|
||||||
|
|
||||||
test_stopped_server_logroll_empty() {
|
test_stopped_server_logroll_empty() {
|
||||||
quiet $SCRIPT server create stoppedserver
|
quiet $TEST_SCRIPT server create stoppedserver
|
||||||
expect_stdout $SCRIPT stoppedserver logroll
|
expect_stdout $TEST_SCRIPT stoppedserver logroll
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,8 +326,8 @@ test_stopped_server_logroll_empty() {
|
|||||||
test_stopped_server_backup() {
|
test_stopped_server_backup() {
|
||||||
manager_property BACKUP_ARCHIVE_PATH
|
manager_property BACKUP_ARCHIVE_PATH
|
||||||
|
|
||||||
quiet $SCRIPT server create stoppedserver
|
quiet $TEST_SCRIPT server create stoppedserver
|
||||||
expect_stdout $SCRIPT stoppedserver backup
|
expect_stdout $TEST_SCRIPT stoppedserver backup
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
assertNotNull "Server backup was not created." "find '$SETTINGS_BACKUP_ARCHIVE_PATH/stoppedserver' -mindepth 1 -maxdepth 1 -type f -name '*.zip'"
|
assertNotNull "Server backup was not created." "find '$SETTINGS_BACKUP_ARCHIVE_PATH/stoppedserver' -mindepth 1 -maxdepth 1 -type f -name '*.zip'"
|
||||||
}
|
}
|
||||||
@ -334,9 +335,9 @@ test_stopped_server_backup() {
|
|||||||
### "msm <server> jar" tests
|
### "msm <server> jar" tests
|
||||||
|
|
||||||
test_stopped_server_jar() {
|
test_stopped_server_jar() {
|
||||||
quiet $SCRIPT server create stoppedserver
|
quiet $TEST_SCRIPT server create stoppedserver
|
||||||
|
|
||||||
source $SCRIPT
|
source $TEST_SCRIPT
|
||||||
|
|
||||||
server_get_id "stoppedserver"
|
server_get_id "stoppedserver"
|
||||||
local sid="$RETURN"
|
local sid="$RETURN"
|
||||||
@ -347,10 +348,10 @@ test_stopped_server_jar() {
|
|||||||
rm -f "$JAR_PATH"
|
rm -f "$JAR_PATH"
|
||||||
|
|
||||||
# Create new jargroup
|
# Create new jargroup
|
||||||
quiet $SCRIPT jargroup create newgroup "https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar"
|
quiet $TEST_SCRIPT jargroup create newgroup "https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar"
|
||||||
|
|
||||||
# Assign jargroup's latest jar to server
|
# Assign jargroup's latest jar to server
|
||||||
expect_stdout $SCRIPT stoppedserver jar newgroup
|
expect_stdout $TEST_SCRIPT stoppedserver jar newgroup
|
||||||
|
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
assertTrue "Server jar (${SERVER_JAR_PATH[$sid]}) was not linked." "[ -f \"${SERVER_JAR_PATH[$sid]}\" ]"
|
assertTrue "Server jar (${SERVER_JAR_PATH[$sid]}) was not linked." "[ -f \"${SERVER_JAR_PATH[$sid]}\" ]"
|
||||||
@ -501,14 +502,14 @@ test_stopped_server_jar() {
|
|||||||
|
|
||||||
test_reserved_jargroup_names() {
|
test_reserved_jargroup_names() {
|
||||||
for name in "start" "stop" "restart" "server" "version" "jargroup" "all"; do
|
for name in "start" "stop" "restart" "server" "version" "jargroup" "all"; do
|
||||||
expect_stderr $SCRIPT jargroup create "$name" https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
expect_stderr $TEST_SCRIPT jargroup create "$name" https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
||||||
assertEquals "Incorrect exit code when creating jar group name \"$name\"." $EX_INVALID_ARGUMENT $EXIT_CODE
|
assertEquals "Incorrect exit code when creating jar group name \"$name\"." $EX_INVALID_ARGUMENT $EXIT_CODE
|
||||||
assertFalse "Jar group \"$name\" directory was created when it should not have been." "[ -d \"$JAR_STORAGE_PATH/$name\" ]"
|
assertFalse "Jar group \"$name\" directory was created when it should not have been." "[ -d \"$JAR_STORAGE_PATH/$name\" ]"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
test_common_invalid_jargroups_names() {
|
test_common_invalid_jargroups_names() {
|
||||||
expect_stderr $SCRIPT jargroup create "name with spaces" https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
expect_stderr $TEST_SCRIPT jargroup create "name with spaces" https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
||||||
assertEquals "Incorrect exit code when creating jar group name \"name with spaces\"." $EX_INVALID_ARGUMENT $EXIT_CODE
|
assertEquals "Incorrect exit code when creating jar group name \"name with spaces\"." $EX_INVALID_ARGUMENT $EXIT_CODE
|
||||||
assertFalse "Jar group \"name with spaces\" directory was created when it should not have been." "[ -d \"$JAR_STORAGE_PATH/name with spaces\" ]"
|
assertFalse "Jar group \"name with spaces\" directory was created when it should not have been." "[ -d \"$JAR_STORAGE_PATH/name with spaces\" ]"
|
||||||
}
|
}
|
||||||
@ -516,43 +517,43 @@ test_common_invalid_jargroups_names() {
|
|||||||
test_valid_edge_case_jargroup_names() {
|
test_valid_edge_case_jargroup_names() {
|
||||||
manager_property JAR_STORAGE_PATH
|
manager_property JAR_STORAGE_PATH
|
||||||
for name in "serverstart" "CapitalLetters" "0987654321" "name-with-dashes" "name_with_underscores" "Combination-of_different1Things2"; do
|
for name in "serverstart" "CapitalLetters" "0987654321" "name-with-dashes" "name_with_underscores" "Combination-of_different1Things2"; do
|
||||||
expect_stderr_empty $SCRIPT jargroup create $name https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
expect_stderr_empty $TEST_SCRIPT jargroup create $name https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
||||||
assertEquals "Incorrect exit code when creating jar group name \"$name\"." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code when creating jar group name \"$name\"." $EX_OK $EXIT_CODE
|
||||||
assertTrue "Jar group \"$name\" directory was NOT created when it should have been." "[ -d \"$SETTINGS_JAR_STORAGE_PATH/$name\" ]"
|
assertTrue "Jar group \"$name\" directory was NOT created when it should have been." "[ -d \"$SETTINGS_JAR_STORAGE_PATH/$name\" ]"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
test_creating_jargroup() {
|
test_creating_jargroup() {
|
||||||
expect_stderr_empty $SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
expect_stderr_empty $TEST_SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
# Assumes: test_creating_jargroup
|
# Assumes: test_creating_jargroup
|
||||||
test_creating_jargroup_when_that_name_already_exists() {
|
test_creating_jargroup_when_that_name_already_exists() {
|
||||||
quiet $SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
quiet $TEST_SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
||||||
expect_stderr $SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
expect_stderr $TEST_SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
||||||
assertEquals "Incorrect exit code." $EX_DUPLICATE_NAME $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_DUPLICATE_NAME $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
### "msm jargroup list" test
|
### "msm jargroup list" test
|
||||||
|
|
||||||
test_listing_no_jargroups() {
|
test_listing_no_jargroups() {
|
||||||
expect_stderr_empty $SCRIPT jargroup list
|
expect_stderr_empty $TEST_SCRIPT jargroup list
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
# Assumes: test_creating_jargroup
|
# Assumes: test_creating_jargroup
|
||||||
test_listing_one_jargroup() {
|
test_listing_one_jargroup() {
|
||||||
quiet $SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
quiet $TEST_SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
||||||
expect_stderr_empty $SCRIPT jargroup list
|
expect_stderr_empty $TEST_SCRIPT jargroup list
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
# Assumes: test_creating_jargroup
|
# Assumes: test_creating_jargroup
|
||||||
test_listing_multiple_jargroups() {
|
test_listing_multiple_jargroups() {
|
||||||
quiet $SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
quiet $TEST_SCRIPT jargroup create minecraft https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
|
||||||
quiet $SCRIPT jargroup create craftbukkit http://dl.bukkit.org/latest-rb/craftbukkit.jar
|
quiet $TEST_SCRIPT jargroup create craftbukkit http://dl.bukkit.org/latest-rb/craftbukkit.jar
|
||||||
expect_stderr_empty $SCRIPT jargroup list
|
expect_stderr_empty $TEST_SCRIPT jargroup list
|
||||||
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
assertEquals "Incorrect exit code." $EX_OK $EXIT_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user