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:
@@ -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