Fix race in test_launchNode_delete_error

Deleting failed nodes is offloaded to the DeletedNodeWorker. Thus the
deletion can be a bit delayed and we need to wait for delete_success
instead of asserting it.

Change-Id: I5b425707fac5250367f6f3164e803951b10196cb
This commit is contained in:
Tobias Henkel 2018-09-24 07:25:06 +02:00
parent a217373948
commit 2da07128e6
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2
1 changed files with 6 additions and 1 deletions

View File

@ -1527,8 +1527,13 @@ class TestLauncher(tests.DBTestCase):
self.zk.storeNodeRequest(req)
req = self.waitForNodeRequest(req)
# The deletion of the node can be delayed so wait for it.
while True:
if fake_client.delete_success:
break
time.sleep(0.1)
self.assertTrue(fake_client.launch_success)
self.assertTrue(fake_client.delete_success)
self.assertEqual(fake_client.times_to_fail_delete,
fake_client.times_failed_delete)
self.assertEqual(fake_client.times_to_fail_launch,