mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-21 01:42:18 +00:00
Add test case for server start while already running
This commit is contained in:
parent
889f9c4628
commit
f5a99238cb
@ -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
|
||||
|
20
tests/server
20
tests/server
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user