Move most of the code testing UDP from core tests to test_network #2169

Merged
PeterSurda merged 2 commits from gitea-65 into v0.6 2024-01-15 17:55:42 +01:00
Showing only changes of commit 606b6d7d08 - Show all commits

View File

@ -19,6 +19,7 @@ class TestNetwork(TestPartialRun):
cls.state.maximumNumberOfHalfOpenConnections = 4 cls.state.maximumNumberOfHalfOpenConnections = 4
cls.config.set('bitmessagesettings', 'sendoutgoingconnections', 'True') cls.config.set('bitmessagesettings', 'sendoutgoingconnections', 'True')
cls.config.set('bitmessagesettings', 'udp', 'True')
# config variable is still used inside of the network ): # config variable is still used inside of the network ):
import network import network
@ -34,18 +35,14 @@ class TestNetwork(TestPartialRun):
def test_threads(self): def test_threads(self):
"""Ensure all the network threads started""" """Ensure all the network threads started"""
threads = { threads = {
"AddrBroadcaster", "Asyncore", "Downloader", "InvBroadcaster", "AddrBroadcaster", "Announcer", "Asyncore", "Downloader",
"Uploader"} "InvBroadcaster", "Uploader"}
extra = ( extra = self.config.getint('threads', 'receive')
self.config.getint('threads', 'receive')
+ self.config.safeGetBoolean('bitmessagesettings', 'udp'))
for thread in threading.enumerate(): for thread in threading.enumerate():
try: try:
threads.remove(thread.name) threads.remove(thread.name)
except KeyError: except KeyError:
extra -= ( extra -= thread.name.startswith("ReceiveQueue_")
thread.name == "Announcer"
or thread.name.startswith("ReceiveQueue_"))
self.assertEqual(len(threads), 0) self.assertEqual(len(threads), 0)
self.assertEqual(extra, 0) self.assertEqual(extra, 0)