mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 14:52:26 +00:00
Merge pull request #1325 from exarkun/4055.await_client_ready
Fix the minimum-live-servers condition in `await_client_ready` Fixes: ticket:4055
This commit is contained in:
commit
a648708033
@ -575,6 +575,32 @@ def tor_network(reactor, temp_dir, chutney, request):
|
||||
request.addfinalizer(cleanup)
|
||||
|
||||
pytest_twisted.blockon(chutney(("start", basic_network)))
|
||||
|
||||
# Wait for the nodes to "bootstrap" - ie, form a network among themselves.
|
||||
# Successful bootstrap is reported with a message something like:
|
||||
#
|
||||
# Everything bootstrapped after 151 sec
|
||||
# Bootstrap finished: 151 seconds
|
||||
# Node status:
|
||||
# test000a : 100, done , Done
|
||||
# test001a : 100, done , Done
|
||||
# test002a : 100, done , Done
|
||||
# test003r : 100, done , Done
|
||||
# test004r : 100, done , Done
|
||||
# test005r : 100, done , Done
|
||||
# test006r : 100, done , Done
|
||||
# test007r : 100, done , Done
|
||||
# test008c : 100, done , Done
|
||||
# test009c : 100, done , Done
|
||||
# Published dir info:
|
||||
# test000a : 100, all nodes , desc md md_cons ns_cons , Dir info cached
|
||||
# test001a : 100, all nodes , desc md md_cons ns_cons , Dir info cached
|
||||
# test002a : 100, all nodes , desc md md_cons ns_cons , Dir info cached
|
||||
# test003r : 100, all nodes , desc md md_cons ns_cons , Dir info cached
|
||||
# test004r : 100, all nodes , desc md md_cons ns_cons , Dir info cached
|
||||
# test005r : 100, all nodes , desc md md_cons ns_cons , Dir info cached
|
||||
# test006r : 100, all nodes , desc md md_cons ns_cons , Dir info cached
|
||||
# test007r : 100, all nodes , desc md md_cons ns_cons , Dir info cached
|
||||
pytest_twisted.blockon(chutney(("wait_for_bootstrap", basic_network)))
|
||||
|
||||
# print some useful stuff
|
||||
|
@ -622,19 +622,28 @@ def await_client_ready(tahoe, timeout=10, liveness=60*2, minimum_number_of_serve
|
||||
time.sleep(1)
|
||||
continue
|
||||
|
||||
print(
|
||||
f"Now: {time.ctime()}\n"
|
||||
f"Server last-received-data: {[time.ctime(s['last_received_data']) for s in servers]}"
|
||||
)
|
||||
|
||||
now = time.time()
|
||||
server_times = [
|
||||
server['last_received_data']
|
||||
for server in servers
|
||||
for server
|
||||
in servers
|
||||
if server['last_received_data'] is not None
|
||||
]
|
||||
print(
|
||||
f"Now: {time.ctime(now)}\n"
|
||||
f"Liveness required: {liveness}\n"
|
||||
f"Server last-received-data: {[time.ctime(s) for s in server_times]}\n"
|
||||
f"Server ages: {[now - s for s in server_times]}\n"
|
||||
)
|
||||
|
||||
# check that all times are 'recent enough' (it's OK if _some_ servers
|
||||
# are down, we just want to make sure a sufficient number are up)
|
||||
if len([time.time() - t <= liveness for t in server_times if t is not None]) < minimum_number_of_servers:
|
||||
print("waiting because at least one server too old")
|
||||
alive = [t for t in server_times if now - t <= liveness]
|
||||
if len(alive) < minimum_number_of_servers:
|
||||
print(
|
||||
f"waiting because we found {len(alive)} servers "
|
||||
f"and want {minimum_number_of_servers}"
|
||||
)
|
||||
time.sleep(1)
|
||||
continue
|
||||
|
||||
|
0
newsfragments/4055.minor
Normal file
0
newsfragments/4055.minor
Normal file
Loading…
Reference in New Issue
Block a user