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