mirror of https://github.com/nucypher/nucypher.git
This test actually performs better with random values - when every node takes the same amount of time to return, there's a much more likely chance of all of them returning at the same moment, and thus overshooting the mutex requirement for unblocking.
parent
de266be0cf
commit
d1b2257797
|
@ -190,7 +190,7 @@ def test_mass_treasure_map_placement(fleet_of_highperf_mocked_ursulas,
|
|||
|
||||
# The number of nodes having the map is approximately the number you'd expect from full utilization of Alice's publication threadpool.
|
||||
# TODO: This line fails sometimes because the loop goes too fast.
|
||||
# assert nodes_that_have_the_map_when_we_unblock == pytest.approx(policy.publishing_mutex._threadpool.max, .6)
|
||||
assert nodes_that_have_the_map_when_we_unblock == pytest.approx(policy.publishing_mutex._threadpool.max, .6)
|
||||
|
||||
# Temporarily: *some* nodes have it.
|
||||
assert nodes_that_have_the_map_when_we_unblock
|
||||
|
|
|
@ -15,6 +15,7 @@ You should have received a copy of the GNU Affero General Public License
|
|||
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
import time
|
||||
import random
|
||||
|
||||
import requests
|
||||
import socket
|
||||
|
@ -133,9 +134,9 @@ class SluggishLargeFleetMiddleware(MockRestMiddlewareForLargeFleetTests):
|
|||
Similar to above, but with added delay to simulate network latency.
|
||||
"""
|
||||
def put_treasure_map_on_node(self, node, *args, **kwargs):
|
||||
time.sleep(.1)
|
||||
time.sleep(random.randrange(5, 15) / 100)
|
||||
result = super().put_treasure_map_on_node(node=node, *args, **kwargs)
|
||||
time.sleep(.1)
|
||||
time.sleep(random.randrange(5, 15) / 100)
|
||||
return result
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue