Merge "suppress ResourceWarning: unclosed socket"

This commit is contained in:
Zuul 2018-01-23 16:25:37 +00:00 committed by Gerrit Code Review
commit 510f736db4
21 changed files with 144 additions and 1 deletions

View File

@ -24,6 +24,12 @@ TEMPLATES_SOURCES_PATH = '/etc/vitrage/templates/'
class BaseAlarmsTest(BaseVitrageTempest):
"""Topology test class for Vitrage API tests."""
def setUp(self):
super(BaseAlarmsTest, self).setUp()
def tearDown(self):
super(BaseAlarmsTest, self).tearDown()
@classmethod
def setUpClass(cls):
super(BaseAlarmsTest, cls).setUpClass()

View File

@ -32,6 +32,12 @@ LOG = logging.getLogger(__name__)
class TestAlarms(BaseAlarmsTest):
"""Alarms test class for Vitrage API tests."""
def setUp(self):
super(TestAlarms, self).setUp()
def tearDown(self):
super(TestAlarms, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestAlarms, cls).setUpClass()

View File

@ -42,6 +42,12 @@ VITRAGE_ALARM_NAME = 'instance_deduce'
class BaseRcaTest(BaseAlarmsTest):
def setUp(self):
super(BaseRcaTest, self).setUp()
def tearDown(self):
super(BaseRcaTest, self).tearDown()
@classmethod
def setUpClass(cls):
super(BaseRcaTest, cls).setUpClass()

View File

@ -29,6 +29,12 @@ LOG = logging.getLogger(__name__)
class TestRca(BaseRcaTest):
"""RCA test class for Vitrage API tests."""
def setUp(self):
super(TestRca, self).setUp()
def tearDown(self):
super(TestRca, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestRca, cls).setUpClass()

View File

@ -38,6 +38,12 @@ class TestResource(BaseVitrageTempest):
VProps.STATE,
VProps.VITRAGE_AGGREGATED_STATE)
def setUp(self):
super(TestResource, self).setUp()
def tearDown(self):
super(TestResource, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestResource, cls).setUpClass()

View File

@ -40,6 +40,12 @@ class BaseTemplateTest(BaseVitrageTempest):
OK_STATUS = 'validation OK'
OK_MSG = 'Template validation is OK'
def setUp(self):
super(BaseTemplateTest, self).setUp()
def tearDown(self):
super(BaseTemplateTest, self).tearDown()
@classmethod
def setUpClass(cls):
super(BaseTemplateTest, cls).setUpClass()

View File

@ -39,6 +39,12 @@ FAKE_UUID = 'ade68276-0fe9-42cd-9ec2-e7f20470a771'
class TestValidate(BaseTemplateTest):
"""Template test class for Vitrage API tests."""
def setUp(self):
super(TestValidate, self).setUp()
def tearDown(self):
super(TestValidate, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestValidate, cls).setUpClass()

View File

@ -26,6 +26,12 @@ from vitrage_tempest_tests.tests.common import nova_utils
class BaseTopologyTest(BaseVitrageTempest):
"""Topology test class for Vitrage API tests."""
def setUp(self):
super(BaseTopologyTest, self).setUp()
def tearDown(self):
super(BaseTopologyTest, self).tearDown()
@classmethod
def setUpClass(cls):
super(BaseTopologyTest, cls).setUpClass()

View File

@ -39,6 +39,12 @@ class TestTopology(BaseTopologyTest):
NUM_INSTANCE = 3
NUM_VOLUME = 1
def setUp(self):
super(TestTopology, self).setUp()
def tearDown(self):
super(TestTopology, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestTopology, cls).setUpClass()

View File

@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
import traceback
from oslo_log import log as logging
@ -37,8 +38,14 @@ from vitrage import service
from vitrage_tempest_tests.tests.common.tempest_clients import TempestClients
from vitrage_tempest_tests.tests import utils
import warnings
LOG = logging.getLogger(__name__)
if six.PY2:
class ResourceWarning(Warning):
pass
class BaseVitrageTempest(base.BaseTestCase):
"""Base test class for All Vitrage tests."""
@ -46,10 +53,25 @@ class BaseVitrageTempest(base.BaseTestCase):
NUM_VERTICES_PER_TYPE = 'num_vertices'
NUM_EDGES_PER_TYPE = 'num_edges_per_type'
def setUp(self):
super(BaseVitrageTempest, self).setUp()
warnings.filterwarnings(action="ignore",
message="unclosed",
category=ResourceWarning)
def tearDown(self):
super(BaseVitrageTempest, self).tearDown()
warnings.filterwarnings(action="ignore",
message="unclosed",
category=ResourceWarning)
# noinspection PyPep8Naming
@classmethod
def setUpClass(cls):
super(BaseVitrageTempest, cls).setUpClass()
warnings.filterwarnings(action="ignore",
message="unclosed",
category=ResourceWarning)
cls.conf = service.prepare_service([])
TempestClients.class_init(cls.conf)
cls.vitrage_client = TempestClients.vitrage()

View File

@ -54,6 +54,12 @@ def get_first_match(events, event):
class TestEvents(BaseVitrageTempest):
"""Test class for Vitrage persisror service"""
def setUp(self):
super(TestEvents, self).setUp()
def tearDown(self):
super(TestEvents, self).tearDown()
# noinspection PyPep8Naming
@classmethod
def setUpClass(cls):

View File

@ -27,6 +27,12 @@ class TestAodhAlarm(BaseAlarmsTest):
NUM_INSTANCE = 1
NUM_ALARM = 1
def setUp(self):
super(TestAodhAlarm, self).setUp()
def tearDown(self):
super(TestAodhAlarm, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestAodhAlarm, cls).setUpClass()

View File

@ -23,6 +23,12 @@ class TestCinderVolume(BaseTopologyTest):
NUM_INSTANCE = 3
NUM_VOLUME = 1
def setUp(self):
super(TestCinderVolume, self).setUp()
def tearDown(self):
super(TestCinderVolume, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestCinderVolume, cls).setUpClass()

View File

@ -24,6 +24,12 @@ LOG = logging.getLogger(__name__)
class TestHeatStack(BaseTopologyTest):
NUM_STACKS = 1
def setUp(self):
super(TestHeatStack, self).setUp()
def tearDown(self):
super(TestHeatStack, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestHeatStack, cls).setUpClass()

View File

@ -26,6 +26,12 @@ LOG = logging.getLogger(__name__)
class TestNeutron(BaseTopologyTest):
NUM_INSTANCE = 3
def setUp(self):
super(TestNeutron, self).setUp()
def tearDown(self):
super(TestNeutron, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestNeutron, cls).setUpClass()

View File

@ -22,6 +22,12 @@ LOG = logging.getLogger(__name__)
class TestNova(BaseTopologyTest):
NUM_INSTANCE = 3
def setUp(self):
super(TestNova, self).setUp()
def tearDown(self):
super(TestNova, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestNova, cls).setUpClass()

View File

@ -26,6 +26,12 @@ LOG = logging.getLogger(__name__)
class TestStaticPhysical(BaseVitrageTempest):
NUM_SWITCH = 2
def setUp(self):
super(TestStaticPhysical, self).setUp()
def tearDown(self):
super(TestStaticPhysical, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestStaticPhysical, cls).setUpClass()

View File

@ -25,6 +25,12 @@ LOG = logging.getLogger(__name__)
class TestActionsBase(BaseVitrageTempest):
def setUp(self):
super(TestActionsBase, self).setUp()
def tearDown(self):
super(TestActionsBase, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestActionsBase, cls).setUpClass()

View File

@ -49,6 +49,12 @@ DEDUCED_PROPS = {
class TestBasicActions(TestActionsBase):
def setUp(self):
super(TestBasicActions, self).setUp()
def tearDown(self):
super(TestBasicActions, self).tearDown()
@utils.tempest_logger
def test_action_set_state_host(self):
try:

View File

@ -53,7 +53,14 @@ DEDUCED_PROPS = {
}
class TestOverlappingcActions(TestActionsBase):
class TestOverlappingActions(TestActionsBase):
def setUp(self):
super(TestOverlappingActions, self).setUp()
def tearDown(self):
super(TestOverlappingActions, self).tearDown()
@utils.tempest_logger
def test_overlapping_action_set_state(self):
try:

View File

@ -48,6 +48,12 @@ class TestMistralNotifier(BaseTestEvents):
TRIGGER_ALARM_2 = "notifiers.mistral.trigger.alarm.2"
TRIGGER_ALARM_FOR_FUNCTION = "notifiers.mistral.trigger.alarm.for.function"
def setUp(self):
super(TestMistralNotifier, self).setUp()
def tearDown(self):
super(TestMistralNotifier, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestMistralNotifier, cls).setUpClass()