fix multinode tempest test failure
fix all five tempest tests: watcher_tempest_plugin.tests.api.admin.test_service. TestShowListService.test_show_service watcher_tempest_plugin.tests.api.admin.test_service. TestShowListService.test_show_service_with_links tearDownClass (watcher_tempest_plugin.tests.api.admin. test_action_plan.TestCreateDeleteExecuteActionPlan) watcher_tempest_plugin.tests.scenario.test_execute_basic_optim .TestExecuteBasicStrategy.test_execute_basic_action_plan watcher_tempest_plugin.tests.scenario.test_execute_workload_balancing .TestExecuteWorkloadBalancingStrategy .test_execute_workload_stabilization Change-Id: I4d8945cf2dedea3fa32029d6c07d24a411c1f2e4 Closes-Bug: #1695225
This commit is contained in:
parent
b4b3856f14
commit
65c63a9351
@ -111,7 +111,7 @@ def extend_with_default(validator_class):
|
|||||||
|
|
||||||
def set_defaults(validator, properties, instance, schema):
|
def set_defaults(validator, properties, instance, schema):
|
||||||
for prop, subschema in properties.items():
|
for prop, subschema in properties.items():
|
||||||
if "default" in subschema:
|
if "default" in subschema and instance is not None:
|
||||||
instance.setdefault(prop, subschema["default"])
|
instance.setdefault(prop, subschema["default"])
|
||||||
|
|
||||||
for error in validate_properties(
|
for error in validate_properties(
|
||||||
@ -128,6 +128,9 @@ def extend_with_strict_schema(validator_class):
|
|||||||
validate_properties = validator_class.VALIDATORS["properties"]
|
validate_properties = validator_class.VALIDATORS["properties"]
|
||||||
|
|
||||||
def strict_schema(validator, properties, instance, schema):
|
def strict_schema(validator, properties, instance, schema):
|
||||||
|
if instance is None:
|
||||||
|
return
|
||||||
|
|
||||||
for para in instance.keys():
|
for para in instance.keys():
|
||||||
if para not in properties.keys():
|
if para not in properties.keys():
|
||||||
raise exception.AuditParameterNotAllowed(parameter=para)
|
raise exception.AuditParameterNotAllowed(parameter=para)
|
||||||
|
@ -308,9 +308,13 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if avg_meter is None:
|
if avg_meter is None:
|
||||||
raise exception.NoSuchMetricForHost(
|
if meter_name == 'hardware.memory.used':
|
||||||
metric=meter_name,
|
avg_meter = node.memory
|
||||||
host=node_id)
|
if meter_name == 'compute.node.cpu.percent':
|
||||||
|
avg_meter = 1
|
||||||
|
LOG.warning('No values returned by node %s for %s',
|
||||||
|
node_id, meter_name)
|
||||||
|
else:
|
||||||
if meter_name == 'hardware.memory.used':
|
if meter_name == 'hardware.memory.used':
|
||||||
avg_meter /= oslo_utils.units.Ki
|
avg_meter /= oslo_utils.units.Ki
|
||||||
if meter_name == 'compute.node.cpu.percent':
|
if meter_name == 'compute.node.cpu.percent':
|
||||||
|
@ -81,12 +81,16 @@ class BaseInfraOptimTest(test.BaseTestCase):
|
|||||||
ap['uuid'] for ap in action_plans['action_plans'])
|
ap['uuid'] for ap in action_plans['action_plans'])
|
||||||
|
|
||||||
for action_plan in action_plans['action_plans']:
|
for action_plan in action_plans['action_plans']:
|
||||||
|
try:
|
||||||
test_utils.call_until_true(
|
test_utils.call_until_true(
|
||||||
func=functools.partial(
|
func=functools.partial(
|
||||||
cls.is_action_plan_idle, action_plan['uuid']),
|
cls.is_action_plan_idle, action_plan['uuid']),
|
||||||
duration=30,
|
duration=30,
|
||||||
sleep_for=.5
|
sleep_for=.5
|
||||||
)
|
)
|
||||||
|
except Exception:
|
||||||
|
action_plans_to_be_deleted.remove(
|
||||||
|
action_plan['uuid'])
|
||||||
|
|
||||||
# Phase 2: Delete them all
|
# Phase 2: Delete them all
|
||||||
for action_plan_uuid in action_plans_to_be_deleted:
|
for action_plan_uuid in action_plans_to_be_deleted:
|
||||||
|
@ -124,6 +124,7 @@ class TestShowListActionPlan(base.BaseInfraOptimTest):
|
|||||||
)
|
)
|
||||||
_, action_plans = cls.client.list_action_plans(
|
_, action_plans = cls.client.list_action_plans(
|
||||||
audit_uuid=cls.audit['uuid'])
|
audit_uuid=cls.audit['uuid'])
|
||||||
|
if len(action_plans['action_plans']) > 0:
|
||||||
cls.action_plan = action_plans['action_plans'][0]
|
cls.action_plan = action_plans['action_plans'][0]
|
||||||
|
|
||||||
@decorators.attr(type='smoke')
|
@decorators.attr(type='smoke')
|
||||||
|
@ -38,7 +38,15 @@ class TestShowListService(base.BaseInfraOptimTest):
|
|||||||
|
|
||||||
@decorators.attr(type='smoke')
|
@decorators.attr(type='smoke')
|
||||||
def test_show_service(self):
|
def test_show_service(self):
|
||||||
_, service = self.client.show_service(self.DECISION_ENGINE)
|
_, body = self.client.list_services()
|
||||||
|
self.assertIn('services', body)
|
||||||
|
services = body['services']
|
||||||
|
self.assertIn(self.DECISION_ENGINE,
|
||||||
|
[i['name'] for i in body['services']])
|
||||||
|
|
||||||
|
service_id = filter(lambda x: self.DECISION_ENGINE == x['name'],
|
||||||
|
services)[0]['id']
|
||||||
|
_, service = self.client.show_service(service_id)
|
||||||
|
|
||||||
self.assertEqual(self.DECISION_ENGINE, service['name'])
|
self.assertEqual(self.DECISION_ENGINE, service['name'])
|
||||||
self.assertIn("host", service.keys())
|
self.assertIn("host", service.keys())
|
||||||
@ -47,7 +55,16 @@ class TestShowListService(base.BaseInfraOptimTest):
|
|||||||
|
|
||||||
@decorators.attr(type='smoke')
|
@decorators.attr(type='smoke')
|
||||||
def test_show_service_with_links(self):
|
def test_show_service_with_links(self):
|
||||||
_, service = self.client.show_service(self.DECISION_ENGINE)
|
_, body = self.client.list_services()
|
||||||
|
self.assertIn('services', body)
|
||||||
|
services = body['services']
|
||||||
|
self.assertIn(self.DECISION_ENGINE,
|
||||||
|
[i['name'] for i in body['services']])
|
||||||
|
|
||||||
|
service_id = filter(lambda x: self.DECISION_ENGINE == x['name'],
|
||||||
|
services)[0]['id']
|
||||||
|
_, service = self.client.show_service(service_id)
|
||||||
|
|
||||||
self.assertIn('links', service.keys())
|
self.assertIn('links', service.keys())
|
||||||
self.assertEqual(2, len(service['links']))
|
self.assertEqual(2, len(service['links']))
|
||||||
self.assertIn(str(service['id']),
|
self.assertIn(str(service['id']),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user