Skip to content

Commit

Permalink
ctdb-tests: Don't use nc -d or -w options
Browse files Browse the repository at this point in the history
nmap-ncat is used in some distributions to replace netcat.  It has a
different meaning for these options.

We can get the same effect as the current combination of -d and -w by
piping a sleep process to nc.  Subsequent use of $! works because it
gets the last process in pipeline.

Note that redirecting from /dev/null doesn't work with some versions
of nc.  They just exit when they get EOF.

Signed-off-by: Martin Schwenke <[email protected]>
Reviewed-by: Amitay Isaacs <[email protected]>

Autobuild-User(master): Martin Schwenke <[email protected]>
Autobuild-Date(master): Fri Mar  9 12:24:13 CET 2018 on sn-devel-144
  • Loading branch information
martin-schwenke authored and Martin Schwenke committed Mar 9, 2018
1 parent bd66445 commit 9e954bc
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ctdb/tests/complex/30_nfs_tickle_killtcp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test_port=2049

echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."

nc -d -w 30 $test_ip $test_port &
sleep 30 | nc $test_ip $test_port &
nc_pid=$!
ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"

Expand Down
2 changes: 1 addition & 1 deletion ctdb/tests/complex/31_nfs_tickle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test_port=2049

echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."

nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
sleep $((monitor_interval * 4)) | nc $test_ip $test_port &
nc_pid=$!
ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"

Expand Down
2 changes: 1 addition & 1 deletion ctdb/tests/complex/32_cifs_tickle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test_port=445

echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."

nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
sleep $((monitor_interval * 4)) | nc $test_ip $test_port &
nc_pid=$!
ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"

Expand Down
2 changes: 1 addition & 1 deletion ctdb/tests/complex/34_nfs_tickle_restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test_port=2049

echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."

nc -d -w 600 $test_ip $test_port &
sleep 600 | nc $test_ip $test_port &
nc_pid=$!
ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"

Expand Down
2 changes: 1 addition & 1 deletion ctdb/tests/complex/36_smb_reset_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sleep_for 5

echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with nc..."

nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
sleep $((monitor_interval * 4)) | nc $test_ip $test_port &
nc_pid=$!
ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"

Expand Down
2 changes: 1 addition & 1 deletion ctdb/tests/complex/37_nfs_reset_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sleep_for 5

echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with nc..."

nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
sleep $((monitor_interval * 4)) | nc $test_ip $test_port &
nc_pid=$!
ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"

Expand Down

0 comments on commit 9e954bc

Please sign in to comment.