mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-21 06:03:12 +00:00
Use finally() function in test suites
Mainly to call stop_all_servald_servers(), which asserts that the server is still running and responding to orderly shutdown.
This commit is contained in:
parent
ed44dfe720
commit
381fc7cad8
@ -337,6 +337,7 @@ stop_servald_server() {
|
||||
tfw_log "# ended servald process: pid=$bpid"
|
||||
fi
|
||||
done
|
||||
pop_instance
|
||||
}
|
||||
|
||||
# Utility function:
|
||||
@ -349,7 +350,6 @@ report_servald_server() {
|
||||
tfw_core_backtrace "$servald" "$instance_dir/core"
|
||||
rm -f "$instance_dir/core"
|
||||
fi
|
||||
pop_instance
|
||||
}
|
||||
|
||||
# Utility function:
|
||||
@ -423,7 +423,7 @@ stop_all_servald_servers() {
|
||||
# Utility function for tearing down servald fixtures:
|
||||
# - log a report of the execution of all servald server process instances
|
||||
report_all_servald_servers() {
|
||||
foreach_instance_with_pidfile report_servald_server
|
||||
foreach_instance +{A..Z} report_servald_server
|
||||
}
|
||||
|
||||
# Utility function for tearing down servald fixtures:
|
||||
@ -498,7 +498,7 @@ get_servald_pids() {
|
||||
assert_no_servald_processes() {
|
||||
local pids
|
||||
get_servald_pids pids
|
||||
assert --message="$servald_basename process(es) running: $pids" [ -z "$pids" ]
|
||||
assert --message="no $servald_basename process(es) running" [ -z "$pids" ]
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -47,10 +47,14 @@ setup() {
|
||||
executeOk_servald config set debug.all Yes
|
||||
}
|
||||
|
||||
teardown() {
|
||||
finally() {
|
||||
stop_all_servald_servers
|
||||
}
|
||||
|
||||
teardown() {
|
||||
kill_all_servald_processes
|
||||
assert_no_servald_processes
|
||||
report_all_servald_servers
|
||||
}
|
||||
|
||||
set_server_vars() {
|
||||
|
@ -24,15 +24,14 @@ source "${0%/*}/../testdefs_rhizome.sh"
|
||||
|
||||
shopt -s extglob
|
||||
|
||||
finally() {
|
||||
stop_all_servald_servers
|
||||
}
|
||||
|
||||
teardown() {
|
||||
kill_all_servald_processes
|
||||
assert_no_servald_processes
|
||||
report_all_servald_processes
|
||||
}
|
||||
|
||||
setup_rhizome() {
|
||||
foreach_instance +A +B create_single_identity
|
||||
set_instance +B
|
||||
report_all_servald_servers
|
||||
}
|
||||
|
||||
# Called by start_servald_instances for each instance.
|
||||
@ -109,8 +108,9 @@ setup_curl_7() {
|
||||
|
||||
setup_common() {
|
||||
setup_servald
|
||||
setup_rhizome
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B create_single_identity
|
||||
set_instance +B
|
||||
}
|
||||
|
||||
extract_manifest_vars() {
|
||||
@ -431,7 +431,6 @@ test_FileTransferStress() {
|
||||
assert_rhizome_list --fromhere=1 file-$i-* --fromhere=0 file-!($i)-*
|
||||
assert_received file-!($i)-*
|
||||
done
|
||||
assert_status_all_servald_servers running
|
||||
}
|
||||
|
||||
runTests "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user