diff options
author | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2018-12-06 07:46:13 -0800 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2018-12-20 12:43:38 +0000 |
commit | defde0f87067eb473660794cbd4a2da69fdd191d (patch) | |
tree | 41a8e78df46ab9483aaf772622e1ba1e5e2e56c1 /test/test_bfd.py | |
parent | 57f170bdf9967e3f8ea6e937a70c7f86187f95a2 (diff) |
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>
Diffstat (limited to 'test/test_bfd.py')
-rw-r--r-- | test/test_bfd.py | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/test/test_bfd.py b/test/test_bfd.py index 635e7e12a76..f40bcc65c22 100644 --- a/test/test_bfd.py +++ b/test/test_bfd.py @@ -47,7 +47,7 @@ class AuthKeyFactory(object): 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 @@ class BFDAPITestCase(VppTestCase): 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 @@ def wait_for_bfd_packet(test, timeout=1, pcap_time_min=None): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): "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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): "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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD4TestCase(VppTestCase): 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 @@ class BFD6TestCase(VppTestCase): 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 @@ class BFD6TestCase(VppTestCase): 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 @@ class BFDFIBTestCase(VppTestCase): 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 @@ class BFDSHA1TestCase(VppTestCase): 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 @@ class BFDSHA1TestCase(VppTestCase): 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 @@ class BFDSHA1TestCase(VppTestCase): 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 @@ class BFDSHA1TestCase(VppTestCase): 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 @@ class BFDSHA1TestCase(VppTestCase): 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 @@ class BFDSHA1TestCase(VppTestCase): 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 @@ class BFDSHA1TestCase(VppTestCase): 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 @@ class BFDSHA1TestCase(VppTestCase): 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 @@ class BFDAuthOnOffTestCase(VppTestCase): "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 |