Merge "remove handle exception"
This commit is contained in:
commit
186a0dad33
@ -56,9 +56,6 @@ class TestRca(BaseRcaTest):
|
||||
|
||||
self._validate_deduce_alarms(alarms=api_alarms,
|
||||
instances=instances)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._clean_all()
|
||||
|
||||
|
@ -57,19 +57,15 @@ class TestResource(BaseVitrageTempest):
|
||||
@utils.tempest_logger
|
||||
def test_compare_cli_vs_api_resource_list(self):
|
||||
"""resource list """
|
||||
try:
|
||||
api_resources = self.vitrage_client.resource.list(
|
||||
all_tenants=True)
|
||||
api_resources = self.vitrage_client.resource.list(
|
||||
all_tenants=True)
|
||||
|
||||
LOG.info("api_resources = %s", api_resources)
|
||||
LOG.info("api_resources = %s", api_resources)
|
||||
|
||||
cli_resources = utils.run_vitrage_command(
|
||||
'vitrage resource list --all -f json')
|
||||
cli_resources = utils.run_vitrage_command(
|
||||
'vitrage resource list --all -f json')
|
||||
|
||||
self._compare_resources(api_resources, cli_resources)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
self._compare_resources(api_resources, cli_resources)
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_default_resource_list(self):
|
||||
@ -79,12 +75,8 @@ class TestResource(BaseVitrageTempest):
|
||||
"""
|
||||
# TODO(e0ne): split this test to verify that only network,
|
||||
# instance and port are returned to non-admin user.
|
||||
try:
|
||||
resources = self.vitrage_client.resource.list(all_tenants=False)
|
||||
self.assertThat(resources, matchers.HasLength(6))
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
resources = self.vitrage_client.resource.list(all_tenants=False)
|
||||
self.assertThat(resources, matchers.HasLength(6))
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_resource_list_with_all_tenants(self):
|
||||
@ -102,9 +94,7 @@ class TestResource(BaseVitrageTempest):
|
||||
resources = self.vitrage_client.resource.list(all_tenants=True)
|
||||
|
||||
self.assertEqual(len(resources_before) + 2, len(resources))
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
|
||||
finally:
|
||||
if instances:
|
||||
nova_utils.delete_created_instances(instances)
|
||||
@ -115,90 +105,63 @@ class TestResource(BaseVitrageTempest):
|
||||
|
||||
get the resource: one instance
|
||||
"""
|
||||
try:
|
||||
resources = self.vitrage_client.resource.list(
|
||||
resource_type=NOVA_INSTANCE_DATASOURCE,
|
||||
all_tenants=True)
|
||||
self.assertThat(resources, matchers.HasLength(1))
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
resources = self.vitrage_client.resource.list(
|
||||
resource_type=NOVA_INSTANCE_DATASOURCE,
|
||||
all_tenants=True)
|
||||
self.assertThat(resources, matchers.HasLength(1))
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_resource_list_with_no_existing_type(self):
|
||||
"""resource list with no existing type"""
|
||||
try:
|
||||
resources = self.vitrage_client.resource.list(
|
||||
resource_type=CINDER_VOLUME_DATASOURCE,
|
||||
all_tenants=True)
|
||||
self.assertThat(resources, IsEmpty())
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
resources = self.vitrage_client.resource.list(
|
||||
resource_type=CINDER_VOLUME_DATASOURCE,
|
||||
all_tenants=True)
|
||||
self.assertThat(resources, IsEmpty())
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_resource_list_with_query_existing(self):
|
||||
try:
|
||||
resources = self.vitrage_client.resource.list(
|
||||
resource_type=NOVA_INSTANCE_DATASOURCE,
|
||||
all_tenants=True,
|
||||
query='{"==": {"name": "vm-0"}}'
|
||||
)
|
||||
self.assertThat(resources, matchers.HasLength(1))
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
resources = self.vitrage_client.resource.list(
|
||||
resource_type=NOVA_INSTANCE_DATASOURCE,
|
||||
all_tenants=True,
|
||||
query='{"==": {"name": "vm-0"}}'
|
||||
)
|
||||
self.assertThat(resources, matchers.HasLength(1))
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_resource_list_with_query_none_existing(self):
|
||||
try:
|
||||
resources = self.vitrage_client.resource.list(
|
||||
resource_type=NOVA_INSTANCE_DATASOURCE,
|
||||
all_tenants=True,
|
||||
query='{"==": {"name": "kuku-does-not-exist"}}'
|
||||
)
|
||||
self.assertThat(resources, matchers.HasLength(0))
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
resources = self.vitrage_client.resource.list(
|
||||
resource_type=NOVA_INSTANCE_DATASOURCE,
|
||||
all_tenants=True,
|
||||
query='{"==": {"name": "kuku-does-not-exist"}}'
|
||||
)
|
||||
self.assertThat(resources, matchers.HasLength(0))
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_resource_count(self):
|
||||
try:
|
||||
resources = self.vitrage_client.resource.count(
|
||||
resource_type=NOVA_INSTANCE_DATASOURCE,
|
||||
all_tenants=True,
|
||||
query='{"==": {"name": "vm-0"}}'
|
||||
)
|
||||
self.assertThat(resources, matchers.HasLength(1))
|
||||
self.assertEqual(1, resources[NOVA_INSTANCE_DATASOURCE])
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
resources = self.vitrage_client.resource.count(
|
||||
resource_type=NOVA_INSTANCE_DATASOURCE,
|
||||
all_tenants=True,
|
||||
query='{"==": {"name": "vm-0"}}'
|
||||
)
|
||||
self.assertThat(resources, matchers.HasLength(1))
|
||||
self.assertEqual(1, resources[NOVA_INSTANCE_DATASOURCE])
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_resource_count_empty(self):
|
||||
try:
|
||||
resources = self.vitrage_client.resource.count(
|
||||
resource_type=NOVA_INSTANCE_DATASOURCE,
|
||||
all_tenants=True,
|
||||
query='{"==": {"name": "kuku-does-not-exist"}}'
|
||||
)
|
||||
self.assertThat(resources, matchers.HasLength(0))
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
resources = self.vitrage_client.resource.count(
|
||||
resource_type=NOVA_INSTANCE_DATASOURCE,
|
||||
all_tenants=True,
|
||||
query='{"==": {"name": "kuku-does-not-exist"}}'
|
||||
)
|
||||
self.assertThat(resources, matchers.HasLength(0))
|
||||
|
||||
def test_resource_show_with_no_existing_resource(self):
|
||||
"""resource_show test no existing resource"""
|
||||
try:
|
||||
|
||||
self.assertRaises(ClientException,
|
||||
self.vitrage_client.resource.get(
|
||||
'test_for_no_existing'))
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
|
||||
self.vitrage_client.resource.get,
|
||||
'test_for_no_existing')
|
||||
finally:
|
||||
nova_utils.delete_all_instances()
|
||||
|
||||
|
@ -159,35 +159,27 @@ class TemplatesDBTest(BaseTemplateTest):
|
||||
db_row,
|
||||
'corrupted template template presented in list')
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default(templates_names)
|
||||
|
||||
def test_template_delete(self):
|
||||
try:
|
||||
|
||||
# add standard template
|
||||
v_utils.add_template(STANDARD_TEMPLATE,
|
||||
template_type=TTypes.STANDARD)
|
||||
db_row = v_utils.get_first_template(
|
||||
name='host_high_memory_usage_scenarios',
|
||||
type=TTypes.STANDARD,
|
||||
status=TemplateStatus.ACTIVE)
|
||||
self.assertIsNotNone(db_row,
|
||||
'Template should appear in templates list')
|
||||
# add standard template
|
||||
v_utils.add_template(STANDARD_TEMPLATE,
|
||||
template_type=TTypes.STANDARD)
|
||||
db_row = v_utils.get_first_template(
|
||||
name='host_high_memory_usage_scenarios',
|
||||
type=TTypes.STANDARD,
|
||||
status=TemplateStatus.ACTIVE)
|
||||
self.assertIsNotNone(db_row,
|
||||
'Template should appear in templates list')
|
||||
|
||||
# delete template
|
||||
uuid = db_row['uuid']
|
||||
v_utils.delete_template(uuid)
|
||||
db_row = v_utils.get_first_template(
|
||||
name='host_high_memory_usage_scenarios', type=TTypes.STANDARD)
|
||||
self.assertIsNone(db_row, 'Template should not appear in list')
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
# delete template
|
||||
uuid = db_row['uuid']
|
||||
v_utils.delete_template(uuid)
|
||||
db_row = v_utils.get_first_template(
|
||||
name='host_high_memory_usage_scenarios', type=TTypes.STANDARD)
|
||||
self.assertIsNone(db_row, 'Template should not appear in list')
|
||||
|
||||
def test_compare_cli_to_api(self):
|
||||
"""Compare between api template list
|
||||
@ -213,34 +205,27 @@ class TemplatesDBTest(BaseTemplateTest):
|
||||
cli_templates_list)
|
||||
self._compare_each_template_in_list(api_templates_list,
|
||||
cli_templates_list)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default(templates_names)
|
||||
|
||||
def test_template_show(self):
|
||||
"""Compare template content from file to DB"""
|
||||
try:
|
||||
# add standard template
|
||||
template_path = \
|
||||
g_utils.tempest_resources_dir() + '/templates/api/'\
|
||||
+ STANDARD_TEMPLATE
|
||||
v_utils.add_template(STANDARD_TEMPLATE,
|
||||
template_type=TTypes.STANDARD)
|
||||
db_row = v_utils.get_first_template(
|
||||
name='host_high_memory_usage_scenarios',
|
||||
type=TTypes.STANDARD,
|
||||
status=TemplateStatus.ACTIVE)
|
||||
payload_from_db = self.client.template.show(db_row['uuid'])
|
||||
with open(template_path, 'r') as stream:
|
||||
payload_from_file = yaml.load(stream, Loader=yaml.BaseLoader)
|
||||
self.assert_dict_equal(payload_from_file, payload_from_db,
|
||||
"Template content doesn't match")
|
||||
v_utils.delete_template(db_row['uuid'])
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
# add standard template
|
||||
template_path = \
|
||||
g_utils.tempest_resources_dir() + '/templates/api/'\
|
||||
+ STANDARD_TEMPLATE
|
||||
v_utils.add_template(STANDARD_TEMPLATE,
|
||||
template_type=TTypes.STANDARD)
|
||||
db_row = v_utils.get_first_template(
|
||||
name='host_high_memory_usage_scenarios',
|
||||
type=TTypes.STANDARD,
|
||||
status=TemplateStatus.ACTIVE)
|
||||
payload_from_db = self.client.template.show(db_row['uuid'])
|
||||
with open(template_path, 'r') as stream:
|
||||
payload_from_file = yaml.load(stream, Loader=yaml.BaseLoader)
|
||||
self.assert_dict_equal(payload_from_file, payload_from_db,
|
||||
"Template content doesn't match")
|
||||
v_utils.delete_template(db_row['uuid'])
|
||||
|
||||
def _add_templates(self):
|
||||
v_utils.add_template(STANDARD_TEMPLATE,
|
||||
|
@ -112,9 +112,7 @@ class TestTopology(BaseTopologyTest):
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph, num_entities, 0, entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
||||
@ -148,9 +146,6 @@ class TestTopology(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
||||
@ -180,9 +175,6 @@ class TestTopology(BaseTopologyTest):
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph, 0, 0, entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
||||
@ -214,9 +206,6 @@ class TestTopology(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
||||
@ -243,9 +232,6 @@ class TestTopology(BaseTopologyTest):
|
||||
self.num_default_entities,
|
||||
self.num_default_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
||||
@ -272,9 +258,6 @@ class TestTopology(BaseTopologyTest):
|
||||
self.num_default_entities,
|
||||
self.num_default_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
||||
@ -306,9 +289,6 @@ class TestTopology(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
||||
@ -357,9 +337,6 @@ class TestTopology(BaseTopologyTest):
|
||||
self.assertThat(api_graph['nodes'],
|
||||
IsEmpty(), 'num of vertex node')
|
||||
self.assertThat(api_graph['links'], IsEmpty(), 'num of edges')
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
||||
@ -382,9 +359,6 @@ class TestTopology(BaseTopologyTest):
|
||||
|
||||
# Test Assertions
|
||||
self.assert_is_empty(api_graph)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
||||
@ -421,8 +395,5 @@ class TestTopology(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
@ -13,10 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
from datetime import datetime
|
||||
import json
|
||||
import six
|
||||
|
||||
from networkx.readwrite import json_graph
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
from tempest.common import credentials_factory as common_creds
|
||||
@ -337,22 +335,6 @@ class BaseVitrageTempest(test.BaseTestCase):
|
||||
def _get_value(item, key):
|
||||
return utils.uni2str(item[key])
|
||||
|
||||
def _print_entity_graph(self):
|
||||
api_graph = TempestClients.vitrage().topology.get(all_tenants=True)
|
||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||
|
||||
node_link_data = json_graph.node_link_data(graph._g)
|
||||
for index, node in enumerate(node_link_data['nodes']):
|
||||
if VProps.ID in graph._g.node[node[VProps.ID]]:
|
||||
node[VProps.ID] = graph._g.node[node[VProps.ID]][VProps.ID]
|
||||
node[VProps.GRAPH_INDEX] = index
|
||||
|
||||
LOG.info('Entity Graph: \n%s', json.dumps(node_link_data))
|
||||
|
||||
def _handle_exception(self, exception):
|
||||
LOG.exception(exception)
|
||||
self._print_entity_graph()
|
||||
|
||||
@classmethod
|
||||
def _calc_num_admin_tenant_networks(cls):
|
||||
neutron_client = TempestClients.neutron()
|
||||
|
@ -54,9 +54,6 @@ class TestAodhAlarm(BaseAlarmsTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
aodh_utils.delete_all_aodh_alarms()
|
||||
nova_utils.delete_all_instances()
|
||||
@ -87,10 +84,6 @@ class TestAodhAlarm(BaseAlarmsTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
aodh_utils.delete_all_aodh_alarms()
|
||||
aodh_utils.delete_all_gnocchi_metrics()
|
||||
@ -123,10 +116,6 @@ class TestAodhAlarm(BaseAlarmsTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
aodh_utils.delete_all_aodh_alarms()
|
||||
aodh_utils.delete_all_gnocchi_metrics()
|
||||
@ -155,9 +144,6 @@ class TestAodhAlarm(BaseAlarmsTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
aodh_utils.delete_all_aodh_alarms()
|
||||
|
||||
|
@ -51,8 +51,5 @@ class TestCinderVolume(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
@ -73,8 +73,5 @@ class TestHeatStack(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
heat_utils.delete_all_stacks()
|
||||
|
@ -62,9 +62,6 @@ class TestNeutron(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
nova_utils.delete_all_instances()
|
||||
|
||||
|
@ -47,8 +47,5 @@ class TestNova(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
@ -56,9 +56,6 @@ class TestStatic(BaseVitrageTempest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._delete_switches()
|
||||
|
||||
|
@ -116,9 +116,6 @@ class TestBasicActions(TestActionsBase):
|
||||
self.orig_host.get(VProps.VITRAGE_AGGREGATED_STATE),
|
||||
curr_host.get(VProps.VITRAGE_AGGREGATED_STATE),
|
||||
'state should change after undo set_state action')
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._trigger_undo_action(trigger_name)
|
||||
|
||||
@ -152,9 +149,6 @@ class TestBasicActions(TestActionsBase):
|
||||
orig_instance.get(VProps.VITRAGE_AGGREGATED_STATE),
|
||||
curr_instance.get(VProps.VITRAGE_AGGREGATED_STATE),
|
||||
'state should change after undo set_state action')
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._trigger_undo_action(trigger_name)
|
||||
nova_utils.delete_all_instances(id=vm_id)
|
||||
@ -182,9 +176,6 @@ class TestBasicActions(TestActionsBase):
|
||||
nova_service = TempestClients.nova().services.list(
|
||||
host=host_name, binary='nova-compute')[0]
|
||||
self.assertEqual("up", nova_service.state)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._trigger_undo_action(trigger_name)
|
||||
# nova.host datasource may take up to snapshot_intreval to update
|
||||
@ -211,11 +202,7 @@ class TestBasicActions(TestActionsBase):
|
||||
self._trigger_undo_action(trigger_name)
|
||||
nova_instance = TempestClients.nova().servers.get(vm_id)
|
||||
self.assertEqual("ACTIVE", nova_instance.status)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
pass
|
||||
self._trigger_undo_action(trigger_name)
|
||||
nova_utils.delete_all_instances(id=vm_id)
|
||||
|
||||
@ -238,9 +225,6 @@ class TestBasicActions(TestActionsBase):
|
||||
# Undo
|
||||
self._trigger_undo_action(trigger_name)
|
||||
self._check_deduced(0, deduced_props, host_id)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._trigger_undo_action(trigger_name)
|
||||
|
||||
@ -286,8 +270,5 @@ class TestBasicActions(TestActionsBase):
|
||||
rca = TempestClients.vitrage().rca.get(
|
||||
trigger[VProps.VITRAGE_ID], all_tenants=True)
|
||||
self._check_rca(rca, [deduced, trigger], trigger_alarm_props)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._trigger_undo_action(trigger_name)
|
||||
|
@ -76,17 +76,12 @@ class TestTemplateActions(TestActionsBase):
|
||||
This checks that the evaluators are reloaded and run on all existing
|
||||
vertices.
|
||||
"""
|
||||
try:
|
||||
host_id = self.orig_host.get(VProps.VITRAGE_ID)
|
||||
self._trigger_do_action(TRIGGER_ALARM_1)
|
||||
self.added_template = v_util.add_template(TEST_TEMPLATE,
|
||||
folder=FOLDER_PATH)
|
||||
time.sleep(2)
|
||||
self._check_deduced(1, DEDUCED_PROPS, host_id)
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
host_id = self.orig_host.get(VProps.VITRAGE_ID)
|
||||
self._trigger_do_action(TRIGGER_ALARM_1)
|
||||
self.added_template = v_util.add_template(TEST_TEMPLATE,
|
||||
folder=FOLDER_PATH)
|
||||
time.sleep(2)
|
||||
self._check_deduced(1, DEDUCED_PROPS, host_id)
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_evaluator_reload_with_existing_template(self):
|
||||
@ -97,16 +92,11 @@ class TestTemplateActions(TestActionsBase):
|
||||
3. check action is executed
|
||||
This checks that new workers execute new template
|
||||
"""
|
||||
try:
|
||||
host_id = self.orig_host.get(VProps.VITRAGE_ID)
|
||||
self.added_template = v_util.add_template(TEST_TEMPLATE,
|
||||
folder=FOLDER_PATH)
|
||||
self._trigger_do_action(TRIGGER_ALARM_1)
|
||||
self._check_deduced(1, DEDUCED_PROPS, host_id)
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
host_id = self.orig_host.get(VProps.VITRAGE_ID)
|
||||
self.added_template = v_util.add_template(TEST_TEMPLATE,
|
||||
folder=FOLDER_PATH)
|
||||
self._trigger_do_action(TRIGGER_ALARM_1)
|
||||
self._check_deduced(1, DEDUCED_PROPS, host_id)
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_evaluator_reload_with_new_template_v2(self):
|
||||
@ -120,22 +110,17 @@ class TestTemplateActions(TestActionsBase):
|
||||
vertices.
|
||||
Checks temporary worker that was added to delete template.
|
||||
"""
|
||||
try:
|
||||
host_id = self.orig_host.get(VProps.VITRAGE_ID)
|
||||
host_id = self.orig_host.get(VProps.VITRAGE_ID)
|
||||
|
||||
self._trigger_do_action(TRIGGER_ALARM_1)
|
||||
self.added_template = v_util.add_template(TEST_TEMPLATE,
|
||||
folder=FOLDER_PATH)
|
||||
time.sleep(2)
|
||||
self._check_deduced(1, DEDUCED_PROPS, host_id)
|
||||
v_util.delete_template(self.added_template['uuid'])
|
||||
self.added_template = None
|
||||
time.sleep(2)
|
||||
self._check_deduced(0, DEDUCED_PROPS, host_id)
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
self._trigger_do_action(TRIGGER_ALARM_1)
|
||||
self.added_template = v_util.add_template(TEST_TEMPLATE,
|
||||
folder=FOLDER_PATH)
|
||||
time.sleep(2)
|
||||
self._check_deduced(1, DEDUCED_PROPS, host_id)
|
||||
v_util.delete_template(self.added_template['uuid'])
|
||||
self.added_template = None
|
||||
time.sleep(2)
|
||||
self._check_deduced(0, DEDUCED_PROPS, host_id)
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_evaluator_reload_with_existing_template_v2(self):
|
||||
@ -148,18 +133,13 @@ class TestTemplateActions(TestActionsBase):
|
||||
This checks that template deleted properly and no action executed.
|
||||
:return:
|
||||
"""
|
||||
try:
|
||||
host_id = self.orig_host.get(VProps.VITRAGE_ID)
|
||||
self.added_template = v_util.add_template(TEST_TEMPLATE,
|
||||
folder=FOLDER_PATH)
|
||||
v_util.delete_template(self.added_template['uuid'])
|
||||
self.added_template = None
|
||||
self._trigger_do_action(TRIGGER_ALARM_1)
|
||||
self._check_deduced(0, DEDUCED_PROPS, host_id)
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
host_id = self.orig_host.get(VProps.VITRAGE_ID)
|
||||
self.added_template = v_util.add_template(TEST_TEMPLATE,
|
||||
folder=FOLDER_PATH)
|
||||
v_util.delete_template(self.added_template['uuid'])
|
||||
self.added_template = None
|
||||
self._trigger_do_action(TRIGGER_ALARM_1)
|
||||
self._check_deduced(0, DEDUCED_PROPS, host_id)
|
||||
|
||||
@utils.tempest_logger
|
||||
def test_evaluator_reload_with_multiple_new_template(self):
|
||||
@ -181,10 +161,6 @@ class TestTemplateActions(TestActionsBase):
|
||||
second_template = v_util.get_first_template(name=INFILE_NAME_2)
|
||||
self._check_deduced(1, DEDUCED_PROPS, host_id)
|
||||
self._check_deduced(1, DEDUCED_PROPS_2, host_id)
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
if second_template:
|
||||
v_util.delete_template(second_template['uuid'])
|
||||
|
@ -101,10 +101,6 @@ class TestOverlappingActions(TestActionsBase):
|
||||
self.orig_host.get(VProps.VITRAGE_AGGREGATED_STATE),
|
||||
curr_host.get(VProps.VITRAGE_AGGREGATED_STATE),
|
||||
'state should change after undo set_state action')
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._trigger_undo_action(TRIGGER_ALARM_1)
|
||||
self._trigger_undo_action(TRIGGER_ALARM_2)
|
||||
@ -137,9 +133,6 @@ class TestOverlappingActions(TestActionsBase):
|
||||
nova_service = TempestClients.nova().services.list(
|
||||
host=host_name, binary='nova-compute')[0]
|
||||
self.assertEqual("up", str(nova_service.state))
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._trigger_undo_action(TRIGGER_ALARM_3)
|
||||
self._trigger_undo_action(TRIGGER_ALARM_4)
|
||||
@ -166,9 +159,6 @@ class TestOverlappingActions(TestActionsBase):
|
||||
# Undo - second
|
||||
self._trigger_undo_action(TRIGGER_ALARM_2)
|
||||
self._check_deduced(0, DEDUCED_PROPS, host_id)
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._trigger_undo_action(TRIGGER_ALARM_1)
|
||||
self._trigger_undo_action(TRIGGER_ALARM_2)
|
||||
@ -238,10 +228,6 @@ class TestOverlappingActions(TestActionsBase):
|
||||
g_utils.all_matches(alarms, **DEDUCED_PROPS),
|
||||
IsEmpty(),
|
||||
'deduced alarm should have been removed')
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._trigger_undo_action(TRIGGER_ALARM_1)
|
||||
self._trigger_undo_action(TRIGGER_ALARM_2)
|
||||
|
@ -155,13 +155,9 @@ class TestMistralNotifier(BaseTestEvents):
|
||||
num_executions=num_executions + 1),
|
||||
'Mistral workflow was not executed')
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default(WF_NAME, num_workflows,
|
||||
trigger_alarm, num_alarms)
|
||||
pass
|
||||
|
||||
def _rollback_to_default(self, workflow_name, num_workflows,
|
||||
trigger_alarm, num_alarms):
|
||||
|
@ -86,10 +86,6 @@ class TestLongProcessing(TestActionsBase):
|
||||
self.num_of_sent_events,
|
||||
alarm_count['CRITICAL'],
|
||||
'CRITICAL doctor events expected')
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
finally:
|
||||
self._remove_doctor_events()
|
||||
if v_utils.get_first_template(name=TEMPLATE_NAME):
|
||||
@ -120,12 +116,10 @@ class TestLongProcessing(TestActionsBase):
|
||||
time.sleep(SLEEP)
|
||||
self._check_template_instance_3rd_degree_scenarios_deleted()
|
||||
|
||||
except Exception as e:
|
||||
self._handle_exception(e)
|
||||
finally:
|
||||
if v_utils.get_first_template(name=TEMPLATE_NAME):
|
||||
v_utils.delete_template(name=TEMPLATE_NAME)
|
||||
time.sleep(SLEEP)
|
||||
raise
|
||||
|
||||
def _check_template_instance_3rd_degree_scenarios(self):
|
||||
|
||||
@ -151,8 +145,8 @@ class TestLongProcessing(TestActionsBase):
|
||||
try:
|
||||
self._check_rca(rca, expected_rca, alarm)
|
||||
return True
|
||||
except Exception as e:
|
||||
LOG.exception('check_rca failed', e)
|
||||
except Exception:
|
||||
LOG.exception('check_rca failed')
|
||||
return False
|
||||
|
||||
# 10 threads calling rca api
|
||||
@ -165,10 +159,8 @@ class TestLongProcessing(TestActionsBase):
|
||||
deduced_alarms)]
|
||||
self.assertTrue(all(workers_result))
|
||||
|
||||
except Exception as e:
|
||||
finally:
|
||||
v_utils.delete_template(name=TEMPLATE_NAME)
|
||||
self._handle_exception(e)
|
||||
raise
|
||||
|
||||
def _check_template_instance_3rd_degree_scenarios_deleted(self):
|
||||
alarm_count = TempestClients.vitrage().alarm.count(
|
||||
@ -200,8 +192,8 @@ class TestLongProcessing(TestActionsBase):
|
||||
|
||||
self._remove_keys_from_dicts(g1_nodes, g2_nodes, to_remove)
|
||||
|
||||
self.assertItemsEqual(g1_nodes, g2_nodes,
|
||||
msg + "Nodes of each graph are not equal")
|
||||
self.assert_items_equal(g1_nodes, g2_nodes,
|
||||
msg + "Nodes of each graph are not equal")
|
||||
self.assert_items_equal(g1_links, g2_links,
|
||||
"Edges of each graph are not equal")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user