fix race with 'await_client_ready' instead

This commit is contained in:
meejah 2022-08-13 11:51:01 -06:00
parent 34641846ab
commit 34dd39bfbf
2 changed files with 12 additions and 17 deletions

View File

@ -228,6 +228,7 @@ class Client(object):
) )
self.process = process self.process = process
self.protocol = self.process.transport._protocol self.protocol = self.process.transport._protocol
yield await_client_ready(self.process, minimum_number_of_servers=servers)
# XXX add stop / start / restart # XXX add stop / start / restart

View File

@ -214,9 +214,6 @@ def test_reject_storage_server(reactor, request, temp_dir, flog_gatherer, port_a
# re-start this storage server # re-start this storage server
yield storage0.restart(reactor, request) yield storage0.restart(reactor, request)
import time
time.sleep(1)
# now only one storage-server has the certificate .. configure # now only one storage-server has the certificate .. configure
# diana to have the grid-manager certificate # 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 # diana has happy=2 but should only find storage0 to be acceptable
# to upload to) # to upload to)
# Takes a little bit of time for node to connect: try:
for i in range(10): yield util.run_tahoe(
try: reactor, request, "--node-directory", diana.process.node_dir,
yield util.run_tahoe( "put", "-",
reactor, request, "--node-directory", diana.process.node_dir, stdin=b"some content\n" * 200,
"put", "-", )
stdin=b"some content\n" * 200, assert False, "Should get a failure"
) except util.ProcessFailed as e:
assert False, "Should get a failure" if b'UploadUnhappinessError' in e.output:
except util.ProcessFailed as e: # We're done! We've succeeded.
if b'UploadUnhappinessError' in e.output: return
# We're done! We've succeeded.
return
time.sleep(0.2)
assert False, "Failed to see one of out of two servers" assert False, "Failed to see one of out of two servers"