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
This commit is contained in:
Brian Haley 2017-12-14 10:30:48 -05:00
parent 698332f7c4
commit ba80045aab
2 changed files with 20 additions and 0 deletions

View File

@ -19,6 +19,7 @@
"""Utilities and helper functions."""
import eventlet
import functools
import threading
import time
@ -70,3 +71,19 @@ def wait_until_true(predicate, timeout=60, sleep=1, exception=None):
#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

View File

@ -22,6 +22,7 @@ import testscenarios
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 @@ class FloatingIpSameNetwork(FloatingIpTestCasesMixin,
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 @@ class FloatingIpSeparateNetwork(FloatingIpTestCasesMixin,
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()