Fixed Basic optim tempest test
In this changeset, I made some fixes in order to make the multinode test pass on the gate. Change-Id: I2433748a78c87b15893ea69964561955b478eebd
This commit is contained in:
@@ -71,11 +71,11 @@ class AuditPostType(wtypes.Base):
|
|||||||
raise exception.AuditTypeNotFound(audit_type=self.audit_type)
|
raise exception.AuditTypeNotFound(audit_type=self.audit_type)
|
||||||
|
|
||||||
if (self.audit_type == objects.audit.AuditType.ONESHOT.value and
|
if (self.audit_type == objects.audit.AuditType.ONESHOT.value and
|
||||||
self.interval != wtypes.Unset):
|
self.interval not in (wtypes.Unset, None)):
|
||||||
raise exception.AuditIntervalNotAllowed(audit_type=self.audit_type)
|
raise exception.AuditIntervalNotAllowed(audit_type=self.audit_type)
|
||||||
|
|
||||||
if (self.audit_type == objects.audit.AuditType.CONTINUOUS.value and
|
if (self.audit_type == objects.audit.AuditType.CONTINUOUS.value and
|
||||||
self.interval == wtypes.Unset):
|
self.interval in (wtypes.Unset, None)):
|
||||||
raise exception.AuditIntervalNotSpecified(
|
raise exception.AuditIntervalNotSpecified(
|
||||||
audit_type=self.audit_type)
|
audit_type=self.audit_type)
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class MessagingHandler(threading.Thread):
|
|||||||
def build_server(self, target):
|
def build_server(self, target):
|
||||||
return om.get_rpc_server(self.__transport, target,
|
return om.get_rpc_server(self.__transport, target,
|
||||||
self.__endpoints,
|
self.__endpoints,
|
||||||
executor='evenlet',
|
executor='eventlet',
|
||||||
serializer=self.__serializer)
|
serializer=self.__serializer)
|
||||||
|
|
||||||
def _configure(self):
|
def _configure(self):
|
||||||
|
|||||||
@@ -482,6 +482,6 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
|||||||
|
|
||||||
def post_execute(self):
|
def post_execute(self):
|
||||||
self.solution.set_efficacy_indicators(
|
self.solution.set_efficacy_indicators(
|
||||||
released_compute_nodes_count=self.number_of_migrations,
|
released_compute_nodes_count=self.number_of_released_nodes,
|
||||||
vm_migrations_count=self.number_of_released_nodes,
|
vm_migrations_count=self.number_of_migrations,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class TestMessagingHandler(base.TestCase):
|
|||||||
handler.transport,
|
handler.transport,
|
||||||
m_target,
|
m_target,
|
||||||
[self.ENDPOINT],
|
[self.ENDPOINT],
|
||||||
executor='evenlet',
|
executor='eventlet',
|
||||||
serializer=None,
|
serializer=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -156,18 +156,19 @@ class BaseInfraOptimTest(test.BaseTestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_audit(cls, audit_template_uuid, audit_type='ONESHOT',
|
def create_audit(cls, audit_template_uuid, audit_type='ONESHOT',
|
||||||
state=None, deadline=None):
|
state=None, deadline=None, interval=None):
|
||||||
"""Wrapper utility for creating a test audit
|
"""Wrapper utility for creating a test audit
|
||||||
|
|
||||||
:param audit_template_uuid: Audit Template UUID this audit will use
|
:param audit_template_uuid: Audit Template UUID this audit will use
|
||||||
:param type: Audit type (either ONESHOT or CONTINUOUS)
|
:param type: Audit type (either ONESHOT or CONTINUOUS)
|
||||||
:param state: Audit state (str)
|
:param state: Audit state (str)
|
||||||
:param deadline: Audit deadline (datetime)
|
:param deadline: Audit deadline (datetime)
|
||||||
|
:param interval: Audit interval in seconds (int)
|
||||||
:return: A tuple with The HTTP response and its body
|
:return: A tuple with The HTTP response and its body
|
||||||
"""
|
"""
|
||||||
resp, body = cls.client.create_audit(
|
resp, body = cls.client.create_audit(
|
||||||
audit_template_uuid=audit_template_uuid, audit_type=audit_type,
|
audit_template_uuid=audit_template_uuid, audit_type=audit_type,
|
||||||
state=state, deadline=deadline)
|
state=state, deadline=deadline, interval=interval)
|
||||||
|
|
||||||
cls.created_audits.add(body['uuid'])
|
cls.created_audits.add(body['uuid'])
|
||||||
cls.created_action_plans_audit_uuids.add(body['uuid'])
|
cls.created_action_plans_audit_uuids.add(body['uuid'])
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest):
|
|||||||
audit_params = dict(
|
audit_params = dict(
|
||||||
audit_template_uuid=audit_template['uuid'],
|
audit_template_uuid=audit_template['uuid'],
|
||||||
audit_type='CONTINUOUS',
|
audit_type='CONTINUOUS',
|
||||||
|
interval=7200,
|
||||||
)
|
)
|
||||||
|
|
||||||
_, body = self.create_audit(**audit_params)
|
_, body = self.create_audit(**audit_params)
|
||||||
|
|||||||
@@ -142,6 +142,9 @@ class BaseInfraOptimScenarioTest(manager.ScenarioTest):
|
|||||||
|
|
||||||
def has_audit_succeeded(self, audit_uuid):
|
def has_audit_succeeded(self, audit_uuid):
|
||||||
_, audit = self.client.show_audit(audit_uuid)
|
_, audit = self.client.show_audit(audit_uuid)
|
||||||
|
if audit.get('state') in ('FAILED', 'CANCELLED'):
|
||||||
|
raise ValueError()
|
||||||
|
|
||||||
return audit.get('state') == 'SUCCEEDED'
|
return audit.get('state') == 'SUCCEEDED'
|
||||||
|
|
||||||
# ### ACTION PLANS ### #
|
# ### ACTION PLANS ### #
|
||||||
|
|||||||
@@ -108,14 +108,21 @@ class TestExecuteBasicStrategy(base.BaseInfraOptimScenarioTest):
|
|||||||
self.addCleanup(self.rollback_compute_nodes_status)
|
self.addCleanup(self.rollback_compute_nodes_status)
|
||||||
self._create_one_instance_per_host()
|
self._create_one_instance_per_host()
|
||||||
_, goal = self.client.show_goal(self.BASIC_GOAL)
|
_, goal = self.client.show_goal(self.BASIC_GOAL)
|
||||||
_, audit_template = self.create_audit_template(goal['uuid'])
|
_, strategy = self.client.show_strategy("basic")
|
||||||
|
_, audit_template = self.create_audit_template(
|
||||||
|
goal['uuid'], strategy=strategy['uuid'])
|
||||||
_, audit = self.create_audit(audit_template['uuid'])
|
_, audit = self.create_audit(audit_template['uuid'])
|
||||||
|
|
||||||
self.assertTrue(test.call_until_true(
|
try:
|
||||||
func=functools.partial(self.has_audit_succeeded, audit['uuid']),
|
self.assertTrue(test.call_until_true(
|
||||||
duration=600,
|
func=functools.partial(
|
||||||
sleep_for=2
|
self.has_audit_succeeded, audit['uuid']),
|
||||||
))
|
duration=600,
|
||||||
|
sleep_for=2
|
||||||
|
))
|
||||||
|
except ValueError:
|
||||||
|
self.fail("The audit has failed!")
|
||||||
|
|
||||||
_, action_plans = self.client.list_action_plans(
|
_, action_plans = self.client.list_action_plans(
|
||||||
audit_uuid=audit['uuid'])
|
audit_uuid=audit['uuid'])
|
||||||
action_plan = action_plans['action_plans'][0]
|
action_plan = action_plans['action_plans'][0]
|
||||||
|
|||||||
Reference in New Issue
Block a user