fixing some tests

This commit is contained in:
DJ2LS 2024-04-17 23:37:28 +02:00
parent ff002ec479
commit 6309c5363f
4 changed files with 9 additions and 4 deletions

View file

@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]
os: [ubuntu-20.04, windows-latest] # removed macos-latest as it's broken for now
include:
- os: ubuntu-20.04
zip_name: freedata-server_ubuntu

View file

@ -32,7 +32,7 @@ class TestDataFrameFactory(unittest.TestCase):
def testARQConnect(self):
dxcall = "DJ2LS-4"
session_id = 123
frame = self.factory.build_arq_session_open(dxcall, session_id, 1700)
frame = self.factory.build_arq_session_open(dxcall, session_id, 1700, 1)
frame_data = self.factory.deconstruct(frame)
self.assertEqual(frame_data['origin'], self.factory.myfullcall)

View file

@ -96,12 +96,17 @@ class TestMessageProtocol(unittest.TestCase):
# Transfer data between both parties
try:
transmission = modem_transmit_queue.get(timeout=1)
transmission["bytes"] += bytes(2) # simulate 2 bytes crc checksum
if random.randint(0, 100) < self.loss_probability:
self.logger.info(f"[{threading.current_thread().name}] Frame lost...")
continue
frame_bytes = transmission['bytes']
frame_dispatcher.new_process_data(frame_bytes, None, len(frame_bytes), 0, 0)
if len(frame_bytes) == 5:
mode_name = "SIGNALLING_ACK"
else:
mode_name = None
frame_dispatcher.process_data(frame_bytes, None, len(frame_bytes), 0, 0, mode_name=mode_name)
except queue.Empty:
continue
self.logger.info(f"[{threading.current_thread().name}] Channel closed.")

View file

@ -41,7 +41,7 @@ class TestProtocols(unittest.TestCase):
cls.modem)
def shortcutTransmission(self, frame_bytes):
self.frame_dispatcher.new_process_data(frame_bytes, None, len(frame_bytes), 0, 0)
self.frame_dispatcher.process_data(frame_bytes, None, len(frame_bytes), 0, 0, mode_name="TEST")
def assertEventReceivedType(self, event_type):
ev = self.event_queue.get()