From a15396b793870d3046be88a17b484cd3f106e408 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Tue, 11 Oct 2016 17:32:14 +1030 Subject: [PATCH] Add server status test case --- tests/server | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/server b/tests/server index 09a1cd12..1375199d 100755 --- a/tests/server +++ b/tests/server @@ -50,9 +50,9 @@ setup_StartCreateInstanceDir() { assert [ ! -d "$SERVALINSTANCE_PATH" ] } test_StartCreateInstanceDir() { - executeOk $servald start + executeOk_servald start assert [ -d "$SERVALINSTANCE_PATH" ] - executeOk $servald stop + executeOk_servald stop tfw_cat --stdout --stderr } @@ -66,6 +66,28 @@ test_StartLogfile() { assert_servald_server_no_errors } +doc_Status="Server status" +test_Status() { + execute_servald --exit-status=1 status + extract_stdout_keyvalue instance_path 'instancepath' '.*' + extract_stdout_keyvalue status 'status' '.*' + assert [ "$instance_path" = "$SERVALINSTANCE_PATH" ] + assert [ "$status" = "stopped" ] + executeOk_servald start + extract_stdout_keyvalue start_pid 'pid' '[0-9]\+' + executeOk_servald status + extract_stdout_keyvalue instance_path 'instancepath' '.*' + extract_stdout_keyvalue status 'status' '.*' + extract_stdout_keyvalue pid 'pid' '[0-9]\+' + assert [ "$instance_path" = "$SERVALINSTANCE_PATH" ] + assert [ "$status" = "running" ] + assert [ "$pid" -eq "$start_pid" ] + executeOk_servald stop + execute_servald --exit-status=1 status + extract_stdout_keyvalue status 'status' '.*' + assert [ "$status" = "stopped" ] +} + doc_StartNoInterfaces="Starting server with no configured interfaces gives warning" setup_StartNoInterfaces() { setup @@ -121,7 +143,7 @@ setup_StartStart() { start_servald_server } test_StartStart() { - execute --exit-status=10 $servald start + execute_servald --exit-status=10 start extract_stdout_keyvalue start_instance_path 'instancepath' '.*' extract_stdout_keyvalue start_pid 'pid' '[0-9]\+' assert [ "$start_instance_path" = "$SERVALINSTANCE_PATH" ]