Add test case for server start while already running

This commit is contained in:
Andrew Bettison 2012-06-26 16:09:22 +09:30
parent 889f9c4628
commit f5a99238cb
2 changed files with 21 additions and 6 deletions

View File

@ -118,9 +118,10 @@ setup_servald_so() {
}
# Utility function for setting up a fixture with a servald server process:
# - Ensure that no servald processes are running
# - Start a servald server process
# - Ensure that it is still running after one second
# - start a servald server process
# - assert that the pidfile is created and correct
# - set $servald_pid to the PID of the started server process
# - assert that the reported PID is actually a running servald process
start_servald_server() {
push_instance
set_instance_fromarg "$1" && shift

View File

@ -77,13 +77,27 @@ test_StartNoErrors() {
tfw_cat "$instance_servald_log"
}
doc_StartStopStart="Start and stop server with slow startup"
setup_StartStopStart() {
doc_StartStart="Start server while already running"
setup_StartStart() {
setup
executeOk_servald config set interfaces "+"
start_servald_server
}
test_StartStart() {
execute --exit-status=10 $servald start
extract_stdout_keyvalue start_instance_path instancepath '.*'
extract_stdout_keyvalue start_pid pid '[0-9]\+'
assert [ "$start_instance_path" = "$SERVALINSTANCE_PATH" ]
assert [ "$servald_pid" = "$start_pid" ]
}
doc_StartStopFast="Stop server before it finishes starting"
setup_StartStopFast() {
setup
executeOk_servald config set interfaces "+"
export SERVALD_SERVER_START_DELAY=250
}
test_StartStopStart() {
test_StartStopFast() {
start_servald_server
stop_servald_server
}