ctdb-tests: Use setup_script_options() in 11.natgw tests
authorMartin Schwenke <martin@meltin.net>
Wed, 21 Mar 2018 19:56:18 +0000 (06:56 +1100)
committerAmitay Isaacs <amitay@samba.org>
Wed, 28 Mar 2018 00:57:20 +0000 (02:57 +0200)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
13 files changed:
ctdb/tests/eventscripts/11.natgw.003.sh
ctdb/tests/eventscripts/11.natgw.004.sh
ctdb/tests/eventscripts/11.natgw.013.sh
ctdb/tests/eventscripts/11.natgw.014.sh
ctdb/tests/eventscripts/11.natgw.021.sh
ctdb/tests/eventscripts/11.natgw.022.sh
ctdb/tests/eventscripts/11.natgw.023.sh
ctdb/tests/eventscripts/11.natgw.024.sh
ctdb/tests/eventscripts/11.natgw.025.sh
ctdb/tests/eventscripts/11.natgw.031.sh
ctdb/tests/eventscripts/11.natgw.041.sh
ctdb/tests/eventscripts/11.natgw.042.sh
ctdb/tests/eventscripts/scripts/11.natgw.sh

index 2743b4f1df54a080bc336135e57915fe818fbd6f..46237e5f31458d8b852564a88d76d253e9f35c54 100755 (executable)
@@ -13,7 +13,9 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
+setup_script_options <<EOF
 CTDB_NATGW_PUBLIC_IFACE=""
+EOF
 
 required_result 1 "Invalid configuration: CTDB_NATGW_PUBLIC_IFACE not set"
 
index 5f1f816912e7c45661522becf70bb178c07ac99f..e441c4c5965e6b019058cfe85aedffd58922d099 100755 (executable)
@@ -13,7 +13,9 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
+setup_script_options <<EOF
 CTDB_NATGW_PUBLIC_IP=""
+EOF
 
 required_result 1 "Invalid configuration: CTDB_NATGW_PUBLIC_IP not set"
 
index 75823c3cc365f1379ce415fb98de5231475df739..0a15862d75abd42123273176b0cc6c4838f75829 100755 (executable)
@@ -13,7 +13,9 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
+setup_script_options <<EOF
 CTDB_NATGW_DEFAULT_GATEWAY=""
+EOF
 
 ok_null
 simple_test_event "ipreallocated"
index 3df2fab8332764c4943146f2218ec043309e843f..f3a586a9a66524b66634ad3bfc7dfcf5cc4009b0 100755 (executable)
@@ -13,7 +13,9 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
+setup_script_options <<EOF
 CTDB_NATGW_DEFAULT_GATEWAY=""
+EOF
 
 ok_null
 simple_test_event "ipreallocated"
index fb9b167b79487a70636e3f9250b654bf8aa6e2ad..41bb185bccf7a74928ac2d7b3663dd94f8fe1183 100755 (executable)
@@ -13,7 +13,9 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
+setup_script_options<<EOF
 CTDB_NATGW_STATIC_ROUTES="10.1.1.0/24 10.1.2.0/24"
+EOF
 
 ok_null
 simple_test_event "ipreallocated"
index bcdcd6acf6323cdffe63053ce60b68bff49ca6d2..4c2c11b5bad2cb4fed8221273f333a872a8c28f4 100755 (executable)
@@ -13,7 +13,9 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
+setup_script_options <<EOF
 CTDB_NATGW_STATIC_ROUTES="10.1.1.0/24 10.1.2.0/24"
+EOF
 
 ok_null
 simple_test_event "ipreallocated"
index ae341909d175630ba5f17da04fb4e8429f7d4c96..c487aaaeb53a71cca803e06fb84a1d2e7225a057 100755 (executable)
@@ -13,7 +13,9 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
+setup_script_options <<EOF
 CTDB_NATGW_STATIC_ROUTES="10.1.1.0/24 10.1.2.0/24@10.1.1.253"
+EOF
 
 ok_null
 simple_test_event "ipreallocated"
index 5b1f201c8c3a7607c5a55ce2babc1a3b7ab1ac10..a13879cb30e96e80448e036f5bc0fa07a5833303 100755 (executable)
@@ -13,7 +13,9 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
+setup_script_options <<EOF
 CTDB_NATGW_STATIC_ROUTES="10.1.1.0/24 10.1.2.0/24@10.1.1.253"
+EOF
 
 ok_null
 simple_test_event "ipreallocated"
index 05f56b52098c5846caa9cadcea0150de3c1f87ea..a1b049f2e393da34a7bee24b9d026e2044836378 100755 (executable)
@@ -6,7 +6,9 @@ define_test "static routes, custom gateway, multiple transitions"
 
 setup
 
+setup_script_options <<EOF
 CTDB_NATGW_STATIC_ROUTES="10.1.1.0/24 10.1.2.0/24@10.1.1.253"
+EOF
 
 echo "*** Master node..."
 
index 039930fa4ade85a15748b1dec216dc4dc7049c1e..0cff321764eb9ed9d3c05f5ae14dcc4b8d521403 100755 (executable)
@@ -6,7 +6,9 @@ define_test "master node, static routes, custom gateway, config change"
 
 setup
 
+setup_script_options <<EOF
 CTDB_NATGW_STATIC_ROUTES="10.1.1.0/24 10.1.2.0/24@10.1.1.253"
+EOF
 
 echo "##################################################"
 echo "Static routes..."
@@ -30,7 +32,9 @@ simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
 echo "##################################################"
 echo "Default routes..."
 
+setup_script_options <<EOF
 CTDB_NATGW_STATIC_ROUTES=""
+EOF
 
 ok "NAT gateway configuration has changed"
 simple_test_event "ipreallocated"
@@ -44,7 +48,9 @@ simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
 echo "##################################################"
 echo "Static routes again..."
 
+setup_script_options <<EOF
 CTDB_NATGW_STATIC_ROUTES="10.1.3.0/24 10.1.4.4/32 10.1.2.0/24@10.1.1.252"
+EOF
 
 ok "NAT gateway configuration has changed"
 simple_test_event "ipreallocated"
index d5cc44adce695ceb1a0ef6d25b83fc0e4c9e22cc..05eeb6ae4b0b31ae53890214fd2b50a255e75e7e 100755 (executable)
@@ -13,7 +13,9 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
+setup_script_options <<EOF
 CTDB_NATGW_PUBLIC_IFACE=""
+EOF
 
 ok_null
 simple_test_event "ipreallocated"
index 17d98cb94527d26ed13d6c954d16cccf2a0f79a0..39709c29c16572f11826eb07c5d889b34c9879d4 100755 (executable)
@@ -13,8 +13,10 @@ setup_ctdb_natgw <<EOF
 192.168.1.24
 EOF
 
+setup_script_options <<EOF
 CTDB_NATGW_PUBLIC_IFACE=""
 CTDB_NATGW_PUBLIC_IP=""
+EOF
 
 ok_null
 simple_test_event "ipreallocated"
index a11da431434d4616cab354f19b6d254f3e99ddaa..1bdcb690b15c3a74b1068c8e5c9404a6375231ff 100644 (file)
@@ -5,13 +5,6 @@ setup ()
        natgw_nodes="${CTDB_BASE}/natgw_nodes"
 
        ctdb_set_pnn
-
-       export CTDB_NATGW_NODES=""
-       export CTDB_NATGW_PRIVATE_NETWORK=""
-       export CTDB_NATGW_PUBLIC_IP=""
-       export CTDB_NATGW_PUBLIC_IFACE=""
-       export CTDB_NATGW_DEFAULT_GATEWAY=""
-       export CTDB_NATGW_STATIC_ROUTES=""
 }
 
 # A separate function for this makes sense because it can be done
@@ -38,14 +31,16 @@ setup_ctdb_natgw ()
        # addresses:
        read _ip <"$natgw_nodes"
 
-       CTDB_NATGW_NODES="$natgw_nodes"
-       CTDB_NATGW_PRIVATE_NETWORK="${_ip%.*}.0/24"
-       # These are fixed.  Probably don't use the same network for the
-       # private node IPs.  To unset the default gateway just set it to
-       # "".  :-)
-       CTDB_NATGW_PUBLIC_IP="10.1.1.121/24"
-       CTDB_NATGW_PUBLIC_IFACE="eth1"
-       CTDB_NATGW_DEFAULT_GATEWAY="10.1.1.254"
+       setup_script_options <<EOF
+CTDB_NATGW_NODES="$natgw_nodes"
+CTDB_NATGW_PRIVATE_NETWORK="${_ip%.*}.0/24"
+# These are fixed.  Probably don't use the same network for the
+# private node IPs.  To unset the default gateway just set it to
+# "".  :-)
+CTDB_NATGW_PUBLIC_IP="10.1.1.121/24"
+CTDB_NATGW_PUBLIC_IFACE="eth1"
+CTDB_NATGW_DEFAULT_GATEWAY="10.1.1.254"
+EOF
 }
 
 ok_natgw_master_ip_addr_show ()