fix tempests in gate
Change-Id: Ic14e9523c841b94c4cc7aeab2ec89d8f86ba102c
This commit is contained in:
parent
c771ad1a1b
commit
3fc88cbddf
@ -100,7 +100,8 @@ class ConsistencyEnforcer(object):
|
||||
'and': [
|
||||
{'!=': {VProps.TYPE: VITRAGE_TYPE}},
|
||||
{'<': {VProps.SAMPLE_TIMESTAMP: str(utcnow() - timedelta(
|
||||
seconds=2 * self.conf.datasources.snapshots_interval))}}
|
||||
seconds=2 * self.conf.datasources.snapshots_interval))}},
|
||||
{'==': {VProps.IS_DELETED: False}}
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ def nova_client(conf):
|
||||
version=conf.nova_version,
|
||||
session=keystone_client.get_session(conf),
|
||||
region_name=auth_config.region_name,
|
||||
interface=auth_config.interface,
|
||||
endpoint_type='publicURL',
|
||||
)
|
||||
LOG.info('Nova client created')
|
||||
return client
|
||||
|
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
import traceback
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
@ -46,8 +47,8 @@ class TestAlarms(BaseAlarmsTest):
|
||||
self._compare_alarms_lists(
|
||||
api_alarms, cli_alarms, AODH_DATASOURCE,
|
||||
utils.uni2str(instances[0].id))
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._delete_ceilometer_alarms()
|
||||
@ -61,9 +62,10 @@ class TestAlarms(BaseAlarmsTest):
|
||||
self.assertIsNotNone(cli_alarms,
|
||||
'The alarms list taken from cli is empty')
|
||||
|
||||
LOG.debug("The alarms list taken from cli is : %s", cli_alarms)
|
||||
LOG.debug("The alarms list taken by api is : %s",
|
||||
json.dumps(api_alarms))
|
||||
print("The alarms list taken from cli is : " +
|
||||
str(cli_alarms))
|
||||
print("The alarms list taken by api is : " +
|
||||
str(json.dumps(api_alarms)))
|
||||
|
||||
cli_items = cli_alarms.splitlines()
|
||||
|
||||
|
@ -55,10 +55,12 @@ class BaseApiTest(base.BaseTestCase):
|
||||
|
||||
cls.vitrage_client = \
|
||||
v_client.Client('1', session=keystone_client.get_session(cls.conf))
|
||||
cls.nova_client = os_clients.nova_client(cls.conf)
|
||||
cls.cinder_client = os_clients.cinder_client(cls.conf)
|
||||
cls.neutron_client = os_clients.neutron_client(cls.conf)
|
||||
cls.heat_client = os_clients.heat_client(cls.conf)
|
||||
cls.nova_client = cls._create_client(os_clients.nova_client, cls.conf)
|
||||
cls.cinder_client = cls._create_client(os_clients.cinder_client,
|
||||
cls.conf)
|
||||
cls.neutron_client = cls._create_client(os_clients.neutron_client,
|
||||
cls.conf)
|
||||
cls.heat_client = cls._create_client(os_clients.heat_client, cls.conf)
|
||||
|
||||
cls.num_default_networks = \
|
||||
len(cls.neutron_client.list_networks()['networks'])
|
||||
@ -67,6 +69,22 @@ class BaseApiTest(base.BaseTestCase):
|
||||
cls.num_default_entities = 3
|
||||
cls.num_default_edges = 2
|
||||
|
||||
@staticmethod
|
||||
def _create_client(client_func, conf):
|
||||
count = 0
|
||||
|
||||
while count < 40:
|
||||
LOG.info("wait_for_client - " + client_func.func_name)
|
||||
client = client_func(conf)
|
||||
if client:
|
||||
return client
|
||||
count += 1
|
||||
time.sleep(5)
|
||||
|
||||
LOG.info("wait_for_client - False")
|
||||
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _filter_list_by_pairs_parameters(origin_list,
|
||||
keys, values):
|
||||
@ -222,7 +240,7 @@ class BaseApiTest(base.BaseTestCase):
|
||||
return True
|
||||
count += 1
|
||||
time.sleep(2)
|
||||
LOG.info("wait_for_status - False")
|
||||
print("wait_for_status - False")
|
||||
return False
|
||||
|
||||
def _entities_validation_data(self, **kwargs):
|
||||
|
@ -11,6 +11,7 @@
|
||||
# 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 traceback
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
@ -54,8 +55,8 @@ class TestAodhAlarm(BaseAlarmsTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._delete_ceilometer_alarms()
|
||||
@ -83,8 +84,8 @@ class TestAodhAlarm(BaseAlarmsTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._delete_ceilometer_alarms()
|
||||
|
@ -11,6 +11,7 @@
|
||||
# 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 traceback
|
||||
|
||||
from oslo_log import log as logging
|
||||
from vitrage_tempest_tests.tests.api.topology.base import BaseTopologyTest
|
||||
@ -53,8 +54,8 @@ class TestCinderVolume(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
import time
|
||||
import traceback
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
@ -62,8 +63,8 @@ class TestHeatStack(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._delete_stacks()
|
||||
|
@ -11,6 +11,7 @@
|
||||
# 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 traceback
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
@ -61,8 +62,8 @@ class TestNeutron(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._delete_instances()
|
||||
|
@ -11,6 +11,7 @@
|
||||
# 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 traceback
|
||||
|
||||
from oslo_log import log as logging
|
||||
from vitrage_tempest_tests.tests.api.topology.base import BaseTopologyTest
|
||||
@ -49,8 +50,8 @@ class TestNova(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
@ -15,6 +15,7 @@
|
||||
import os
|
||||
import socket
|
||||
import time
|
||||
import traceback
|
||||
|
||||
from oslo_log import log as logging
|
||||
from vitrage_tempest_tests.tests.api.base import BaseApiTest
|
||||
@ -53,8 +54,8 @@ class TestStaticPhysical(BaseApiTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._delete_switches()
|
||||
|
@ -60,9 +60,8 @@ class BaseRcaTest(BaseAlarmsTest):
|
||||
self.assertNotEqual(len(api_rca), 0, 'The rca taken from api is empty')
|
||||
self.assertIsNotNone(cli_rca, 'The rca taken from cli is empty')
|
||||
|
||||
LOG.debug("The rca taken from cli is : %s", cli_rca)
|
||||
LOG.debug("The rca taken by api is : %s",
|
||||
json.dumps(api_rca))
|
||||
print("The rca taken from cli is : " + str(cli_rca))
|
||||
print("The rca taken by api is : " + str(json.dumps(api_rca)))
|
||||
|
||||
parsed_rca = json.loads(cli_rca)
|
||||
sorted_cli_graph = self._clean_timestamps(sorted(parsed_rca.items()))
|
||||
@ -71,8 +70,7 @@ class BaseRcaTest(BaseAlarmsTest):
|
||||
|
||||
def _validate_rca(self, rca):
|
||||
self.assertNotEqual(len(rca), 0, 'The rca is empty')
|
||||
LOG.debug("The rca alarms list is : %s",
|
||||
json.dumps(rca))
|
||||
print("The rca alarms list is : " + str(json.dumps(rca)))
|
||||
|
||||
resource_alarm = self._filter_list_by_pairs_parameters(
|
||||
rca, [VProps.TYPE, VProps.NAME],
|
||||
@ -90,8 +88,7 @@ class BaseRcaTest(BaseAlarmsTest):
|
||||
def _validate_deduce_alarms(self, alarms, instances):
|
||||
"""Validate alarm existence """
|
||||
self.assertNotEqual(len(alarms), 0, 'The alarms list is empty')
|
||||
LOG.debug("The alarms list is : %s",
|
||||
json.dumps(alarms))
|
||||
print("The alarms list is : " + str(json.dumps(alarms)))
|
||||
|
||||
deduce_alarms_1 = self._filter_list_by_pairs_parameters(
|
||||
alarms,
|
||||
|
@ -11,6 +11,7 @@
|
||||
# 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 traceback
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
@ -50,8 +51,8 @@ class TestRca(BaseRcaTest):
|
||||
'vitrage rca show ' + vitrage_id, self.conf)
|
||||
|
||||
self._compare_rca(api_rca, cli_rca)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._clean_all()
|
||||
@ -78,8 +79,8 @@ class TestRca(BaseRcaTest):
|
||||
self._validate_rca(rca=api_rca['nodes'])
|
||||
self._validate_relationship(links=api_rca['links'],
|
||||
alarms=api_rca['nodes'])
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._clean_all()
|
||||
@ -100,8 +101,8 @@ class TestRca(BaseRcaTest):
|
||||
|
||||
self._validate_deduce_alarms(alarms=api_alarms,
|
||||
instances=instances)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._clean_all()
|
||||
@ -123,8 +124,8 @@ class TestRca(BaseRcaTest):
|
||||
|
||||
self._validate_set_state(topology=topology['nodes'],
|
||||
instances=instances)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._clean_all()
|
||||
@ -147,8 +148,8 @@ class TestRca(BaseRcaTest):
|
||||
|
||||
self._validate_notifier(alarms=ceilometer_alarms,
|
||||
vitrage_alarms=vitrage_alarms)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._clean_all()
|
||||
|
@ -48,9 +48,10 @@ class BaseTemplateTest(BaseApiTest):
|
||||
self.assertIsNotNone(cli_templates,
|
||||
'The template list taken from cli is empty')
|
||||
|
||||
LOG.debug("The template list taken from cli is : %s", cli_templates)
|
||||
LOG.debug("The template list taken by api is : %s",
|
||||
json.dumps(api_templates))
|
||||
print("The template list taken from cli is : " +
|
||||
str(cli_templates))
|
||||
print("The template list taken by api is : " +
|
||||
str(json.dumps(api_templates)))
|
||||
|
||||
self._validate_templates_list_length(api_templates, cli_templates)
|
||||
self._validate_passed_templates_length(api_templates, cli_templates)
|
||||
@ -63,10 +64,10 @@ class BaseTemplateTest(BaseApiTest):
|
||||
self.assertIsNotNone(
|
||||
cli_templates, 'The template validations taken from cli is empty')
|
||||
|
||||
LOG.debug("The template validations taken from cli is : %s",
|
||||
cli_templates)
|
||||
LOG.debug("The template validations taken by api is : %s",
|
||||
json.dumps(api_templates))
|
||||
print("The template validations taken from cli is : " +
|
||||
str(cli_templates))
|
||||
print("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())
|
||||
@ -133,10 +134,10 @@ class BaseTemplateTest(BaseApiTest):
|
||||
self.assertIsNotNone(
|
||||
cli_templates, 'The template validations taken from cli is empty')
|
||||
|
||||
LOG.debug("The template validations taken from cli is : %s",
|
||||
cli_templates)
|
||||
LOG.debug("The template validations taken by api is : %s",
|
||||
json.dumps(api_templates))
|
||||
print("The template validations taken from cli is : " +
|
||||
str(cli_templates))
|
||||
print("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())
|
||||
|
@ -94,7 +94,7 @@ class TestValidate(BaseTemplateTest):
|
||||
self._run_template_validation(
|
||||
validation['results'][0], path, negative=True)
|
||||
except Exception:
|
||||
LOG.error('Failed to get validation of corrupted template file')
|
||||
print('Failed to get validation of corrupted template file')
|
||||
|
||||
def test_templates_validate_correct_template(self):
|
||||
"""templates_validate test
|
||||
@ -108,7 +108,7 @@ class TestValidate(BaseTemplateTest):
|
||||
self._run_template_validation(
|
||||
validation['results'][0], path)
|
||||
except Exception:
|
||||
LOG.error('Failed to get validation of template file')
|
||||
print('Failed to get validation of template file')
|
||||
|
||||
def test_compare_template_show(self):
|
||||
"""templates_show test
|
||||
|
@ -11,6 +11,7 @@
|
||||
# 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 traceback
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
@ -83,8 +84,8 @@ class TestTopology(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
@ -118,8 +119,8 @@ class TestTopology(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
@ -151,8 +152,8 @@ class TestTopology(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
@ -179,8 +180,8 @@ class TestTopology(BaseTopologyTest):
|
||||
self.num_default_entities,
|
||||
self.num_default_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
@ -207,8 +208,8 @@ class TestTopology(BaseTopologyTest):
|
||||
self.num_default_entities,
|
||||
self.num_default_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
@ -240,8 +241,8 @@ class TestTopology(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
@ -271,8 +272,8 @@ class TestTopology(BaseTopologyTest):
|
||||
self.num_default_entities,
|
||||
self.num_default_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
@ -307,8 +308,8 @@ class TestTopology(BaseTopologyTest):
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
@ -360,8 +361,8 @@ class TestTopology(BaseTopologyTest):
|
||||
self.assertEqual(
|
||||
0,
|
||||
len(api_graph['links']), 'num of edges')
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
@ -384,8 +385,8 @@ class TestTopology(BaseTopologyTest):
|
||||
|
||||
# Test Assertions
|
||||
self.assertEqual({}, api_graph)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
self._rollback_to_default()
|
||||
|
Loading…
Reference in New Issue
Block a user