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