Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/net/carp Test handovers on interface down as well as s...
details: https://anonhg.NetBSD.org/src/rev/64703bbfb4dc
branches: trunk
changeset: 351798:64703bbfb4dc
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Mon Feb 27 07:25:59 2017 +0000
description:
Test handovers on interface down as well as server halt
diffstat:
tests/net/carp/t_basic.sh | 102 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 88 insertions(+), 14 deletions(-)
diffs (180 lines):
diff -r 7e7a7040941e -r 64703bbfb4dc tests/net/carp/t_basic.sh
--- a/tests/net/carp/t_basic.sh Mon Feb 27 07:24:26 2017 +0000
+++ b/tests/net/carp/t_basic.sh Mon Feb 27 07:25:59 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_basic.sh,v 1.2 2017/02/27 07:24:26 ozaki-r Exp $
+# $NetBSD: t_basic.sh,v 1.3 2017/02/27 07:25:59 ozaki-r Exp $
#
# Copyright (c) 2017 Internet Initiative Japan Inc.
# All rights reserved.
@@ -31,11 +31,19 @@
BUS=bus_carp
TIMEOUT=3
-atf_test_case carp_handover cleanup
+atf_test_case carp_handover_halt cleanup
carp_handover_head()
{
- atf_set "descr" "Tests for CARP handover"
+ atf_set "descr" "Tests for CARP handover on halt"
+ atf_set "require.progs" "rump_server"
+}
+
+atf_test_case carp_handover_ifdown cleanup
+carp_handover_head()
+{
+
+ atf_set "descr" "Tests for CARP handover on ifconfig down"
atf_set "require.progs" "rump_server"
}
@@ -95,8 +103,9 @@
fi
}
-carp_handover_body()
+test_carp_handover()
{
+ local op=$1
rump_server_start $SOCK_CLIENT
rump_server_start $SOCK_MASTER
@@ -138,7 +147,11 @@
rump.ping -n -w $TIMEOUT -c 1 $IP_CARP
# KILLING SPREE
- env RUMP_SERVER=$SOCK_MASTER rump.halt
+ if [ $op = halt ]; then
+ env RUMP_SERVER=$SOCK_MASTER rump.halt
+ elif [ $op = ifdown ]; then
+ env RUMP_SERVER=$SOCK_MASTER rump.ifconfig shmif0 down
+ fi
sleep 1
# Check that primary is now dead
@@ -153,20 +166,51 @@
$DEBUG && rump.ifconfig
atf_check -s exit:0 -o match:'carp: MASTER carpdev shmif0' \
rump.ifconfig carp1
+
+ if [ $op = ifdown ]; then
+ rump_server_destroy_ifaces
+ fi
}
-carp_handover_cleanup()
+carp_handover_halt_body()
+{
+
+ test_carp_handover halt
+}
+
+carp_handover_ifdown_body()
+{
+
+ test_carp_handover ifdown
+}
+
+carp_handover_halt_cleanup()
{
$DEBUG && dump
cleanup
}
-atf_test_case carp6_handover cleanup
-carp6_handover_head()
+carp_handover_ifdown_cleanup()
{
- atf_set "descr" "Tests for CARP handover (IPv6)"
+ $DEBUG && dump
+ cleanup
+}
+
+atf_test_case carp6_handover_halt cleanup
+carp6_handover_halt_head()
+{
+
+ atf_set "descr" "Tests for CARP handover on halt (IPv6)"
+ atf_set "require.progs" "rump_server"
+}
+
+atf_test_case carp6_handover_ifdown cleanup
+carp6_handover_ifdown_head()
+{
+
+ atf_set "descr" "Tests for CARP handover on ifconfig down (IPv6)"
atf_set "require.progs" "rump_server"
}
@@ -225,8 +269,9 @@
fi
}
-carp6_handover_body()
+test_carp6_handover()
{
+ local op=$1
atf_expect_fail 'The implementation of CARP on IPv6 is incomplete yet.'
@@ -270,7 +315,11 @@
rump.ping6 -n -X $TIMEOUT -c 1 $IP6_CARP
# KILLING SPREE
- env RUMP_SERVER=$SOCK_MASTER rump.halt
+ if [ $op = halt ]; then
+ env RUMP_SERVER=$SOCK_MASTER rump.halt
+ elif [ $op = ifdown ]; then
+ env RUMP_SERVER=$SOCK_MASTER rump.ifconfig shmif0 down
+ fi
sleep 1
# Check that primary is now dead
@@ -285,9 +334,32 @@
$DEBUG && rump.ifconfig
atf_check -s exit:0 -o match:'carp: MASTER carpdev shmif0' \
rump.ifconfig carp1
+
+ if [ $op = ifdown ]; then
+ rump_server_destroy_ifaces
+ fi
+}
+
+carp6_handover_halt_body()
+{
+
+ test_carp6_handover halt
}
-carp6_handover_cleanup()
+carp6_handover_ifdown_body()
+{
+
+ test_carp6_handover ifdown
+}
+
+carp6_handover_halt_cleanup()
+{
+
+ $DEBUG && dump
+ cleanup
+}
+
+carp6_handover_ifdown_cleanup()
{
$DEBUG && dump
@@ -297,6 +369,8 @@
atf_init_test_cases()
{
- atf_add_test_case carp_handover
- atf_add_test_case carp6_handover
+ atf_add_test_case carp_handover_halt
+ atf_add_test_case carp_handover_ifdown
+ atf_add_test_case carp6_handover_halt
+ atf_add_test_case carp6_handover_ifdown
}
Home |
Main Index |
Thread Index |
Old Index