Skip to content

Commit

Permalink
Fix and speedup hidden services test
Browse files Browse the repository at this point in the history
  • Loading branch information
egbertbouman committed Oct 24, 2021
1 parent c65ca00 commit 5b1e8bc
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ async def create_tunnel_community(comm_config: TunnelCommunitySettings = None,
# it will never recover (on Mac/Linux with Libtorrent >=1.2.0). Therefore, we start
# libtorrent afterwards.
dlmgr_settings = LibtorrentSettings()
dlmgr_settings.dht = False

dlmgr = DownloadManager(state_dir=Path.mkdtemp(),
config=dlmgr_settings,
Expand Down Expand Up @@ -247,10 +248,9 @@ async def test_anon_download(proxy_factory, video_seeder: DownloadManager, video
assert my_comm.find_circuits()[0].bytes_down > 0


@pytest.mark.skip("Broken after moving SOCK5 in a separate component. Also, always failed on some machine even before")
@pytest.mark.tunneltest
@pytest.mark.asyncio
@pytest.mark.timeout(60)
@pytest.mark.timeout(40)
async def test_hidden_services(proxy_factory, hidden_seeder_comm, video_tdef, logger):
"""
Test the hidden services overlay by constructing an end-to-end circuit and downloading a torrent over it
Expand Down Expand Up @@ -280,13 +280,13 @@ def download_state_callback(ds):

leecher_comm.build_tunnels(1)

while not hidden_seeder_comm.find_circuits(ctype=CIRCUIT_TYPE_IP_SEEDER):
await sleep(0.5)
await sleep(0.5)
class MockExitDict(dict):
def __getitem__(self, key):
value = super().__getitem__(key)
return value if isinstance(value, MockTunnelExitSocket) else MockTunnelExitSocket(value)

for e in exit_nodes:
for cid in list(e.exit_sockets.keys()):
e.exit_sockets[cid] = MockTunnelExitSocket(e.exit_sockets[cid])
e.exit_sockets = MockExitDict(e.exit_sockets)

download = start_anon_download(leecher_comm, hidden_seeder_comm.dlmgr.libtorrent_port, video_tdef, hops=1)
download.set_state_callback(download_state_callback)
Expand Down

0 comments on commit 5b1e8bc

Please sign in to comment.