1616set -e
1717# set -x # verbose
1818
19+ # shellcheck disable=SC2155
1920declare -r my_path=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
20- declare -r root_path=" $my_path /.."
2121
2222declare -r app_name=' it_Clustered_swim_ungraceful_shutdown'
2323
24- source ${my_path} /shared.sh
24+
25+ # shellcheck source=IntegrationTests/tests_01_cluster/shared.sh
26+ source " ${my_path} " /shared.sh
2527
2628declare -r first_logs=/tmp/sact_first.out
2729declare -r second_logs=/tmp/sact_second.out
@@ -33,15 +35,18 @@ rm -f ${killed_logs}
3335rm -f ${replacement_logs}
3436
3537stdbuf -i0 -o0 -e0 swift run it_Clustered_swim_ungraceful_shutdown Frist 7337 > ${first_logs} 2>&1 &
36- declare -r first_pid=$( echo $! )
38+ # shellcheck disable=SC2155
39+ declare -r first_pid=$( $! )
3740wait_log_exists ${first_logs} ' Binding to: ' 200 # since it might be compiling again...
3841
3942stdbuf -i0 -o0 -e0 swift run it_Clustered_swim_ungraceful_shutdown Second 8228 127.0.0.1 7337 > ${second_logs} 2>&1 &
40- declare -r second_pid=$( echo $! )
43+ # shellcheck disable=SC2155
44+ declare -r second_pid=$( $! )
4145wait_log_exists ${second_logs} ' Binding to: ' 200 # since it might be compiling again...
4246
4347stdbuf -i0 -o0 -e0 swift run it_Clustered_swim_ungraceful_shutdown Killed 9119 127.0.0.1 7337 > ${killed_logs} 2>&1 & # ignore-unacceptable-language
44- declare -r killed_pid=$( echo $! ) # ignore-unacceptable-language
48+ # shellcheck disable=SC2155
49+ declare -r killed_pid=$( $! ) # ignore-unacceptable-language
4550wait_log_exists ${killed_logs} ' Binding to: ' 200 # since it might be compiling again...
4651
4752echo " Waiting nodes to become .up..."
@@ -53,11 +58,12 @@ sleep 1
5358
5459# SIGKILL the third member, causing ungraceful shutdown
5560echo " Killing PID ${killed_pid} " # ignore-unacceptable-language
56- kill -9 ${killed_pid} # ignore-unacceptable-language
61+ kill -9 " ${killed_pid} " # ignore-unacceptable-language
5762
5863# Immediately restart the third process
5964stdbuf -i0 -o0 -e0 swift run it_Clustered_swim_ungraceful_shutdown Replacement 9119 127.0.0.1 7337 >> ${replacement_logs} 2>&1 &
60- declare -r replacement_pid=$( echo $! )
65+ # shellcheck disable=SC2155
66+ declare -r replacement_pid=$( $! )
6167wait_log_exists ${replacement_logs} ' Binding to: ' 200 # just to be safe...
6268
6369# The original third node should go .down while the replacement becomes .up
@@ -68,8 +74,8 @@ echo 'Replacement member .up, good...'
6874
6975# === cleanup ----------------------------------------------------------------------------------------------------------
7076
71- kill -9 ${first_pid} # ignore-unacceptable-language
72- kill -9 ${second_pid} # ignore-unacceptable-language
73- kill -9 ${replacement_pid} # ignore-unacceptable-language
77+ kill -9 " ${first_pid} " # ignore-unacceptable-language
78+ kill -9 " ${second_pid} " # ignore-unacceptable-language
79+ kill -9 " ${replacement_pid} " # ignore-unacceptable-language
7480
7581_killall ${app_name}
0 commit comments