Fixed flaky tempest test
Fixed the flaky test_delete_audit test which was failing if the delete query was sent before the audit reaches an 'idle' state. Change-Id: I244643b1f7c9b31baa5c25753e62dd3da0a53544
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import functools
|
||||||
|
|
||||||
from tempest.lib import exceptions
|
from tempest.lib import exceptions
|
||||||
from tempest import test
|
from tempest import test
|
||||||
|
|
||||||
@@ -123,10 +125,28 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest):
|
|||||||
_, body = self.create_audit(audit_template['uuid'])
|
_, body = self.create_audit(audit_template['uuid'])
|
||||||
audit_uuid = body['uuid']
|
audit_uuid = body['uuid']
|
||||||
|
|
||||||
|
test.call_until_true(
|
||||||
|
func=functools.partial(
|
||||||
|
self.is_audit_idle, audit_uuid),
|
||||||
|
duration=10,
|
||||||
|
sleep_for=.5
|
||||||
|
)
|
||||||
|
|
||||||
|
def is_audit_deleted(uuid):
|
||||||
|
try:
|
||||||
|
return not bool(self.client.show_audit(uuid))
|
||||||
|
except exceptions.NotFound:
|
||||||
|
return True
|
||||||
|
|
||||||
self.delete_audit(audit_uuid)
|
self.delete_audit(audit_uuid)
|
||||||
|
|
||||||
self.assertRaises(
|
test.call_until_true(
|
||||||
exceptions.NotFound, self.client.show_audit, audit_uuid)
|
func=functools.partial(is_audit_deleted, audit_uuid),
|
||||||
|
duration=5,
|
||||||
|
sleep_for=1
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertTrue(is_audit_deleted(audit_uuid))
|
||||||
|
|
||||||
|
|
||||||
class TestShowListAudit(base.BaseInfraOptimTest):
|
class TestShowListAudit(base.BaseInfraOptimTest):
|
||||||
|
|||||||
Reference in New Issue
Block a user