From 4dea8060f05fab427cd042934674f08b03927e05 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Thu, 16 Jan 2020 16:32:59 +0000 Subject: [PATCH] Remove "unstable_test" decorator local implementation Since [1] this decorator is in neutron-lib and used in this repository. This local implementation can be removed. [1] https://review.opendev.org/#/c/560102/ Trivial-Fix Change-Id: I3c5f135fafcc380918905d8af164b71504441dc0 --- neutron_tempest_plugin/common/utils.py | 17 ----------------- .../scenario/test_floatingip.py | 7 ++++--- .../scenario/test_migration.py | 7 ++++--- .../scenario/test_multicast.py | 3 ++- .../scenario/test_port_forwardings.py | 4 ++-- 5 files changed, 12 insertions(+), 26 deletions(-) diff --git a/neutron_tempest_plugin/common/utils.py b/neutron_tempest_plugin/common/utils.py index bd7a3674..631f75b5 100644 --- a/neutron_tempest_plugin/common/utils.py +++ b/neutron_tempest_plugin/common/utils.py @@ -18,7 +18,6 @@ """Utilities and helper functions.""" -import functools import threading import time try: @@ -83,22 +82,6 @@ def wait_until_true(predicate, timeout=60, sleep=1, exception=None): raise WaitTimeout("Timed out after %d seconds" % timeout) -# TODO(haleyb): move to neutron-lib -# code copied from neutron repository - neutron/tests/base.py -def unstable_test(reason): - def decor(f): - @functools.wraps(f) - def inner(self, *args, **kwargs): - try: - return f(self, *args, **kwargs) - except Exception as e: - msg = ("%s was marked as unstable because of %s, " - "failure was: %s") % (self.id(), reason, e) - raise self.skipTest(msg) - return inner - return decor - - def override_class(overriden_class, overrider_class): """Override class definition with a MixIn class diff --git a/neutron_tempest_plugin/scenario/test_floatingip.py b/neutron_tempest_plugin/scenario/test_floatingip.py index 39aa09db..e276a025 100644 --- a/neutron_tempest_plugin/scenario/test_floatingip.py +++ b/neutron_tempest_plugin/scenario/test_floatingip.py @@ -17,6 +17,7 @@ import time from neutron_lib import constants as lib_constants from neutron_lib.services.qos import constants as qos_consts +from neutron_lib.utils import test from tempest.common import utils from tempest.common import waiters from tempest.lib.common.utils import data_utils @@ -151,7 +152,7 @@ class FloatingIpSameNetwork(FloatingIpTestCasesMixin, same_network = True - @common_utils.unstable_test("bug 1717302") + @test.unstable_test("bug 1717302") @decorators.idempotent_id('05c4e3b3-7319-4052-90ad-e8916436c23b') def test_east_west(self): self._test_east_west() @@ -169,7 +170,7 @@ class FloatingIpSeparateNetwork(FloatingIpTestCasesMixin, same_network = False - @common_utils.unstable_test("bug 1717302") + @test.unstable_test("bug 1717302") @decorators.idempotent_id('f18f0090-3289-4783-b956-a0f8ac511e8b') def test_east_west(self): self._test_east_west() @@ -212,7 +213,7 @@ class FloatingIPPortDetailsTest(FloatingIpTestCasesMixin, def resource_setup(cls): super(FloatingIPPortDetailsTest, cls).resource_setup() - @common_utils.unstable_test("bug 1815585") + @test.unstable_test("bug 1815585") @decorators.idempotent_id('a663aeee-dd81-492b-a207-354fd6284dbe') def test_floatingip_port_details(self): """Tests the following: diff --git a/neutron_tempest_plugin/scenario/test_migration.py b/neutron_tempest_plugin/scenario/test_migration.py index f4b918c2..410c64eb 100644 --- a/neutron_tempest_plugin/scenario/test_migration.py +++ b/neutron_tempest_plugin/scenario/test_migration.py @@ -17,6 +17,7 @@ import functools from neutron_lib.api.definitions import portbindings as pb from neutron_lib import constants as const +from neutron_lib.utils import test from tempest.common import utils from tempest.lib import decorators import testtools @@ -224,7 +225,7 @@ class NetworkMigrationFromDVR(NetworkMigrationTestBase): class NetworkMigrationFromDVRHA(NetworkMigrationTestBase): - @common_utils.unstable_test("bug 1756301") + @test.unstable_test("bug 1756301") @decorators.idempotent_id('1be9b2e2-379c-40a4-a269-6687b81df691') @testtools.skipUnless( CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat', @@ -233,7 +234,7 @@ class NetworkMigrationFromDVRHA(NetworkMigrationTestBase): self._test_migration(before_dvr=True, before_ha=True, after_dvr=False, after_ha=False) - @common_utils.unstable_test("bug 1756301") + @test.unstable_test("bug 1756301") @decorators.idempotent_id('55957267-4e84-4314-a2f7-7cd36a2df04b') @testtools.skipUnless( CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat', @@ -242,7 +243,7 @@ class NetworkMigrationFromDVRHA(NetworkMigrationTestBase): self._test_migration(before_dvr=True, before_ha=True, after_dvr=False, after_ha=True) - @common_utils.unstable_test("bug 1756301") + @test.unstable_test("bug 1756301") @decorators.idempotent_id('d6bedff1-72be-4a9a-8ea2-dc037cd838e0') @testtools.skipUnless( CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat', diff --git a/neutron_tempest_plugin/scenario/test_multicast.py b/neutron_tempest_plugin/scenario/test_multicast.py index d511b3bd..a39a0c3d 100644 --- a/neutron_tempest_plugin/scenario/test_multicast.py +++ b/neutron_tempest_plugin/scenario/test_multicast.py @@ -15,6 +15,7 @@ import netaddr from neutron_lib import constants +from neutron_lib.utils import test from oslo_log import log from tempest.lib.common.utils import data_utils from tempest.lib import decorators @@ -229,7 +230,7 @@ class BaseMulticastTest(object): server['ssh_client'].execute_script( 'echo "%s" > ~/multicast_traffic_receiver.py' % check_script) - @utils.unstable_test("bug 1850288") + @test.unstable_test("bug 1850288") @decorators.idempotent_id('113486fc-24c9-4be4-8361-03b1c9892867') def test_multicast_between_vms_on_same_network(self): """Test multicast messaging between two servers on the same network diff --git a/neutron_tempest_plugin/scenario/test_port_forwardings.py b/neutron_tempest_plugin/scenario/test_port_forwardings.py index 06f175b4..72838871 100644 --- a/neutron_tempest_plugin/scenario/test_port_forwardings.py +++ b/neutron_tempest_plugin/scenario/test_port_forwardings.py @@ -14,12 +14,12 @@ # under the License. from neutron_lib import constants +from neutron_lib.utils import test from oslo_log import log from tempest.lib.common.utils import data_utils from tempest.lib import decorators from neutron_tempest_plugin.common import ssh -from neutron_tempest_plugin.common import utils from neutron_tempest_plugin import config from neutron_tempest_plugin.scenario import base @@ -101,7 +101,7 @@ class PortForwardingTestJSON(base.BaseTempestTestCase): server['port_forwarding_udp']['external_port'], constants.PROTO_NAME_UDP)) - @utils.unstable_test("bug 1850800") + @test.unstable_test("bug 1850800") @decorators.idempotent_id('ab40fc48-ca8d-41a0-b2a3-f6679c847bfe') def test_port_forwarding_to_2_servers(self): udp_sg_rule = {'protocol': constants.PROTO_NAME_UDP,