some cleaning
* remove unused methods * use testools assert exceptions * use tearDown where possible * redundant str() Change-Id: I18af00599461ead7bf9084168aeed7321adfd4c0
This commit is contained in:
parent
8f4de82480
commit
83efcb9e52
@ -1,28 +0,0 @@
|
|||||||
# Copyright 2016 Nokia
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
from vitrage_tempest_plugin.tests.base import BaseVitrageTempest
|
|
||||||
from vitrage_tempest_plugin.tests.common.constants import AodhProperties
|
|
||||||
from vitrage_tempest_plugin.tests.common.tempest_clients import TempestClients
|
|
||||||
|
|
||||||
|
|
||||||
class BaseAlarmsTest(BaseVitrageTempest):
|
|
||||||
"""Topology test class for Vitrage API tests."""
|
|
||||||
|
|
||||||
def _check_num_alarms(self, num_alarms=0, state=''):
|
|
||||||
if len(TempestClients.aodh().alarm.list()) != num_alarms:
|
|
||||||
return False
|
|
||||||
|
|
||||||
return all(alarm[AodhProperties.STATE].upper() == state.upper()
|
|
||||||
for alarm in TempestClients.aodh().alarm.list())
|
|
@ -1,66 +0,0 @@
|
|||||||
# Copyright 2016 Nokia
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from oslo_log import log as logging
|
|
||||||
from testtools import matchers
|
|
||||||
|
|
||||||
from vitrage_tempest_plugin.tests.api.alarms.base import BaseAlarmsTest
|
|
||||||
from vitrage_tempest_plugin.tests.base import IsNotEmpty
|
|
||||||
from vitrage_tempest_plugin.tests.common import general_utils as g_utils
|
|
||||||
from vitrage_tempest_plugin.tests.common import vitrage_utils as v_utils
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class TestAlarms(BaseAlarmsTest):
|
|
||||||
"""Alarms test class for Vitrage API tests."""
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setUpClass(cls):
|
|
||||||
super(TestAlarms, cls).setUpClass()
|
|
||||||
cls._template = v_utils.add_template('nagios_alarm_for_alarms.yaml')
|
|
||||||
|
|
||||||
# noinspection PyPep8Naming
|
|
||||||
@classmethod
|
|
||||||
def tearDownClass(cls):
|
|
||||||
if cls._template is not None:
|
|
||||||
v_utils.delete_template(cls._template['uuid'])
|
|
||||||
|
|
||||||
def _compare_alarms_lists(self, api_alarms, cli_alarms,
|
|
||||||
resource_type, resource_id):
|
|
||||||
"""Validate alarm existence """
|
|
||||||
self.assertThat(api_alarms, IsNotEmpty(),
|
|
||||||
'The alarms list taken from api is empty')
|
|
||||||
self.assertThat(cli_alarms, IsNotEmpty(),
|
|
||||||
'The alarms list taken from cli is empty')
|
|
||||||
|
|
||||||
LOG.info("The alarms list taken from cli is : " +
|
|
||||||
str(cli_alarms))
|
|
||||||
LOG.info("The alarms list taken by api is : " +
|
|
||||||
str(json.dumps(api_alarms)))
|
|
||||||
|
|
||||||
cli_items = cli_alarms.splitlines()
|
|
||||||
|
|
||||||
api_by_type = g_utils.all_matches(
|
|
||||||
api_alarms, vitrage_type=resource_type)
|
|
||||||
cli_by_type = cli_alarms.count(' ' + resource_type + ' ')
|
|
||||||
|
|
||||||
api_by_id = g_utils.all_matches(api_alarms, resource_id=resource_id)
|
|
||||||
cli_by_id = cli_alarms.count(resource_id)
|
|
||||||
|
|
||||||
self.assertEqual(len(cli_items), len(api_alarms) + 4)
|
|
||||||
self.assertThat(api_by_type, matchers.HasLength(cli_by_type))
|
|
||||||
self.assertThat(api_by_id, matchers.HasLength(cli_by_id))
|
|
@ -17,12 +17,10 @@ import json
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from testtools import matchers
|
from testtools import matchers
|
||||||
|
|
||||||
from vitrage_tempest_plugin.tests.api.alarms.base import BaseAlarmsTest
|
from vitrage_tempest_plugin.tests.base import BaseVitrageTempest
|
||||||
from vitrage_tempest_plugin.tests.base import IsNotEmpty
|
from vitrage_tempest_plugin.tests.base import IsNotEmpty
|
||||||
from vitrage_tempest_plugin.tests.common import aodh_utils
|
from vitrage_tempest_plugin.tests.common import aodh_utils
|
||||||
from vitrage_tempest_plugin.tests.common.constants import AODH_DATASOURCE
|
from vitrage_tempest_plugin.tests.common.constants import AODH_DATASOURCE
|
||||||
from vitrage_tempest_plugin.tests.common.constants import EdgeLabel
|
|
||||||
from vitrage_tempest_plugin.tests.common.constants import EdgeProperties
|
|
||||||
from vitrage_tempest_plugin.tests.common.constants import NOVA_HOST_DATASOURCE
|
from vitrage_tempest_plugin.tests.common.constants import NOVA_HOST_DATASOURCE
|
||||||
from vitrage_tempest_plugin.tests.common.constants import \
|
from vitrage_tempest_plugin.tests.common.constants import \
|
||||||
NOVA_INSTANCE_DATASOURCE
|
NOVA_INSTANCE_DATASOURCE
|
||||||
@ -42,7 +40,7 @@ RCA_ALARM_NAME = 'rca_test_host_alarm'
|
|||||||
VITRAGE_ALARM_NAME = 'instance_deduce'
|
VITRAGE_ALARM_NAME = 'instance_deduce'
|
||||||
|
|
||||||
|
|
||||||
class BaseRcaTest(BaseAlarmsTest):
|
class BaseRcaTest(BaseVitrageTempest):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _clean_all():
|
def _clean_all():
|
||||||
@ -132,24 +130,6 @@ class BaseRcaTest(BaseAlarmsTest):
|
|||||||
self.assertThat(deduce_alarms_2, matchers.HasLength(1),
|
self.assertThat(deduce_alarms_2, matchers.HasLength(1),
|
||||||
"Deduced alarm not found")
|
"Deduced alarm not found")
|
||||||
|
|
||||||
def _validate_relationship(self, links, alarms):
|
|
||||||
self.assertThat(links, IsNotEmpty(), 'The links list is empty')
|
|
||||||
self.assertThat(alarms, IsNotEmpty(), 'The alarms list is empty')
|
|
||||||
|
|
||||||
flag = True
|
|
||||||
for item in links:
|
|
||||||
source_alarm_name = alarms[item['source']].get(VProps.NAME)
|
|
||||||
target_alarm_name = alarms[item['target']].get(VProps.NAME)
|
|
||||||
relationship_type = item.get(EdgeProperties.RELATIONSHIP_TYPE)
|
|
||||||
if (item.get('key') != EdgeLabel.CAUSES or
|
|
||||||
relationship_type != EdgeLabel.CAUSES or
|
|
||||||
source_alarm_name != RCA_ALARM_NAME or
|
|
||||||
target_alarm_name != VITRAGE_ALARM_NAME):
|
|
||||||
flag = False
|
|
||||||
|
|
||||||
self.assertThat(alarms, matchers.HasLength(3))
|
|
||||||
self.assertTrue(flag)
|
|
||||||
|
|
||||||
def _validate_set_state(self, topology, instances):
|
def _validate_set_state(self, topology, instances):
|
||||||
self.assertThat(topology, IsNotEmpty(), 'The topology graph is empty')
|
self.assertThat(topology, IsNotEmpty(), 'The topology graph is empty')
|
||||||
host = g_utils.all_matches(
|
host = g_utils.all_matches(
|
||||||
@ -177,29 +157,8 @@ class BaseRcaTest(BaseAlarmsTest):
|
|||||||
self.assertThat(vm1, matchers.HasLength(1))
|
self.assertThat(vm1, matchers.HasLength(1))
|
||||||
self.assertThat(vm2, matchers.HasLength(1))
|
self.assertThat(vm2, matchers.HasLength(1))
|
||||||
|
|
||||||
def _validate_notifier(self, alarms, vitrage_alarms):
|
@staticmethod
|
||||||
self.assertThat(alarms, IsNotEmpty(), 'The aodh alarms list is empty')
|
def _get_hostname():
|
||||||
self.assertThat(vitrage_alarms, IsNotEmpty(),
|
|
||||||
'The vitrage alarms list is empty')
|
|
||||||
|
|
||||||
validation = 0
|
|
||||||
for itemC in alarms:
|
|
||||||
vitrage_id = filter(
|
|
||||||
lambda item: item['field'] == VProps.VITRAGE_ID,
|
|
||||||
itemC.event_rule['query'])
|
|
||||||
for itemV in vitrage_alarms:
|
|
||||||
if not vitrage_id:
|
|
||||||
if itemC.name == itemV[VProps.NAME]:
|
|
||||||
validation += 1
|
|
||||||
break
|
|
||||||
elif vitrage_id[0]['value'] == itemV[VProps.VITRAGE_ID]:
|
|
||||||
validation += 1
|
|
||||||
break
|
|
||||||
|
|
||||||
self.assertThat(vitrage_alarms, matchers.HasLength(validation))
|
|
||||||
self.assertThat(alarms, matchers.HasLength(3))
|
|
||||||
|
|
||||||
def _get_hostname(self):
|
|
||||||
host = vitrage_utils.get_first_host()
|
host = vitrage_utils.get_first_host()
|
||||||
return host.get(VProps.ID)
|
return host.get(VProps.ID)
|
||||||
|
|
||||||
|
@ -26,6 +26,10 @@ LOG = logging.getLogger(__name__)
|
|||||||
class TestRca(BaseRcaTest):
|
class TestRca(BaseRcaTest):
|
||||||
"""RCA test class for Vitrage API tests."""
|
"""RCA test class for Vitrage API tests."""
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(TestRca, self).tearDown()
|
||||||
|
self._clean_all()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(TestRca, cls).setUpClass()
|
super(TestRca, cls).setUpClass()
|
||||||
@ -45,19 +49,16 @@ class TestRca(BaseRcaTest):
|
|||||||
(created by special template file), and equals there
|
(created by special template file), and equals there
|
||||||
resource_id with created instances id
|
resource_id with created instances id
|
||||||
"""
|
"""
|
||||||
try:
|
instances = nova_utils.create_instances(num_instances=2,
|
||||||
instances = nova_utils.create_instances(num_instances=2,
|
set_public_network=True)
|
||||||
set_public_network=True)
|
self._create_alarm(
|
||||||
self._create_alarm(
|
resource_id=self._get_hostname(),
|
||||||
resource_id=self._get_hostname(),
|
alarm_name=RCA_ALARM_NAME)
|
||||||
alarm_name=RCA_ALARM_NAME)
|
api_alarms = self.vitrage_client.alarm.list(vitrage_id='all',
|
||||||
api_alarms = self.vitrage_client.alarm.list(vitrage_id='all',
|
all_tenants=True)
|
||||||
all_tenants=True)
|
|
||||||
|
|
||||||
self._validate_deduce_alarms(alarms=api_alarms,
|
self._validate_deduce_alarms(alarms=api_alarms,
|
||||||
instances=instances)
|
instances=instances)
|
||||||
finally:
|
|
||||||
self._clean_all()
|
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_validate_set_state(self):
|
def test_validate_set_state(self):
|
||||||
@ -68,18 +69,12 @@ class TestRca(BaseRcaTest):
|
|||||||
source state - ERROR
|
source state - ERROR
|
||||||
target state - SUBOPTIMAL (caused 2 created instance)
|
target state - SUBOPTIMAL (caused 2 created instance)
|
||||||
"""
|
"""
|
||||||
try:
|
instances = nova_utils.create_instances(num_instances=2,
|
||||||
instances = nova_utils.create_instances(num_instances=2,
|
set_public_network=True)
|
||||||
set_public_network=True)
|
self._create_alarm(
|
||||||
self._create_alarm(
|
resource_id=self._get_hostname(),
|
||||||
resource_id=self._get_hostname(),
|
alarm_name=RCA_ALARM_NAME)
|
||||||
alarm_name=RCA_ALARM_NAME)
|
topology = self.vitrage_client.topology.get(all_tenants=True)
|
||||||
topology = self.vitrage_client.topology.get(all_tenants=True)
|
|
||||||
|
|
||||||
self._validate_set_state(topology=topology['nodes'],
|
self._validate_set_state(topology=topology['nodes'],
|
||||||
instances=instances)
|
instances=instances)
|
||||||
except Exception as e:
|
|
||||||
self._handle_exception(e)
|
|
||||||
raise
|
|
||||||
finally:
|
|
||||||
self._clean_all()
|
|
||||||
|
@ -200,14 +200,3 @@ class TestResource(BaseVitrageTempest):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
cli_resource.get("State").lower(),
|
cli_resource.get("State").lower(),
|
||||||
api_resource.get(VProps.VITRAGE_OPERATIONAL_STATE).lower())
|
api_resource.get(VProps.VITRAGE_OPERATIONAL_STATE).lower())
|
||||||
|
|
||||||
def _compare_resource_show(self, api_resource_show,
|
|
||||||
cli_resource_show):
|
|
||||||
self.assertIsNotNone(api_resource_show,
|
|
||||||
'The resource show taken from rest api is empty')
|
|
||||||
self.assertIsNotNone(cli_resource_show,
|
|
||||||
'The resource show taken from terminal is empty')
|
|
||||||
|
|
||||||
for item in self.properties:
|
|
||||||
self.assertEqual(api_resource_show.get(item),
|
|
||||||
cli_resource_show.get(item))
|
|
||||||
|
@ -39,6 +39,15 @@ class BaseTemplateTest(BaseVitrageTempest):
|
|||||||
VALIDATION_OK = 'validation OK'
|
VALIDATION_OK = 'validation OK'
|
||||||
OK_MSG = 'Template validation is OK'
|
OK_MSG = 'Template validation is OK'
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(BaseTemplateTest, self).tearDown()
|
||||||
|
self._delete_templates()
|
||||||
|
|
||||||
|
def _delete_templates(self):
|
||||||
|
templates = self.vitrage_client.template.list()
|
||||||
|
template_ids = [template['uuid'] for template in templates]
|
||||||
|
self.vitrage_client.template.delete(template_ids)
|
||||||
|
|
||||||
def _compare_template_lists(self, api_templates, cli_templates):
|
def _compare_template_lists(self, api_templates, cli_templates):
|
||||||
self.assertThat(api_templates, IsNotEmpty(),
|
self.assertThat(api_templates, IsNotEmpty(),
|
||||||
'The template list taken from api is empty')
|
'The template list taken from api is empty')
|
||||||
@ -54,22 +63,6 @@ class BaseTemplateTest(BaseVitrageTempest):
|
|||||||
self._validate_passed_templates_length(api_templates, cli_templates)
|
self._validate_passed_templates_length(api_templates, cli_templates)
|
||||||
self._compare_each_template_in_list(api_templates, cli_templates)
|
self._compare_each_template_in_list(api_templates, cli_templates)
|
||||||
|
|
||||||
def _compare_template_validations(self, api_templates, cli_templates):
|
|
||||||
self.assertThat(api_templates, IsNotEmpty(),
|
|
||||||
'The template validations taken from api is empty')
|
|
||||||
self.assertIsNotNone(
|
|
||||||
cli_templates, 'The template validations taken from cli is empty')
|
|
||||||
|
|
||||||
LOG.info("The template validations taken from cli is : " +
|
|
||||||
str(cli_templates))
|
|
||||||
LOG.info("The template validations taken by api is : " +
|
|
||||||
str(json.dumps(api_templates)))
|
|
||||||
|
|
||||||
parsed_topology = json.loads(cli_templates)
|
|
||||||
sorted_cli_templates = sorted(parsed_topology.items())
|
|
||||||
sorted_api_templates = sorted(api_templates.items())
|
|
||||||
self.assert_list_equal(sorted_api_templates, sorted_cli_templates)
|
|
||||||
|
|
||||||
def _validate_templates_list_length(self, api_templates, cli_templates):
|
def _validate_templates_list_length(self, api_templates, cli_templates):
|
||||||
self.assertEqual(len(cli_templates.splitlines()),
|
self.assertEqual(len(cli_templates.splitlines()),
|
||||||
len(api_templates) + 4)
|
len(api_templates) + 4)
|
||||||
@ -93,16 +86,6 @@ class BaseTemplateTest(BaseVitrageTempest):
|
|||||||
break
|
break
|
||||||
self.assertThat(api_templates, matchers.HasLength(counter))
|
self.assertThat(api_templates, matchers.HasLength(counter))
|
||||||
|
|
||||||
def _run_default_template_validation(
|
|
||||||
self, template, validation, path):
|
|
||||||
self.assertThat(validation, IsNotEmpty(),
|
|
||||||
'The template validation is empty')
|
|
||||||
self.assertEqual(path, validation['file path'])
|
|
||||||
self.assertEqual(0, validation['status code'])
|
|
||||||
self.assertEqual(self.VALIDATION_OK, validation['status'])
|
|
||||||
self.assertEqual(self.OK_MSG, validation['message'])
|
|
||||||
self.assertEqual(validation['message'], template['status details'])
|
|
||||||
|
|
||||||
def _assert_validate_result(self, validation, path, negative=False,
|
def _assert_validate_result(self, validation, path, negative=False,
|
||||||
status_code=0):
|
status_code=0):
|
||||||
self.assertThat(validation['results'], matchers.HasLength(1))
|
self.assertThat(validation['results'], matchers.HasLength(1))
|
||||||
@ -110,14 +93,14 @@ class BaseTemplateTest(BaseVitrageTempest):
|
|||||||
self.assertIn(path, result['file path'])
|
self.assertIn(path, result['file path'])
|
||||||
|
|
||||||
if negative:
|
if negative:
|
||||||
self.assertEqual(status_code, result['status code'])
|
|
||||||
self.assertEqual(self.VALIDATION_FAILED, result['status'])
|
self.assertEqual(self.VALIDATION_FAILED, result['status'])
|
||||||
self.assertNotEqual(result['message'], self.OK_MSG)
|
self.assertNotEqual(result['message'], self.OK_MSG)
|
||||||
|
self.assertEqual(status_code, result['status code'])
|
||||||
return
|
return
|
||||||
|
|
||||||
self.assertEqual(0, result['status code'])
|
|
||||||
self.assertEqual(self.VALIDATION_OK, result['status'])
|
self.assertEqual(self.VALIDATION_OK, result['status'])
|
||||||
self.assertEqual(self.OK_MSG, result['message'])
|
self.assertEqual(self.OK_MSG, result['message'])
|
||||||
|
self.assertEqual(0, result['status code'])
|
||||||
|
|
||||||
def _assert_add_result(self, result, status, message):
|
def _assert_add_result(self, result, status, message):
|
||||||
self.assertThat(result, matchers.HasLength(1))
|
self.assertThat(result, matchers.HasLength(1))
|
||||||
@ -125,22 +108,6 @@ class BaseTemplateTest(BaseVitrageTempest):
|
|||||||
self.assertThat(result[0]['status details'],
|
self.assertThat(result[0]['status details'],
|
||||||
matchers.StartsWith(message))
|
matchers.StartsWith(message))
|
||||||
|
|
||||||
def _compare_template_show(self, api_templates, cli_templates):
|
|
||||||
self.assertThat(api_templates, IsNotEmpty(),
|
|
||||||
'The template validations taken from api is empty')
|
|
||||||
self.assertIsNotNone(
|
|
||||||
cli_templates, 'The template validations taken from cli is empty')
|
|
||||||
|
|
||||||
LOG.info("The template validations taken from cli is : " +
|
|
||||||
str(cli_templates))
|
|
||||||
LOG.info("The template validations taken by api is : " +
|
|
||||||
str(json.dumps(api_templates)))
|
|
||||||
|
|
||||||
parsed_topology = json.loads(cli_templates)
|
|
||||||
sorted_cli_templates = sorted(parsed_topology.items())
|
|
||||||
sorted_api_templates = sorted(api_templates.items())
|
|
||||||
self.assert_list_equal(sorted_api_templates, sorted_cli_templates)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _rollback_to_default(templates):
|
def _rollback_to_default(templates):
|
||||||
for t in templates:
|
for t in templates:
|
||||||
|
@ -69,13 +69,10 @@ class TestValidate(BaseTemplateTest):
|
|||||||
There negative test - validate error message
|
There negative test - validate error message
|
||||||
in case of non-exist template file
|
in case of non-exist template file
|
||||||
"""
|
"""
|
||||||
try:
|
path = self.TEST_PATH + self.NON_EXIST_FILE
|
||||||
path = self.TEST_PATH + self.NON_EXIST_FILE
|
self.assertRaises(IOError,
|
||||||
validation = self.vitrage_client.template.validate(path=path)
|
self.vitrage_client.template.validate,
|
||||||
self.assertIsNone(validation)
|
path=path)
|
||||||
except Exception as up:
|
|
||||||
self.assertEqual('No such file or directory', up.strerror)
|
|
||||||
self.assertEqual(2, up.errno)
|
|
||||||
|
|
||||||
def test_templates_validate_corrupted_templates(self):
|
def test_templates_validate_corrupted_templates(self):
|
||||||
"""templates_validate test
|
"""templates_validate test
|
||||||
@ -83,27 +80,21 @@ class TestValidate(BaseTemplateTest):
|
|||||||
There negative test - validate correctness of error
|
There negative test - validate correctness of error
|
||||||
message in case of corrupted template file
|
message in case of corrupted template file
|
||||||
"""
|
"""
|
||||||
try:
|
path = self.TEST_PATH + self.ERROR_FILE
|
||||||
path = self.TEST_PATH + self.ERROR_FILE
|
validation = self.vitrage_client.template.validate(path=path)
|
||||||
validation = self.vitrage_client.template.validate(path=path)
|
self.assertThat(validation['results'], matchers.HasLength(1))
|
||||||
self.assertThat(validation['results'], matchers.HasLength(1))
|
self._assert_validate_result(validation, path,
|
||||||
self._assert_validate_result(
|
negative=True, status_code=3)
|
||||||
validation, path, negative=True, status_code=3)
|
|
||||||
except Exception:
|
|
||||||
LOG.error('Failed to get validation of corrupted template file')
|
|
||||||
|
|
||||||
def test_templates_validate_correct_template(self):
|
def test_templates_validate_correct_template(self):
|
||||||
"""templates_validate test
|
"""templates_validate test
|
||||||
|
|
||||||
There test validate correctness of template file
|
There test validate correctness of template file
|
||||||
"""
|
"""
|
||||||
try:
|
path = self.TEST_PATH + self.OK_FILE
|
||||||
path = self.TEST_PATH + self.OK_FILE
|
validation = self.vitrage_client.template.validate(path=path)
|
||||||
validation = self.vitrage_client.template.validate(path=path)
|
self.assertThat(validation['results'], matchers.HasLength(1))
|
||||||
self.assertThat(validation['results'], matchers.HasLength(1))
|
self._assert_validate_result(validation, path)
|
||||||
self._assert_validate_result(validation, path)
|
|
||||||
except Exception:
|
|
||||||
LOG.error('Failed to get validation of template file')
|
|
||||||
|
|
||||||
|
|
||||||
class TemplatesDBTest(BaseTemplateTest):
|
class TemplatesDBTest(BaseTemplateTest):
|
||||||
@ -114,47 +105,42 @@ class TemplatesDBTest(BaseTemplateTest):
|
|||||||
|
|
||||||
test standard , definition and equivalence templates
|
test standard , definition and equivalence templates
|
||||||
"""
|
"""
|
||||||
templates_names = list()
|
# TODO(ikinory): add folder of templates
|
||||||
try:
|
# Add standard ,equivalence and definition templates
|
||||||
# TODO(ikinory): add folder of templates
|
self._add_templates()
|
||||||
# Add standard ,equivalence and definition templates
|
# assert standard template
|
||||||
templates_names = self._add_templates()
|
db_row = v_utils.get_first_template(
|
||||||
# assert standard template
|
name='host_high_memory_usage_scenarios', type=TTypes.STANDARD)
|
||||||
db_row = v_utils.get_first_template(
|
self.assertEqual(db_row['name'],
|
||||||
name='host_high_memory_usage_scenarios', type=TTypes.STANDARD)
|
'host_high_memory_usage_scenarios',
|
||||||
self.assertEqual(db_row['name'],
|
'standard template not found in list')
|
||||||
'host_high_memory_usage_scenarios',
|
|
||||||
'standard template not found in list')
|
|
||||||
|
|
||||||
# assert equivalence template
|
# assert equivalence template
|
||||||
db_row = v_utils.get_first_template(
|
db_row = v_utils.get_first_template(
|
||||||
name='entity equivalence example',
|
name='entity equivalence example',
|
||||||
type=TTypes.EQUIVALENCE)
|
type=TTypes.EQUIVALENCE)
|
||||||
self.assertEqual(db_row['name'],
|
self.assertEqual(db_row['name'],
|
||||||
'entity equivalence example',
|
'entity equivalence example',
|
||||||
'equivalence template not found in list')
|
'equivalence template not found in list')
|
||||||
|
|
||||||
# assert definition template
|
# assert definition template
|
||||||
db_row = v_utils.get_first_template(
|
db_row = v_utils.get_first_template(
|
||||||
name='basic_def_template',
|
name='basic_def_template',
|
||||||
type=TTypes.DEFINITION,
|
type=TTypes.DEFINITION,
|
||||||
status=TemplateStatus.ACTIVE)
|
status=TemplateStatus.ACTIVE)
|
||||||
|
|
||||||
self.assertEqual(db_row['name'],
|
self.assertEqual(db_row['name'],
|
||||||
'basic_def_template',
|
'basic_def_template',
|
||||||
'definition template not found in list')
|
'definition template not found in list')
|
||||||
|
|
||||||
# assert corrupted template - validate failed
|
# assert corrupted template - validate failed
|
||||||
db_row = v_utils.get_first_template(
|
db_row = v_utils.get_first_template(
|
||||||
name='corrupted_template',
|
name='corrupted_template',
|
||||||
type=TTypes.STANDARD,
|
type=TTypes.STANDARD,
|
||||||
status=TemplateStatus.ERROR)
|
status=TemplateStatus.ERROR)
|
||||||
self.assertIsNotNone(
|
self.assertIsNotNone(
|
||||||
db_row,
|
db_row,
|
||||||
'corrupted template template presented in list')
|
'corrupted template template presented in list')
|
||||||
|
|
||||||
finally:
|
|
||||||
self._rollback_to_default(templates_names)
|
|
||||||
|
|
||||||
def test_template_delete(self):
|
def test_template_delete(self):
|
||||||
|
|
||||||
@ -181,26 +167,22 @@ class TemplatesDBTest(BaseTemplateTest):
|
|||||||
to cli template list
|
to cli template list
|
||||||
compares each template in list
|
compares each template in list
|
||||||
"""
|
"""
|
||||||
templates_names = list()
|
# Add standard ,equivalence and definition templates
|
||||||
try:
|
self._add_templates()
|
||||||
# Add standard ,equivalence and definition templates
|
cli_templates_list = utils.run_vitrage_command(
|
||||||
templates_names = self._add_templates()
|
"vitrage template list")
|
||||||
cli_templates_list = utils.run_vitrage_command(
|
api_templates_list = self.vitrage_client.template.list()
|
||||||
"vitrage template list")
|
|
||||||
api_templates_list = self.vitrage_client.template.list()
|
|
||||||
|
|
||||||
self.assertThat(api_templates_list, IsNotEmpty(),
|
self.assertThat(api_templates_list, IsNotEmpty(),
|
||||||
'The template list taken from api is empty')
|
'The template list taken from api is empty')
|
||||||
self.assertIsNotNone(cli_templates_list,
|
self.assertIsNotNone(cli_templates_list,
|
||||||
'The template list taken from cli is empty')
|
'The template list taken from cli is empty')
|
||||||
self._validate_templates_list_length(api_templates_list,
|
self._validate_templates_list_length(api_templates_list,
|
||||||
cli_templates_list)
|
cli_templates_list)
|
||||||
self._validate_passed_templates_length(api_templates_list,
|
self._validate_passed_templates_length(api_templates_list,
|
||||||
cli_templates_list)
|
cli_templates_list)
|
||||||
self._compare_each_template_in_list(api_templates_list,
|
self._compare_each_template_in_list(api_templates_list,
|
||||||
cli_templates_list)
|
cli_templates_list)
|
||||||
finally:
|
|
||||||
self._rollback_to_default(templates_names)
|
|
||||||
|
|
||||||
def test_template_show(self):
|
def test_template_show(self):
|
||||||
"""Compare template content from file to DB"""
|
"""Compare template content from file to DB"""
|
||||||
@ -221,7 +203,8 @@ class TemplatesDBTest(BaseTemplateTest):
|
|||||||
"Template content doesn't match")
|
"Template content doesn't match")
|
||||||
v_utils.delete_template(db_row['uuid'])
|
v_utils.delete_template(db_row['uuid'])
|
||||||
|
|
||||||
def _add_templates(self):
|
@staticmethod
|
||||||
|
def _add_templates():
|
||||||
v_utils.add_template(STANDARD_TEMPLATE,
|
v_utils.add_template(STANDARD_TEMPLATE,
|
||||||
template_type=TTypes.STANDARD)
|
template_type=TTypes.STANDARD)
|
||||||
v_utils.add_template(EQUIVALENCE_TEMPLATE,
|
v_utils.add_template(EQUIVALENCE_TEMPLATE,
|
||||||
|
@ -32,15 +32,11 @@ TEMPLATE_VALIDATION_OK = 'Template validation is OK'
|
|||||||
|
|
||||||
class TestTemplatesApis(BaseTemplateTest):
|
class TestTemplatesApis(BaseTemplateTest):
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
super(TestTemplatesApis, self).tearDown()
|
|
||||||
self._delete_templates()
|
|
||||||
|
|
||||||
def _validate_no_type_templates(self, template_name):
|
def _validate_no_type_templates(self, template_name):
|
||||||
path = self.TEST_PATH + template_name
|
path = self.TEST_PATH + template_name
|
||||||
validation = self.vitrage_client.template.validate(path=path)
|
validation = self.vitrage_client.template.validate(path=path)
|
||||||
self._assert_validate_result(
|
self._assert_validate_result(
|
||||||
validation, path, negative=True, status_code='')
|
validation, path, negative=True, status_code=66)
|
||||||
|
|
||||||
def _validate_standard_template(self, template_name):
|
def _validate_standard_template(self, template_name):
|
||||||
path = self.TEST_PATH + template_name
|
path = self.TEST_PATH + template_name
|
||||||
@ -98,18 +94,9 @@ class TestTemplatesApis(BaseTemplateTest):
|
|||||||
result = self.vitrage_client.template.add(path=path, params=params)
|
result = self.vitrage_client.template.add(path=path, params=params)
|
||||||
self._assert_add_result(result, LOADING_STATUS, TEMPLATE_VALIDATION_OK)
|
self._assert_add_result(result, LOADING_STATUS, TEMPLATE_VALIDATION_OK)
|
||||||
|
|
||||||
def _delete_templates(self):
|
|
||||||
templates = self.vitrage_client.template.list()
|
|
||||||
template_ids = [template['uuid'] for template in templates]
|
|
||||||
self.vitrage_client.template.delete(template_ids)
|
|
||||||
|
|
||||||
|
|
||||||
class TestTemplatesV2(TestTemplatesApis):
|
class TestTemplatesV2(TestTemplatesApis):
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
super(TestTemplatesV2, self).tearDown()
|
|
||||||
self._delete_templates()
|
|
||||||
|
|
||||||
def test_templates_validate_no_type_templates(self):
|
def test_templates_validate_no_type_templates(self):
|
||||||
self._validate_no_type_templates(NO_TYPE_TEMPLATE)
|
self._validate_no_type_templates(NO_TYPE_TEMPLATE)
|
||||||
|
|
||||||
|
@ -13,13 +13,10 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from testtools import ExpectedException
|
||||||
|
|
||||||
from vitrage_tempest_plugin.tests.api.topology.base import BaseTopologyTest
|
from vitrage_tempest_plugin.tests.api.topology.base import BaseTopologyTest
|
||||||
from vitrage_tempest_plugin.tests.base import IsEmpty
|
from vitrage_tempest_plugin.tests.base import IsEmpty
|
||||||
from vitrage_tempest_plugin.tests.common.constants import OPENSTACK_CLUSTER
|
|
||||||
from vitrage_tempest_plugin.tests.common.constants import VertexProperties as \
|
|
||||||
VProps
|
|
||||||
import vitrage_tempest_plugin.tests.utils as utils
|
import vitrage_tempest_plugin.tests.utils as utils
|
||||||
from vitrageclient.exceptions import ClientException
|
from vitrageclient.exceptions import ClientException
|
||||||
|
|
||||||
@ -39,10 +36,9 @@ class TestTopology(BaseTopologyTest):
|
|||||||
NUM_INSTANCE = 3
|
NUM_INSTANCE = 3
|
||||||
NUM_VOLUME = 1
|
NUM_VOLUME = 1
|
||||||
|
|
||||||
def _get_root_vertex_id(self):
|
def tearDown(self):
|
||||||
items = self.vitrage_client.resource.list(
|
super(TestTopology, self).tearDown()
|
||||||
resource_type=OPENSTACK_CLUSTER, all_tenants=True)
|
self._rollback_to_default()
|
||||||
return items[0][VProps.VITRAGE_ID]
|
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_compare_api_and_cli(self):
|
def test_compare_api_and_cli(self):
|
||||||
@ -277,21 +273,18 @@ class TestTopology(BaseTopologyTest):
|
|||||||
This test validate correctness of topology
|
This test validate correctness of topology
|
||||||
graph with depth and without root
|
graph with depth and without root
|
||||||
"""
|
"""
|
||||||
try:
|
# Action
|
||||||
# Action
|
self._create_entities(num_instances=self.NUM_INSTANCE,
|
||||||
self._create_entities(num_instances=self.NUM_INSTANCE,
|
num_volumes=self.NUM_VOLUME)
|
||||||
num_volumes=self.NUM_VOLUME)
|
|
||||||
|
with ExpectedException(ClientException,
|
||||||
|
"Graph-type 'graph' "
|
||||||
|
"requires a 'root' with 'depth'"):
|
||||||
|
|
||||||
# Calculate expected results
|
|
||||||
self.vitrage_client.topology.get(
|
self.vitrage_client.topology.get(
|
||||||
limit=2,
|
limit=2,
|
||||||
root=None,
|
root=None,
|
||||||
all_tenants=True)
|
all_tenants=True)
|
||||||
except ClientException as e:
|
|
||||||
self.assertEqual(403, e.code)
|
|
||||||
self.assertEqual(
|
|
||||||
"Graph-type 'graph' requires a 'root' with 'depth'",
|
|
||||||
str(e.message))
|
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_graph_with_no_match_query(self):
|
def test_graph_with_no_match_query(self):
|
||||||
|
@ -93,7 +93,7 @@ class TestWebhook(BaseVitrageTempest):
|
|||||||
def test_delete_non_existing_webhook(self):
|
def test_delete_non_existing_webhook(self):
|
||||||
self.assertRaises(ClientException,
|
self.assertRaises(ClientException,
|
||||||
self.vitrage_client.webhook.delete,
|
self.vitrage_client.webhook.delete,
|
||||||
('non existant'))
|
'non existent')
|
||||||
|
|
||||||
def test_list_webhook(self):
|
def test_list_webhook(self):
|
||||||
|
|
||||||
|
@ -334,11 +334,7 @@ class BaseVitrageTempest(test.BaseTestCase):
|
|||||||
(timestamp_name, vertex, utils.TIMESTAMP_FORMAT))
|
(timestamp_name, vertex, utils.TIMESTAMP_FORMAT))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_value(item, key):
|
def _calc_num_admin_tenant_networks():
|
||||||
return utils.uni2str(item[key])
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def _calc_num_admin_tenant_networks(cls):
|
|
||||||
neutron_client = TempestClients.neutron()
|
neutron_client = TempestClients.neutron()
|
||||||
admin_creds = common_creds.get_configured_admin_credentials()
|
admin_creds = common_creds.get_configured_admin_credentials()
|
||||||
tenant_networks = neutron_client.list_networks(
|
tenant_networks = neutron_client.list_networks(
|
||||||
|
@ -41,7 +41,7 @@ def create_instances(num_instances=1, set_public_network=False, name='vm'):
|
|||||||
return resources
|
return resources
|
||||||
if not success:
|
if not success:
|
||||||
LOG.warning("create instance failed, delete and retry %s",
|
LOG.warning("create instance failed, delete and retry %s",
|
||||||
str(resources))
|
resources)
|
||||||
delete_created_instances(resources)
|
delete_created_instances(resources)
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
raise AssertionError("Unable to create vms, retries failed")
|
raise AssertionError("Unable to create vms, retries failed")
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from vitrage_tempest_plugin.tests import utils
|
from vitrage_tempest_plugin.tests import utils
|
||||||
|
|
||||||
from vitrage_tempest_plugin.tests.api.alarms.base import BaseAlarmsTest
|
from vitrage_tempest_plugin.tests.base import BaseVitrageTempest
|
||||||
from vitrage_tempest_plugin.tests.common import aodh_utils
|
from vitrage_tempest_plugin.tests.common import aodh_utils
|
||||||
from vitrage_tempest_plugin.tests.common import nova_utils
|
from vitrage_tempest_plugin.tests.common import nova_utils
|
||||||
from vitrage_tempest_plugin.tests.common.tempest_clients import TempestClients
|
from vitrage_tempest_plugin.tests.common.tempest_clients import TempestClients
|
||||||
@ -23,130 +23,120 @@ from vitrage_tempest_plugin.tests.common.tempest_clients import TempestClients
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TestAodhAlarm(BaseAlarmsTest):
|
class TestAodhAlarm(BaseVitrageTempest):
|
||||||
NUM_INSTANCE = 1
|
NUM_INSTANCE = 1
|
||||||
NUM_ALARM = 1
|
NUM_ALARM = 1
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(TestAodhAlarm, self).tearDown()
|
||||||
|
aodh_utils.delete_all_aodh_alarms()
|
||||||
|
aodh_utils.delete_all_gnocchi_metrics()
|
||||||
|
nova_utils.delete_all_instances()
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_alarm_with_resource_id(self):
|
def test_alarm_with_resource_id(self):
|
||||||
try:
|
# Action
|
||||||
# Action
|
nova_utils.create_instances(num_instances=self.NUM_INSTANCE)
|
||||||
nova_utils.create_instances(num_instances=self.NUM_INSTANCE)
|
aodh_utils.create_aodh_alarm(self._find_instance_resource_id())
|
||||||
aodh_utils.create_aodh_alarm(self._find_instance_resource_id())
|
# Calculate expected results
|
||||||
# Calculate expected results
|
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
||||||
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
entities = self._entities_validation_data(
|
||||||
entities = self._entities_validation_data(
|
host_entities=1,
|
||||||
host_entities=1,
|
host_edges=1 + self.NUM_INSTANCE,
|
||||||
host_edges=1 + self.NUM_INSTANCE,
|
instance_entities=self.NUM_INSTANCE,
|
||||||
instance_entities=self.NUM_INSTANCE,
|
instance_edges=2 * self.NUM_INSTANCE + self.NUM_ALARM,
|
||||||
instance_edges=2 * self.NUM_INSTANCE + self.NUM_ALARM,
|
aodh_entities=self.NUM_ALARM,
|
||||||
aodh_entities=self.NUM_ALARM,
|
aodh_edges=self.NUM_ALARM)
|
||||||
aodh_edges=self.NUM_ALARM)
|
num_entities = self.num_default_entities + \
|
||||||
num_entities = self.num_default_entities + \
|
2 * self.NUM_INSTANCE + self.NUM_ALARM + \
|
||||||
2 * self.NUM_INSTANCE + self.NUM_ALARM + \
|
self.num_default_networks + self.num_default_ports
|
||||||
self.num_default_networks + self.num_default_ports
|
num_edges = self.num_default_edges + 3 * self.NUM_INSTANCE + \
|
||||||
num_edges = self.num_default_edges + 3 * self.NUM_INSTANCE + \
|
self.NUM_ALARM + self.num_default_ports
|
||||||
self.NUM_ALARM + self.num_default_ports
|
|
||||||
|
|
||||||
# Test Assertions
|
# Test Assertions
|
||||||
self._validate_graph_correctness(graph,
|
self._validate_graph_correctness(graph,
|
||||||
num_entities,
|
num_entities,
|
||||||
num_edges,
|
num_edges,
|
||||||
entities)
|
entities)
|
||||||
finally:
|
|
||||||
aodh_utils.delete_all_aodh_alarms()
|
|
||||||
nova_utils.delete_all_instances()
|
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_gnocchi_aggregation_by_metrics_threshold_alarm(self):
|
def test_gnocchi_aggregation_by_metrics_threshold_alarm(self):
|
||||||
try:
|
# Action
|
||||||
# Action
|
nova_utils.create_instances(num_instances=self.NUM_INSTANCE)
|
||||||
nova_utils.create_instances(num_instances=self.NUM_INSTANCE)
|
aodh_utils.create_aodh_metrics_threshold_alarm()
|
||||||
aodh_utils.create_aodh_metrics_threshold_alarm()
|
|
||||||
|
|
||||||
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
||||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||||
entities = self._entities_validation_data(
|
entities = self._entities_validation_data(
|
||||||
host_entities=1,
|
host_entities=1,
|
||||||
host_edges=1 + self.NUM_INSTANCE,
|
host_edges=1 + self.NUM_INSTANCE,
|
||||||
instance_entities=self.NUM_INSTANCE,
|
instance_entities=self.NUM_INSTANCE,
|
||||||
instance_edges=2 * self.NUM_INSTANCE,
|
instance_edges=2 * self.NUM_INSTANCE,
|
||||||
aodh_entities=self.NUM_ALARM,
|
aodh_entities=self.NUM_ALARM,
|
||||||
aodh_edges=0)
|
aodh_edges=0)
|
||||||
num_entities = self.num_default_entities + \
|
num_entities = self.num_default_entities + \
|
||||||
2 * self.NUM_INSTANCE + self.NUM_ALARM + \
|
2 * self.NUM_INSTANCE + self.NUM_ALARM + \
|
||||||
self.num_default_networks + self.num_default_ports
|
self.num_default_networks + self.num_default_ports
|
||||||
num_edges = self.num_default_edges + 3 * self.NUM_INSTANCE + \
|
num_edges = self.num_default_edges + 3 * self.NUM_INSTANCE + \
|
||||||
self.num_default_ports
|
self.num_default_ports
|
||||||
|
|
||||||
self._validate_graph_correctness(graph,
|
self._validate_graph_correctness(graph,
|
||||||
num_entities,
|
num_entities,
|
||||||
num_edges,
|
num_edges,
|
||||||
entities)
|
entities)
|
||||||
finally:
|
|
||||||
aodh_utils.delete_all_aodh_alarms()
|
|
||||||
aodh_utils.delete_all_gnocchi_metrics()
|
|
||||||
nova_utils.delete_all_instances()
|
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_gnocchi_aggregation_by_resources_threshold(self):
|
def test_gnocchi_aggregation_by_resources_threshold(self):
|
||||||
try:
|
# Action
|
||||||
# Action
|
nova_utils.create_instances(num_instances=self.NUM_INSTANCE)
|
||||||
nova_utils.create_instances(num_instances=self.NUM_INSTANCE)
|
aodh_utils.create_aodh_resources_threshold_alarm(
|
||||||
aodh_utils.create_aodh_resources_threshold_alarm(
|
resource_id=self._find_instance_resource_id())
|
||||||
resource_id=self._find_instance_resource_id())
|
|
||||||
|
|
||||||
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
||||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||||
entities = self._entities_validation_data(
|
entities = self._entities_validation_data(
|
||||||
host_entities=1,
|
host_entities=1,
|
||||||
host_edges=1 + self.NUM_INSTANCE,
|
host_edges=1 + self.NUM_INSTANCE,
|
||||||
instance_entities=self.NUM_INSTANCE,
|
instance_entities=self.NUM_INSTANCE,
|
||||||
instance_edges=2 * self.NUM_INSTANCE + self.NUM_ALARM,
|
instance_edges=2 * self.NUM_INSTANCE + self.NUM_ALARM,
|
||||||
aodh_entities=self.NUM_ALARM,
|
aodh_entities=self.NUM_ALARM,
|
||||||
aodh_edges=self.NUM_ALARM)
|
aodh_edges=self.NUM_ALARM)
|
||||||
num_entities = self.num_default_entities + \
|
num_entities = self.num_default_entities + \
|
||||||
2 * self.NUM_INSTANCE + self.NUM_ALARM + \
|
2 * self.NUM_INSTANCE + self.NUM_ALARM + \
|
||||||
self.num_default_networks + self.num_default_ports
|
self.num_default_networks + self.num_default_ports
|
||||||
num_edges = self.num_default_edges + 3 * self.NUM_INSTANCE + \
|
num_edges = self.num_default_edges + 3 * self.NUM_INSTANCE + \
|
||||||
+ self.NUM_ALARM + self.num_default_ports
|
+ self.NUM_ALARM + self.num_default_ports
|
||||||
|
|
||||||
self._validate_graph_correctness(graph,
|
self._validate_graph_correctness(graph,
|
||||||
num_entities,
|
num_entities,
|
||||||
num_edges,
|
num_edges,
|
||||||
entities)
|
entities)
|
||||||
finally:
|
|
||||||
aodh_utils.delete_all_aodh_alarms()
|
|
||||||
aodh_utils.delete_all_gnocchi_metrics()
|
|
||||||
nova_utils.delete_all_instances()
|
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_alarm_without_resource_id(self):
|
def test_alarm_without_resource_id(self):
|
||||||
try:
|
# Action
|
||||||
# Action
|
aodh_utils.create_aodh_alarm()
|
||||||
aodh_utils.create_aodh_alarm()
|
|
||||||
|
|
||||||
# Calculate expected results
|
# Calculate expected results
|
||||||
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
||||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||||
entities = self._entities_validation_data(
|
entities = self._entities_validation_data(
|
||||||
host_entities=1,
|
host_entities=1,
|
||||||
host_edges=1,
|
host_edges=1,
|
||||||
aodh_entities=self.NUM_ALARM,
|
aodh_entities=self.NUM_ALARM,
|
||||||
aodh_edges=0)
|
aodh_edges=0)
|
||||||
num_entities = self.num_default_entities + self.NUM_ALARM + \
|
num_entities = self.num_default_entities + self.NUM_ALARM + \
|
||||||
self.num_default_networks + self.num_default_ports
|
self.num_default_networks + self.num_default_ports
|
||||||
num_edges = self.num_default_edges + self.num_default_ports
|
num_edges = self.num_default_edges + self.num_default_ports
|
||||||
|
|
||||||
# Test Assertions
|
# Test Assertions
|
||||||
self._validate_graph_correctness(graph,
|
self._validate_graph_correctness(graph,
|
||||||
num_entities,
|
num_entities,
|
||||||
num_edges,
|
num_edges,
|
||||||
entities)
|
entities)
|
||||||
finally:
|
|
||||||
aodh_utils.delete_all_aodh_alarms()
|
|
||||||
|
|
||||||
def _find_instance_resource_id(self):
|
@staticmethod
|
||||||
|
def _find_instance_resource_id():
|
||||||
servers = TempestClients.nova().servers.list()
|
servers = TempestClients.nova().servers.list()
|
||||||
return servers[0].id
|
return servers[0].id
|
||||||
|
@ -23,6 +23,10 @@ class TestCinderVolume(BaseTopologyTest):
|
|||||||
NUM_INSTANCE = 3
|
NUM_INSTANCE = 3
|
||||||
NUM_VOLUME = 1
|
NUM_VOLUME = 1
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(TestCinderVolume, self).tearDown()
|
||||||
|
self._rollback_to_default()
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_volume(self):
|
def test_volume(self):
|
||||||
# Action
|
# Action
|
||||||
|
@ -28,6 +28,10 @@ LOG = logging.getLogger(__name__)
|
|||||||
class TestHeatStack(BaseTopologyTest):
|
class TestHeatStack(BaseTopologyTest):
|
||||||
NUM_STACKS = 1
|
NUM_STACKS = 1
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(TestHeatStack, self).tearDown()
|
||||||
|
heat_utils.delete_all_stacks()
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_nested_heat_stack(self):
|
def test_nested_heat_stack(self):
|
||||||
self._test_heat_stack(nested=True,
|
self._test_heat_stack(nested=True,
|
||||||
@ -44,34 +48,31 @@ class TestHeatStack(BaseTopologyTest):
|
|||||||
"""
|
"""
|
||||||
template_file = tempest_resources_dir() + '/heat/' + tmpl_file
|
template_file = tempest_resources_dir() + '/heat/' + tmpl_file
|
||||||
image = glance_utils.get_first_image()
|
image = glance_utils.get_first_image()
|
||||||
try:
|
# Action
|
||||||
# Action
|
heat_utils.create_stacks(self.NUM_STACKS, nested, template_file,
|
||||||
heat_utils.create_stacks(self.NUM_STACKS, nested, template_file,
|
image['name'])
|
||||||
image['name'])
|
|
||||||
|
|
||||||
# Calculate expected results
|
# Calculate expected results
|
||||||
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
||||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||||
entities = self._entities_validation_data(
|
entities = self._entities_validation_data(
|
||||||
host_entities=1,
|
host_entities=1,
|
||||||
host_edges=1 + self.NUM_STACKS,
|
host_edges=1 + self.NUM_STACKS,
|
||||||
instance_entities=self.NUM_STACKS,
|
instance_entities=self.NUM_STACKS,
|
||||||
instance_edges=3 * self.NUM_STACKS,
|
instance_edges=3 * self.NUM_STACKS,
|
||||||
network_entities=self.num_default_networks,
|
network_entities=self.num_default_networks,
|
||||||
network_edges=self.num_default_ports + self.NUM_STACKS,
|
network_edges=self.num_default_ports + self.NUM_STACKS,
|
||||||
port_entities=self.num_default_ports + self.NUM_STACKS,
|
port_entities=self.num_default_ports + self.NUM_STACKS,
|
||||||
port_edges=self.num_default_ports + 2 * self.NUM_STACKS,
|
port_edges=self.num_default_ports + 2 * self.NUM_STACKS,
|
||||||
stack_entities=self.NUM_STACKS,
|
stack_entities=self.NUM_STACKS,
|
||||||
stack_edges=self.NUM_STACKS)
|
stack_edges=self.NUM_STACKS)
|
||||||
num_entities = self.num_default_entities + 3 * self.NUM_STACKS + \
|
num_entities = self.num_default_entities + 3 * self.NUM_STACKS + \
|
||||||
self.num_default_networks + self.num_default_ports
|
self.num_default_networks + self.num_default_ports
|
||||||
num_edges = self.num_default_edges + 4 * self.NUM_STACKS + \
|
num_edges = self.num_default_edges + 4 * self.NUM_STACKS + \
|
||||||
self.num_default_ports
|
self.num_default_ports
|
||||||
|
|
||||||
# Test Assertions
|
# Test Assertions
|
||||||
self._validate_graph_correctness(graph,
|
self._validate_graph_correctness(graph,
|
||||||
num_entities,
|
num_entities,
|
||||||
num_edges,
|
num_edges,
|
||||||
entities)
|
entities)
|
||||||
finally:
|
|
||||||
heat_utils.delete_all_stacks()
|
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from vitrage_tempest_plugin.tests.api.topology.base import BaseTopologyTest
|
from vitrage_tempest_plugin.tests.api.topology.base import BaseTopologyTest
|
||||||
from vitrage_tempest_plugin.tests.common.constants import VertexProperties as \
|
|
||||||
VProps
|
|
||||||
from vitrage_tempest_plugin.tests.common import general_utils as g_utils
|
|
||||||
from vitrage_tempest_plugin.tests.common import nova_utils
|
from vitrage_tempest_plugin.tests.common import nova_utils
|
||||||
from vitrage_tempest_plugin.tests import utils
|
from vitrage_tempest_plugin.tests import utils
|
||||||
|
|
||||||
@ -27,6 +24,10 @@ LOG = logging.getLogger(__name__)
|
|||||||
class TestNeutron(BaseTopologyTest):
|
class TestNeutron(BaseTopologyTest):
|
||||||
NUM_INSTANCE = 3
|
NUM_INSTANCE = 3
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(TestNeutron, self).tearDown()
|
||||||
|
nova_utils.delete_all_instances()
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_neutron(self):
|
def test_neutron(self):
|
||||||
"""neutron test
|
"""neutron test
|
||||||
@ -34,65 +35,30 @@ class TestNeutron(BaseTopologyTest):
|
|||||||
This test validate correctness topology graph with neutron module
|
This test validate correctness topology graph with neutron module
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
# Action
|
||||||
# Action
|
nova_utils.create_instances(num_instances=self.NUM_INSTANCE,
|
||||||
nova_utils.create_instances(num_instances=self.NUM_INSTANCE,
|
set_public_network=True)
|
||||||
set_public_network=True)
|
|
||||||
|
|
||||||
# Calculate expected results
|
# Calculate expected results
|
||||||
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
||||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||||
entities = self._entities_validation_data(
|
entities = self._entities_validation_data(
|
||||||
host_entities=1,
|
host_entities=1,
|
||||||
host_edges=1 + self.NUM_INSTANCE,
|
host_edges=1 + self.NUM_INSTANCE,
|
||||||
instance_entities=self.NUM_INSTANCE,
|
instance_entities=self.NUM_INSTANCE,
|
||||||
instance_edges=2 * self.NUM_INSTANCE,
|
instance_edges=2 * self.NUM_INSTANCE,
|
||||||
network_entities=self.num_default_networks,
|
network_entities=self.num_default_networks,
|
||||||
network_edges=self.num_default_ports + self.NUM_INSTANCE,
|
network_edges=self.num_default_ports + self.NUM_INSTANCE,
|
||||||
port_entities=self.num_default_ports + self.NUM_INSTANCE,
|
port_entities=self.num_default_ports + self.NUM_INSTANCE,
|
||||||
port_edges=self.num_default_ports + 2 * self.NUM_INSTANCE)
|
port_edges=self.num_default_ports + 2 * self.NUM_INSTANCE)
|
||||||
num_entities = self.num_default_entities + \
|
num_entities = self.num_default_entities + \
|
||||||
2 * self.NUM_INSTANCE + \
|
2 * self.NUM_INSTANCE + \
|
||||||
self.num_default_networks + self.num_default_ports
|
self.num_default_networks + self.num_default_ports
|
||||||
num_edges = self.num_default_edges + 3 * self.NUM_INSTANCE + \
|
num_edges = self.num_default_edges + 3 * self.NUM_INSTANCE + \
|
||||||
self.num_default_ports
|
self.num_default_ports
|
||||||
|
|
||||||
# Test Assertions
|
# Test Assertions
|
||||||
self._validate_graph_correctness(graph,
|
self._validate_graph_correctness(graph,
|
||||||
num_entities,
|
num_entities,
|
||||||
num_edges,
|
num_edges,
|
||||||
entities)
|
entities)
|
||||||
finally:
|
|
||||||
nova_utils.delete_all_instances()
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _get_network_name(instance, networks):
|
|
||||||
for network in networks:
|
|
||||||
try:
|
|
||||||
if len(instance.networks[network[VProps.NAME]]) > 0:
|
|
||||||
return network[VProps.NAME]
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
return None
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _port_to_inst_edges(instances, network_name, ports):
|
|
||||||
counter = 0
|
|
||||||
for vm in instances:
|
|
||||||
for port in ports:
|
|
||||||
ips_number = 0
|
|
||||||
for vm_ip in vm.addresses[network_name]:
|
|
||||||
for port_ip in port['fixed_ips']:
|
|
||||||
if vm_ip['addr'] == port_ip['ip_address']:
|
|
||||||
ips_number += 1
|
|
||||||
break
|
|
||||||
if ips_number == len(vm.addresses[network_name]):
|
|
||||||
counter += 1
|
|
||||||
break
|
|
||||||
return counter
|
|
||||||
|
|
||||||
def _port_to_network_edges(self, networks, ports):
|
|
||||||
counter = 0
|
|
||||||
for net in networks:
|
|
||||||
counter += len(g_utils.all_matches(ports, network_id=net['id']))
|
|
||||||
return counter
|
|
||||||
|
@ -22,6 +22,10 @@ LOG = logging.getLogger(__name__)
|
|||||||
class TestNova(BaseTopologyTest):
|
class TestNova(BaseTopologyTest):
|
||||||
NUM_INSTANCE = 3
|
NUM_INSTANCE = 3
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(TestNova, self).tearDown()
|
||||||
|
self._rollback_to_default()
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_nova_entities(self):
|
def test_nova_entities(self):
|
||||||
# Action
|
# Action
|
||||||
|
@ -44,32 +44,27 @@ class TestPrometheus(BaseTestEvents):
|
|||||||
FIRING))
|
FIRING))
|
||||||
|
|
||||||
def _test_send_prometheus_alert(self, details):
|
def _test_send_prometheus_alert(self, details):
|
||||||
try:
|
# post an event to the message bus
|
||||||
# post an event to the message bus
|
event_time = datetime.now()
|
||||||
event_time = datetime.now()
|
event_type = 'prometheus.alarm'
|
||||||
event_type = 'prometheus.alarm'
|
self._post_event(event_time, event_type, details)
|
||||||
self._post_event(event_time, event_type, details)
|
api_alarms = wait_for_answer(2, 0.5, self._check_alarms)
|
||||||
api_alarms = wait_for_answer(2, 0.5, self._check_alarms)
|
|
||||||
|
|
||||||
# expect to get a 'prometheus.alarm', generated by Prometheus
|
# expect to get a 'prometheus.alarm', generated by Prometheus
|
||||||
# datasource
|
# datasource
|
||||||
self.assertThat(api_alarms, matchers.HasLength(1),
|
self.assertThat(api_alarms, matchers.HasLength(1),
|
||||||
'Expected Prometheus alarm')
|
'Expected Prometheus alarm')
|
||||||
|
|
||||||
alarm = api_alarms[0]
|
alarm = api_alarms[0]
|
||||||
self._check_alarm(alarm, details)
|
self._check_alarm(alarm, details)
|
||||||
|
|
||||||
event_time = datetime.now()
|
event_time = datetime.now()
|
||||||
self._resolve_alerts(details)
|
self._resolve_alerts(details)
|
||||||
self._post_event(event_time, event_type, details)
|
self._post_event(event_time, event_type, details)
|
||||||
|
|
||||||
api_alarms = wait_for_answer(2, 0.5, self._check_alarms)
|
api_alarms = wait_for_answer(2, 0.5, self._check_alarms)
|
||||||
self.assertIsNotNone(api_alarms,)
|
self.assertIsNotNone(api_alarms)
|
||||||
self.assertThat(api_alarms, IsEmpty(), 'Expected no alarms')
|
self.assertThat(api_alarms, IsEmpty(), 'Expected no alarms')
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
LOG.exception(e)
|
|
||||||
raise
|
|
||||||
|
|
||||||
def _check_alarm(self, alarm, details):
|
def _check_alarm(self, alarm, details):
|
||||||
self.assertEqual(EntityCategory.ALARM, alarm[VProps.VITRAGE_CATEGORY])
|
self.assertEqual(EntityCategory.ALARM, alarm[VProps.VITRAGE_CATEGORY])
|
||||||
|
@ -29,35 +29,37 @@ class TestStatic(BaseVitrageTempest):
|
|||||||
NUM_SWITCH = 1
|
NUM_SWITCH = 1
|
||||||
NUM_NIC = 1
|
NUM_NIC = 1
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestStatic, self).setUp()
|
||||||
|
self._create_switches()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(TestStatic, self).tearDown()
|
||||||
|
self._delete_switches()
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_switches(self):
|
def test_switches(self):
|
||||||
try:
|
# Calculate expected results
|
||||||
# Action
|
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
||||||
self._create_switches()
|
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||||
|
entities = self._entities_validation_data(
|
||||||
|
host_entities=1,
|
||||||
|
host_edges=1,
|
||||||
|
switch_entities=self.NUM_SWITCH,
|
||||||
|
switch_edges=1,
|
||||||
|
nic_entities=self.NUM_NIC,
|
||||||
|
nic_edges=1)
|
||||||
|
num_entities = self.num_default_entities + self.NUM_SWITCH + \
|
||||||
|
self.NUM_NIC + self.num_default_networks + \
|
||||||
|
self.num_default_ports
|
||||||
|
num_edges = self.num_default_edges + self.NUM_SWITCH + \
|
||||||
|
self.num_default_ports
|
||||||
|
|
||||||
# Calculate expected results
|
# Test Assertions
|
||||||
api_graph = self.vitrage_client.topology.get(all_tenants=True)
|
self._validate_graph_correctness(graph,
|
||||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
num_entities,
|
||||||
entities = self._entities_validation_data(
|
num_edges,
|
||||||
host_entities=1,
|
entities)
|
||||||
host_edges=1,
|
|
||||||
switch_entities=self.NUM_SWITCH,
|
|
||||||
switch_edges=1,
|
|
||||||
nic_entities=self.NUM_NIC,
|
|
||||||
nic_edges=1)
|
|
||||||
num_entities = self.num_default_entities + self.NUM_SWITCH + \
|
|
||||||
self.NUM_NIC + self.num_default_networks + \
|
|
||||||
self.num_default_ports
|
|
||||||
num_edges = self.num_default_edges + self.NUM_SWITCH + \
|
|
||||||
self.num_default_ports
|
|
||||||
|
|
||||||
# Test Assertions
|
|
||||||
self._validate_graph_correctness(graph,
|
|
||||||
num_entities,
|
|
||||||
num_edges,
|
|
||||||
entities)
|
|
||||||
finally:
|
|
||||||
self._delete_switches()
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _create_switches():
|
def _create_switches():
|
||||||
|
@ -33,7 +33,7 @@ class TestActionsBase(BaseVitrageTempest):
|
|||||||
if not host:
|
if not host:
|
||||||
raise Exception("No host found")
|
raise Exception("No host found")
|
||||||
if not host.get(VProps.VITRAGE_AGGREGATED_STATE) == 'AVAILABLE':
|
if not host.get(VProps.VITRAGE_AGGREGATED_STATE) == 'AVAILABLE':
|
||||||
raise Exception("Host is not running %s", str(host))
|
raise Exception("Host is not running %s" % host)
|
||||||
cls.orig_host = host
|
cls.orig_host = host
|
||||||
|
|
||||||
def _trigger_do_action(self, trigger_name):
|
def _trigger_do_action(self, trigger_name):
|
||||||
@ -58,7 +58,7 @@ class TestActionsBase(BaseVitrageTempest):
|
|||||||
deduces = g_utils.all_matches(alarms, **deduced_props)
|
deduces = g_utils.all_matches(alarms, **deduced_props)
|
||||||
self.assertThat(deduces, matchers.HasLength(deduced_count),
|
self.assertThat(deduces, matchers.HasLength(deduced_count),
|
||||||
'Expected %s deduces\n - \n%s\n - \n%s' %
|
'Expected %s deduces\n - \n%s\n - \n%s' %
|
||||||
(str(deduced_count), str(alarms), str(deduces)))
|
(deduced_count, alarms, deduces))
|
||||||
|
|
||||||
def _check_rca(self, rca, expected_alarms, inspected):
|
def _check_rca(self, rca, expected_alarms, inspected):
|
||||||
rca_nodes = [n for n in rca['nodes'] if not n.get('end_timestamp')]
|
rca_nodes = [n for n in rca['nodes'] if not n.get('end_timestamp')]
|
||||||
@ -66,8 +66,8 @@ class TestActionsBase(BaseVitrageTempest):
|
|||||||
for expected_alarm in expected_alarms:
|
for expected_alarm in expected_alarms:
|
||||||
self.assertIsNotNone(
|
self.assertIsNotNone(
|
||||||
g_utils.first_match(rca_nodes, **expected_alarm),
|
g_utils.first_match(rca_nodes, **expected_alarm),
|
||||||
'expected_alarm is not in the rca %s' % str(expected_alarm))
|
'expected_alarm is not in the rca %s' % expected_alarm)
|
||||||
rca_inspected = rca['nodes'][rca['inspected_index']]
|
rca_inspected = rca['nodes'][rca['inspected_index']]
|
||||||
self.assertTrue(g_utils.is_subset(inspected, rca_inspected),
|
self.assertTrue(g_utils.is_subset(inspected, rca_inspected),
|
||||||
'Invalid inspected item \n%s\n%s' %
|
'Invalid inspected item \n%s\n%s' %
|
||||||
(str(rca_inspected), str(inspected)))
|
(rca_inspected, inspected))
|
||||||
|
@ -256,7 +256,7 @@ class TestBasicActions(TestActionsBase):
|
|||||||
alarms = self.vitrage_client.alarm.list(
|
alarms = self.vitrage_client.alarm.list(
|
||||||
vitrage_id=self.orig_host.get(VProps.VITRAGE_ID),
|
vitrage_id=self.orig_host.get(VProps.VITRAGE_ID),
|
||||||
all_tenants=True)
|
all_tenants=True)
|
||||||
self.assertTrue(len(alarms) >= 2, 'alarms %s' % str(alarms))
|
self.assertTrue(len(alarms) >= 2, 'alarms %s' % alarms)
|
||||||
|
|
||||||
deduced = g_utils.first_match(alarms, **deduced_props)
|
deduced = g_utils.first_match(alarms, **deduced_props)
|
||||||
trigger = g_utils.first_match(alarms, **trigger_alarm_props)
|
trigger = g_utils.first_match(alarms, **trigger_alarm_props)
|
||||||
|
@ -329,7 +329,7 @@ class MockHTTPServer(BaseHTTPServer.HTTPServer):
|
|||||||
|
|
||||||
def process_request(self, request, client_address):
|
def process_request(self, request, client_address):
|
||||||
self.requests.append(request)
|
self.requests.append(request)
|
||||||
LOG.info('received request: %s', str(request))
|
LOG.info('received request: %s', request)
|
||||||
BaseHTTPServer.HTTPServer.process_request(
|
BaseHTTPServer.HTTPServer.process_request(
|
||||||
self, client_address=client_address, request=request)
|
self, client_address=client_address, request=request)
|
||||||
|
|
||||||
|
@ -132,11 +132,11 @@ class TestOverlappingActions(TestActionsBase):
|
|||||||
self._trigger_undo_action(TRIGGER_ALARM_4)
|
self._trigger_undo_action(TRIGGER_ALARM_4)
|
||||||
nova_service = TempestClients.nova().services.list(
|
nova_service = TempestClients.nova().services.list(
|
||||||
host=host_name, binary='nova-compute')[0]
|
host=host_name, binary='nova-compute')[0]
|
||||||
self.assertEqual("up", str(nova_service.state))
|
self.assertEqual("up", nova_service.state)
|
||||||
finally:
|
finally:
|
||||||
self._trigger_undo_action(TRIGGER_ALARM_3)
|
self._trigger_undo_action(TRIGGER_ALARM_3)
|
||||||
self._trigger_undo_action(TRIGGER_ALARM_4)
|
self._trigger_undo_action(TRIGGER_ALARM_4)
|
||||||
# nova.host datasource may take up to snapshot_intreval to update
|
# nova.host datasource may take up to snapshot_interval to update
|
||||||
time.sleep(130)
|
time.sleep(130)
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
metadata:
|
metadata:
|
||||||
name: corrupted_template
|
name: corrupted_template
|
||||||
|
type: standard
|
||||||
|
version: 2
|
||||||
definitions:
|
definitions:
|
||||||
entities:
|
entities:
|
||||||
- entity:
|
- entity:
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
metadata:
|
metadata:
|
||||||
name: first_deduced_alarm_ever_nagios
|
name: first_deduced_alarm_ever_nagios
|
||||||
|
type: standard
|
||||||
|
version: 2
|
||||||
definitions:
|
definitions:
|
||||||
entities:
|
entities:
|
||||||
- entity:
|
- entity:
|
||||||
|
Loading…
Reference in New Issue
Block a user