Merge "Fixed Basic optim tempest test"
This commit is contained in:
@@ -71,11 +71,11 @@ class AuditPostType(wtypes.Base):
|
||||
raise exception.AuditTypeNotFound(audit_type=self.audit_type)
|
||||
|
||||
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)
|
||||
|
||||
if (self.audit_type == objects.audit.AuditType.CONTINUOUS.value and
|
||||
self.interval == wtypes.Unset):
|
||||
self.interval in (wtypes.Unset, None)):
|
||||
raise exception.AuditIntervalNotSpecified(
|
||||
audit_type=self.audit_type)
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ class MessagingHandler(threading.Thread):
|
||||
def build_server(self, target):
|
||||
return om.get_rpc_server(self.__transport, target,
|
||||
self.__endpoints,
|
||||
executor='evenlet',
|
||||
executor='eventlet',
|
||||
serializer=self.__serializer)
|
||||
|
||||
def _configure(self):
|
||||
|
||||
@@ -482,6 +482,6 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
||||
|
||||
def post_execute(self):
|
||||
self.solution.set_efficacy_indicators(
|
||||
released_compute_nodes_count=self.number_of_migrations,
|
||||
vm_migrations_count=self.number_of_released_nodes,
|
||||
released_compute_nodes_count=self.number_of_released_nodes,
|
||||
vm_migrations_count=self.number_of_migrations,
|
||||
)
|
||||
|
||||
@@ -58,7 +58,7 @@ class TestMessagingHandler(base.TestCase):
|
||||
handler.transport,
|
||||
m_target,
|
||||
[self.ENDPOINT],
|
||||
executor='evenlet',
|
||||
executor='eventlet',
|
||||
serializer=None,
|
||||
)
|
||||
|
||||
|
||||
@@ -156,18 +156,19 @@ class BaseInfraOptimTest(test.BaseTestCase):
|
||||
|
||||
@classmethod
|
||||
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
|
||||
|
||||
:param audit_template_uuid: Audit Template UUID this audit will use
|
||||
:param type: Audit type (either ONESHOT or CONTINUOUS)
|
||||
:param state: Audit state (str)
|
||||
:param deadline: Audit deadline (datetime)
|
||||
:param interval: Audit interval in seconds (int)
|
||||
:return: A tuple with The HTTP response and its body
|
||||
"""
|
||||
resp, body = cls.client.create_audit(
|
||||
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_action_plans_audit_uuids.add(body['uuid'])
|
||||
|
||||
@@ -58,6 +58,7 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest):
|
||||
audit_params = dict(
|
||||
audit_template_uuid=audit_template['uuid'],
|
||||
audit_type='CONTINUOUS',
|
||||
interval=7200,
|
||||
)
|
||||
|
||||
_, body = self.create_audit(**audit_params)
|
||||
|
||||
@@ -142,6 +142,9 @@ class BaseInfraOptimScenarioTest(manager.ScenarioTest):
|
||||
|
||||
def has_audit_succeeded(self, audit_uuid):
|
||||
_, audit = self.client.show_audit(audit_uuid)
|
||||
if audit.get('state') in ('FAILED', 'CANCELLED'):
|
||||
raise ValueError()
|
||||
|
||||
return audit.get('state') == 'SUCCEEDED'
|
||||
|
||||
# ### ACTION PLANS ### #
|
||||
|
||||
@@ -108,14 +108,21 @@ class TestExecuteBasicStrategy(base.BaseInfraOptimScenarioTest):
|
||||
self.addCleanup(self.rollback_compute_nodes_status)
|
||||
self._create_one_instance_per_host()
|
||||
_, 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'])
|
||||
|
||||
self.assertTrue(test.call_until_true(
|
||||
func=functools.partial(self.has_audit_succeeded, audit['uuid']),
|
||||
duration=600,
|
||||
sleep_for=2
|
||||
))
|
||||
try:
|
||||
self.assertTrue(test.call_until_true(
|
||||
func=functools.partial(
|
||||
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(
|
||||
audit_uuid=audit['uuid'])
|
||||
action_plan = action_plans['action_plans'][0]
|
||||
|
||||
Reference in New Issue
Block a user