tests: Extend test_connectivity to check disconnection
Add success_expected argument to test_connectivity because the function is expected to fail in some test cases. Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
parent
fbba28f8c5
commit
8d85e291cd
1 changed files with 4 additions and 2 deletions
|
@ -141,7 +141,7 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
|
||||||
def test_connectivity(dev1, dev2, dscp=None, tos=None, max_tries=1,
|
def test_connectivity(dev1, dev2, dscp=None, tos=None, max_tries=1,
|
||||||
dev1group=False, dev2group=False,
|
dev1group=False, dev2group=False,
|
||||||
ifname1=None, ifname2=None, config=True, timeout=5,
|
ifname1=None, ifname2=None, config=True, timeout=5,
|
||||||
multicast_to_unicast=False):
|
multicast_to_unicast=False, success_expected=True):
|
||||||
if dscp:
|
if dscp:
|
||||||
tos = dscp << 2
|
tos = dscp << 2
|
||||||
if not tos:
|
if not tos:
|
||||||
|
@ -161,8 +161,10 @@ def test_connectivity(dev1, dev2, dscp=None, tos=None, max_tries=1,
|
||||||
last_err = e
|
last_err = e
|
||||||
if i + 1 < max_tries:
|
if i + 1 < max_tries:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if not success:
|
if success_expected and not success:
|
||||||
raise Exception(last_err)
|
raise Exception(last_err)
|
||||||
|
if not success_expected and success:
|
||||||
|
raise Exception("Unexpected connectivity detected")
|
||||||
|
|
||||||
def test_connectivity_iface(dev1, dev2, ifname, dscp=None, tos=None,
|
def test_connectivity_iface(dev1, dev2, ifname, dscp=None, tos=None,
|
||||||
max_tries=1, timeout=5):
|
max_tries=1, timeout=5):
|
||||||
|
|
Loading…
Reference in a new issue