Add decorator to mark unstable tests
As is done in the neutron repo, add a decorator to mark
tests as unstable so that we can work in parallel on
fixing them while having the job pass.
Mark the DVR east-west tests as unstable to prove it works.
Change-Id: I15fcdcba681d40c96f9f79aaa21881bc45fe3066
Related-bug: #1717302
diff --git a/neutron_tempest_plugin/common/utils.py b/neutron_tempest_plugin/common/utils.py
index ecccd18..d6d0aee 100644
--- a/neutron_tempest_plugin/common/utils.py
+++ b/neutron_tempest_plugin/common/utils.py
@@ -19,6 +19,7 @@
"""Utilities and helper functions."""
import eventlet
+import functools
import threading
import time
@@ -70,3 +71,19 @@
#pylint: disable=raising-bad-type
raise exception
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
diff --git a/neutron_tempest_plugin/scenario/test_floatingip.py b/neutron_tempest_plugin/scenario/test_floatingip.py
index 5fcbdc0..0febce2 100644
--- a/neutron_tempest_plugin/scenario/test_floatingip.py
+++ b/neutron_tempest_plugin/scenario/test_floatingip.py
@@ -22,6 +22,7 @@
from testscenarios.scenarios import multiply_scenarios
from neutron_tempest_plugin.common import ssh
+from neutron_tempest_plugin.common import utils as common_utils
from neutron_tempest_plugin import config
from neutron_tempest_plugin.scenario import base
from neutron_tempest_plugin.scenario import constants
@@ -134,6 +135,7 @@
same_network = True
+ @common_utils.unstable_test("bug 1717302")
@decorators.idempotent_id('05c4e3b3-7319-4052-90ad-e8916436c23b')
def test_east_west(self):
self._test_east_west()
@@ -151,6 +153,7 @@
same_network = False
+ @common_utils.unstable_test("bug 1717302")
@decorators.idempotent_id('f18f0090-3289-4783-b956-a0f8ac511e8b')
def test_east_west(self):
self._test_east_west()