Tests: Cleanup @skip decorator.
The runnning environment is static as of module load time,
so only evalute the conditions once at module load time.
Track-by: VPP-1518
Change-Id: I73b0d17ae1ff90789e70307f168d43921829aec8
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
diff --git a/test/test_bfd.py b/test/test_bfd.py
index 635e7e1..f40bcc6 100644
--- a/test/test_bfd.py
+++ b/test/test_bfd.py
@@ -47,7 +47,7 @@
conf_key_id=conf_key_id, key=key)
-@unittest.skipUnless(running_extended_tests(), "part of extended tests")
+@unittest.skipUnless(running_extended_tests, "part of extended tests")
class BFDAPITestCase(VppTestCase):
"""Bidirectional Forwarding Detection (BFD) - API"""
@@ -302,7 +302,7 @@
self.assertFalse(echo_source.have_usable_ip6)
-@unittest.skipUnless(running_extended_tests(), "part of extended tests")
+@unittest.skipUnless(running_extended_tests, "part of extended tests")
class BFDTestSession(object):
""" BFD session as seen from test framework side """
@@ -664,7 +664,7 @@
return p
-@unittest.skipUnless(running_extended_tests(), "part of extended tests")
+@unittest.skipUnless(running_extended_tests, "part of extended tests")
class BFD4TestCase(VppTestCase):
"""Bidirectional Forwarding Detection (BFD)"""
@@ -748,7 +748,7 @@
bfd_session_up(self)
bfd_session_down(self)
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_hold_up(self):
""" hold BFD session up """
bfd_session_up(self)
@@ -758,7 +758,7 @@
self.assert_equal(len(self.vapi.collect_events()), 0,
"number of bfd events")
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_slow_timer(self):
""" verify slow periodic control frames while session down """
packet_count = 3
@@ -773,7 +773,7 @@
time_diff, 0.70, 1.05, "time between slow packets")
prev_packet = next_packet
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_zero_remote_min_rx(self):
""" no packets when zero remote required min rx interval """
bfd_session_up(self)
@@ -798,7 +798,7 @@
self.assert_equal(
len(self.vapi.collect_events()), 0, "number of bfd events")
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_conn_down(self):
""" verify session goes down after inactivity """
bfd_session_up(self)
@@ -808,7 +808,7 @@
e = self.vapi.wait_for_event(1, "bfd_udp_session_details")
verify_event(self, e, expected_state=BFDState.down)
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_large_required_min_rx(self):
""" large remote required min rx interval """
bfd_session_up(self)
@@ -838,7 +838,7 @@
break
self.assert_equal(count, 0, "number of packets received")
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_immediate_remote_min_rx_reduction(self):
""" immediately honor remote required min rx reduction """
self.vpp_session.remove_vpp_config()
@@ -871,7 +871,7 @@
"time between BFD packets")
reference_packet = p
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_modify_req_min_rx_double(self):
""" modify session - double required min rx """
bfd_session_up(self)
@@ -901,7 +901,7 @@
self.assert_in_range(time_to_event, .9 * timeout,
1.1 * timeout, "session timeout")
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_modify_req_min_rx_halve(self):
""" modify session - halve required min rx """
self.vpp_session.modify_parameters(
@@ -944,7 +944,7 @@
"time before bfd session goes down")
verify_event(self, e, expected_state=BFDState.down)
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_modify_detect_mult(self):
""" modify detect multiplier """
bfd_session_up(self)
@@ -968,7 +968,7 @@
self.assertNotIn("P", p.sprintf("%BFD.flags%"),
"Poll bit not set in BFD packet")
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_queued_poll(self):
""" test poll sequence queueing """
bfd_session_up(self)
@@ -1034,7 +1034,7 @@
self.assertNotIn("P", p.sprintf("%BFD.flags%"),
"Poll bit set in BFD packet")
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_poll_response(self):
""" test correct response to control frame with poll bit set """
bfd_session_up(self)
@@ -1045,7 +1045,7 @@
self, pcap_time_min=time.time() - self.vpp_clock_offset)
self.assertIn("F", final.sprintf("%BFD.flags%"))
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_no_periodic_if_remote_demand(self):
""" no periodic frames outside poll sequence if remote demand set """
bfd_session_up(self)
@@ -1172,7 +1172,7 @@
self.test_session.send_packet()
self.assertTrue(echo_seen, "No echo packets received")
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_echo_fail(self):
""" session goes down if echo function fails """
bfd_session_up(self)
@@ -1212,7 +1212,7 @@
self.assert_equal(events[0].state, BFDState.down, BFDState)
self.assertTrue(verified_diag, "Incorrect diagnostics code received")
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_echo_stop(self):
""" echo function stops if peer sets required min echo rx zero """
bfd_session_up(self)
@@ -1244,7 +1244,7 @@
events = self.vapi.collect_events()
self.assert_equal(len(events), 0, "number of bfd events")
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_echo_source_removed(self):
""" echo function stops if echo source is removed """
bfd_session_up(self)
@@ -1276,7 +1276,7 @@
events = self.vapi.collect_events()
self.assert_equal(len(events), 0, "number of bfd events")
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_stale_echo(self):
""" stale echo packets don't keep a session up """
bfd_session_up(self)
@@ -1329,7 +1329,7 @@
self.test_session.send_packet()
self.assertTrue(timeout_ok, "Expected timeout event didn't occur")
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_invalid_echo_checksum(self):
""" echo packets with invalid checksum don't keep a session up """
bfd_session_up(self)
@@ -1379,7 +1379,7 @@
self.test_session.send_packet()
self.assertTrue(timeout_ok, "Expected timeout event didn't occur")
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_admin_up_down(self):
""" put session admin-up and admin-down """
bfd_session_up(self)
@@ -1417,7 +1417,7 @@
e = self.vapi.wait_for_event(1, "bfd_udp_session_details")
verify_event(self, e, expected_state=BFDState.up)
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_config_change_remote_demand(self):
""" configuration change while peer in demand mode """
bfd_session_up(self)
@@ -1470,7 +1470,7 @@
self.assertFalse(vpp_session.query_vpp_config())
-@unittest.skipUnless(running_extended_tests(), "part of extended tests")
+@unittest.skipUnless(running_extended_tests, "part of extended tests")
class BFD6TestCase(VppTestCase):
"""Bidirectional Forwarding Detection (BFD) (IPv6) """
@@ -1551,7 +1551,7 @@
self.test_session.send_packet()
self.assert_equal(self.vpp_session.state, BFDState.up, BFDState)
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_hold_up(self):
""" hold BFD session up """
bfd_session_up(self)
@@ -1680,7 +1680,7 @@
self.assertFalse(vpp_session.query_vpp_config())
-@unittest.skipUnless(running_extended_tests(), "part of extended tests")
+@unittest.skipUnless(running_extended_tests, "part of extended tests")
class BFDFIBTestCase(VppTestCase):
""" BFD-FIB interactions (IPv6) """
@@ -1782,7 +1782,7 @@
packet[IPv6].dst)
-@unittest.skipUnless(running_extended_tests(), "part of extended tests")
+@unittest.skipUnless(running_extended_tests, "part of extended tests")
class BFDSHA1TestCase(VppTestCase):
"""Bidirectional Forwarding Detection (BFD) (SHA1 auth) """
@@ -1831,7 +1831,7 @@
bfd_key_id=self.vpp_session.bfd_key_id)
bfd_session_up(self)
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_hold_up(self):
""" hold BFD session up """
key = self.factory.create_random_key(self)
@@ -1850,7 +1850,7 @@
self.test_session.send_packet()
self.assert_equal(self.vpp_session.state, BFDState.up, BFDState)
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_hold_up_meticulous(self):
""" hold BFD session up - meticulous auth """
key = self.factory.create_random_key(
@@ -1872,7 +1872,7 @@
self.test_session.send_packet()
self.assert_equal(self.vpp_session.state, BFDState.up, BFDState)
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_send_bad_seq_number(self):
""" session is not kept alive by msgs with bad sequence numbers"""
key = self.factory.create_random_key(
@@ -1935,7 +1935,7 @@
wait_for_bfd_packet(self)
self.assert_equal(self.vpp_session.state, BFDState.up, BFDState)
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_mismatch_auth(self):
""" session is not brought down by unauthenticated msg """
key = self.factory.create_random_key(self)
@@ -1950,7 +1950,7 @@
legitimate_test_session,
rogue_test_session)
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_mismatch_bfd_key_id(self):
""" session is not brought down by msg with non-existent key-id """
key = self.factory.create_random_key(self)
@@ -1970,7 +1970,7 @@
legitimate_test_session,
rogue_test_session)
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_mismatched_auth_type(self):
""" session is not brought down by msg with wrong auth type """
key = self.factory.create_random_key(self)
@@ -1987,7 +1987,7 @@
vpp_session, legitimate_test_session, rogue_test_session,
{'auth_type': BFDAuthType.keyed_md5})
- @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
def test_restart(self):
""" simulate remote peer restart and resynchronization """
key = self.factory.create_random_key(
@@ -2016,7 +2016,7 @@
bfd_session_up(self)
-@unittest.skipUnless(running_extended_tests(), "part of extended tests")
+@unittest.skipUnless(running_extended_tests, "part of extended tests")
class BFDAuthOnOffTestCase(VppTestCase):
"""Bidirectional Forwarding Detection (BFD) (changing auth) """
@@ -2225,7 +2225,7 @@
"number of bfd events")
-@unittest.skipUnless(running_extended_tests(), "part of extended tests")
+@unittest.skipUnless(running_extended_tests, "part of extended tests")
class BFDCLITestCase(VppTestCase):
"""Bidirectional Forwarding Detection (BFD) (CLI) """
pg0 = None