summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xctdb/tests/eventscripts/13.per_ip_routing.013.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/ctdb/tests/eventscripts/13.per_ip_routing.013.sh b/ctdb/tests/eventscripts/13.per_ip_routing.013.sh
new file mode 100755
index 0000000000..5c07632023
--- /dev/null
+++ b/ctdb/tests/eventscripts/13.per_ip_routing.013.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "1 IP configured, releaseip of unassigned"
+
+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 <<EOF
+WARNING: Failed to delete policy routing rule
+ Command "ip rule del from $ip pref $CTDB_PER_IP_ROUTING_RULE_PREF table ctdb.$ip" failed:
+ RTNETLINK answers: No such file or directory
+EOF
+
+ simple_test_event "releaseip" $dev $ip $bits
+
+ 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
+}