mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
a8dd716146
This avoids issuing multiple "ctdb killtcp" commands to terminate tcp connections, one per connection. This will considerably reduce the time when there is a large number of tcp connections. This also makes it possible to avoid calling "ctdb killtcp" when there are no connections. Add a couple of unit tests for killtcp and update eventscript unit test infrastructure to support. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit a20d94717d2e4ab866d8a002cdf39c0669b74c6a)
33 lines
660 B
Bash
Executable File
33 lines
660 B
Bash
Executable File
#!/bin/sh
|
|
|
|
. "${TEST_SCRIPTS_DIR}/unit.sh"
|
|
|
|
define_test "Release 1 IP, 10 connections killed OK"
|
|
|
|
setup_ctdb
|
|
|
|
ctdb_get_1_public_address |
|
|
while read dev ip bits ; do
|
|
ip addr add "${ip}/${bits}" dev "$dev"
|
|
|
|
# Setup 10 fake connections...
|
|
count=10
|
|
out=""
|
|
nl="
|
|
"
|
|
i=0
|
|
while [ $i -lt $count ] ; do
|
|
echo "${ip}:445 10.254.254.1:1230${i}"
|
|
# Expected output for killing this connection
|
|
out="${out}${out:+${nl}}Killing TCP connection 10.254.254.1:1230${i} ${ip}:445"
|
|
i=$(($i + 1))
|
|
done >"$FAKE_NETSTAT_TCP_ESTABLISHED_FILE"
|
|
|
|
ok <<EOF
|
|
$out
|
|
Killed $count TCP connections to released IP $ip
|
|
EOF
|
|
|
|
simple_test $dev $ip $bits
|
|
done
|