summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2012-06-19 17:20:18 +1000
committerMartin Schwenke <martin@meltin.net>2012-09-11 12:52:22 +1000
commitf6f711ee4d15879a048d8a5442f1927929da29de (patch)
tree87311832404bc8cde226468e5234dc7b728cccdc
parent0d35a8c43910cc9310177e6036a5a1339f2a42f8 (diff)
downloadsamba-f6f711ee4d15879a048d8a5442f1927929da29de.tar.gz
samba-f6f711ee4d15879a048d8a5442f1927929da29de.tar.xz
samba-f6f711ee4d15879a048d8a5442f1927929da29de.zip
tests/eventscript: unit test for 13.per_ip_routing bogus route removal
Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 6d41208074f0e9b56c585bca7eb39aaed653c4ca)
-rwxr-xr-xctdb/tests/eventscripts/13.per_ip_routing.014.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/ctdb/tests/eventscripts/13.per_ip_routing.014.sh b/ctdb/tests/eventscripts/13.per_ip_routing.014.sh
new file mode 100755
index 0000000000..9327264ecd
--- /dev/null
+++ b/ctdb/tests/eventscripts/13.per_ip_routing.014.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "1 IP configured, takeip, moveip, ipreallocated"
+
+# We move the IP to another node but don't run releaseip.
+# ipreallocated should remove the bogus routes.
+
+setup_ctdb
+setup_ctdb_policy_routing
+
+ctdb_get_1_public_address |
+{
+ read dev ip bits
+
+ net=$(ipv4_host_addr_to_net "$ip" "$bits")
+ gw="${net%.*}.1" # a dumb, calculated default
+
+ cat >"$CTDB_PER_IP_ROUTING_CONF" <<EOF
+$ip $net
+$ip 0.0.0.0/0 $gw
+EOF
+
+ ok_null
+
+ # Set up the routes for an IP that we have
+ simple_test_event "takeip" $dev $ip $bits
+
+ # Now move that IPs but don't run the associated "releaseip"
+ ctdb moveip $ip 1
+
+ ok <<EOF
+Removing ip rule/routes for unhosted public address 10.0.0.3
+EOF
+
+ simple_test_event "ipreallocated"
+
+ ok <<EOF
+# ip rule show
+0: from all lookup local
+32766: from all lookup main
+32767: from all lookup default
+EOF
+
+ simple_test_command dump_routes
+}