smbd: Simplify validate_lock_entries
[Samba.git] / ctdb / tests / eventscripts / 10.interface.releaseip.011.sh
blobe1514eea8806ee4e667dddb93b3a94efd0c40eb9
1 #!/bin/sh
3 . "${TEST_SCRIPTS_DIR}/unit.sh"
5 define_test "Release 1 IP, 10 connections killed, 1 fails"
7 setup_ctdb
9 ctdb_get_1_public_address |
10 while read dev ip bits ; do
11 ip addr add "${ip}/${bits}" dev "$dev"
13 # Setup 10 fake connections...
14 count=10
15 out=""
16 nl="
18 i=0
19 while [ $i -lt $count ] ; do
20 echo "${ip}:445 10.254.254.1:1230${i}"
21 # Expected output for killing this connection
22 out="${out}${out:+${nl}}Killing TCP connection 10.254.254.1:1230${i} ${ip}:445"
23 i=$(($i + 1))
24 done >"$FAKE_NETSTAT_TCP_ESTABLISHED_FILE"
26 # Note that the fake TCP killing done by the "ctdb killtcp" stub
27 # can only kill conections in the file, so killing this connection
28 # will never succeed so it will look like a time out.
29 FAKE_NETSTAT_TCP_ESTABLISHED="${ip}:445|10.254.254.1:43210"
31 ok <<EOF
32 Killing TCP connection 10.254.254.1:43210 ${ip}:445
33 $out
34 Waiting for 1 connections to be killed for IP ${ip}
35 Waiting for 1 connections to be killed for IP ${ip}
36 Waiting for 1 connections to be killed for IP ${ip}
37 Timed out killing tcp connections for IP $ip (1 remaining)
38 EOF
40 simple_test $dev $ip $bits
41 done