#!/bin/bash test_info() { cat </dev/null 2>&1" wait_until_get_src_socket "tcp" "${test_ip}:${test_port}" $nc_pid "nc" src_socket="$out" echo "Source socket is $src_socket" # This should happen as soon as connection is up... but unless we wait # we sometimes beat the registration. echo "Checking if CIFS connection is tracked by CTDB on test node..." wait_until 10 check_tickles $test_node $test_ip $test_port $src_socket echo "$out" if [ "${out/SRC: ${src_socket} /}" != "$out" ] ; then echo "GOOD: CIFS connection tracked OK by CTDB." else echo "BAD: Socket not tracked by CTDB." exit 1 fi # It would be nice if ss consistently used local/peer instead of src/dst ss_filter="src ${test_ip}:${test_port} dst ${src_socket}" try_command_on_node $test_node \ "ss -tn state established '${ss_filter}' | tail -n +2" if [ -z "$out" ] ; then echo "BAD: ss did not list the socket" exit 1 fi echo "GOOD: ss lists the socket:" echo "$out" echo "Disabling node $test_node" try_command_on_node 1 $CTDB disable -n $test_node wait_until_node_has_status $test_node disabled try_command_on_node $test_node \ "ss -tn state established '${ss_filter}' | tail -n +2" if [ -n "$out" ] ; then echo "BAD: ss listed the socket after failover" exit 1 fi echo "GOOD: ss no longer lists the socket"