From 34dd39bfbf78e627a2ca05e457c444d0e0ee5e8e Mon Sep 17 00:00:00 2001 From: meejah Date: Sat, 13 Aug 2022 11:51:01 -0600 Subject: [PATCH] fix race with 'await_client_ready' instead --- integration/grid.py | 1 + integration/test_grid_manager.py | 28 +++++++++++----------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/integration/grid.py b/integration/grid.py index eb25d9514..4e5d8a900 100644 --- a/integration/grid.py +++ b/integration/grid.py @@ -228,6 +228,7 @@ class Client(object): ) self.process = process self.protocol = self.process.transport._protocol + yield await_client_ready(self.process, minimum_number_of_servers=servers) # XXX add stop / start / restart diff --git a/integration/test_grid_manager.py b/integration/test_grid_manager.py index 35ea10c9f..b24149a3b 100644 --- a/integration/test_grid_manager.py +++ b/integration/test_grid_manager.py @@ -214,9 +214,6 @@ def test_reject_storage_server(reactor, request, temp_dir, flog_gatherer, port_a # re-start this storage server yield storage0.restart(reactor, request) - import time - time.sleep(1) - # now only one storage-server has the certificate .. configure # diana to have the grid-manager certificate @@ -234,20 +231,17 @@ def test_reject_storage_server(reactor, request, temp_dir, flog_gatherer, port_a # diana has happy=2 but should only find storage0 to be acceptable # to upload to) - # Takes a little bit of time for node to connect: - for i in range(10): - try: - yield util.run_tahoe( - reactor, request, "--node-directory", diana.process.node_dir, - "put", "-", - stdin=b"some content\n" * 200, - ) - assert False, "Should get a failure" - except util.ProcessFailed as e: - if b'UploadUnhappinessError' in e.output: - # We're done! We've succeeded. - return - time.sleep(0.2) + try: + yield util.run_tahoe( + reactor, request, "--node-directory", diana.process.node_dir, + "put", "-", + stdin=b"some content\n" * 200, + ) + assert False, "Should get a failure" + except util.ProcessFailed as e: + if b'UploadUnhappinessError' in e.output: + # We're done! We've succeeded. + return assert False, "Failed to see one of out of two servers"