mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Adjust checks to use SOCKET_QUEUE.
This commit is contained in:
parent
1fcd7dbdec
commit
e183f9a419
3 changed files with 30 additions and 9 deletions
|
@ -16,8 +16,8 @@ from test import util_tnc_ISS as iss
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
# These do not update static.INFO:
|
# These do not update sock.SOCKET_QUEUE:
|
||||||
# "CONNECT", "SEND_TEST_FRAME"
|
# "CONNECT"
|
||||||
# This test is currently a little inconsistent.
|
# This test is currently a little inconsistent.
|
||||||
@pytest.mark.flaky(reruns=2)
|
@pytest.mark.flaky(reruns=2)
|
||||||
@pytest.mark.parametrize("command", ["CQ", "PING", "BEACON"])
|
@pytest.mark.parametrize("command", ["CQ", "PING", "BEACON"])
|
||||||
|
|
|
@ -10,26 +10,37 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import structlog
|
||||||
|
|
||||||
sys.path.insert(0, "..")
|
sys.path.insert(0, "..")
|
||||||
sys.path.insert(0, "../tnc")
|
sys.path.insert(0, "../tnc")
|
||||||
import data_handler
|
import data_handler
|
||||||
import helpers
|
import helpers
|
||||||
import modem
|
import modem
|
||||||
|
import sock
|
||||||
import static
|
import static
|
||||||
|
|
||||||
IRS_original_arq_cleanup = object
|
IRS_original_arq_cleanup = object
|
||||||
MESSAGE: str
|
MESSAGE: str
|
||||||
|
|
||||||
|
log = structlog.get_logger("util_tnc_IRS")
|
||||||
|
|
||||||
|
|
||||||
def irs_arq_cleanup():
|
def irs_arq_cleanup():
|
||||||
"""Replacement for modem.arq_cleanup to detect when to exit process."""
|
"""Replacement for modem.arq_cleanup to detect when to exit process."""
|
||||||
if "TRANSMISSION;STOPPED" in static.INFO:
|
log.info(
|
||||||
print(f"{static.INFO=}")
|
"irs_arq_cleanup", socket_queue=sock.SOCKET_QUEUE.queue, message=MESSAGE.lower()
|
||||||
|
)
|
||||||
|
if '"arq":"transmission","status":"stopped"' in str(sock.SOCKET_QUEUE.queue):
|
||||||
|
# log.info("irs_arq_cleanup", socket_queue=sock.SOCKET_QUEUE.queue)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
# sys.exit does not terminate threads.
|
# sys.exit does not terminate threads.
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
if f"{MESSAGE};RECEIVING" not in static.INFO:
|
if f'"{MESSAGE.lower()}":"receiving"' not in str(
|
||||||
|
sock.SOCKET_QUEUE.queue
|
||||||
|
) and f'"{MESSAGE.lower()}":"received"' not in str(sock.SOCKET_QUEUE.queue):
|
||||||
print(f"{MESSAGE} was not received.")
|
print(f"{MESSAGE} was not received.")
|
||||||
|
log.info("irs_arq_cleanup", socket_queue=sock.SOCKET_QUEUE.queue)
|
||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
|
@ -10,26 +10,36 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
sys.path.insert(0, "..")
|
import structlog
|
||||||
|
|
||||||
sys.path.insert(0, "../tnc")
|
sys.path.insert(0, "../tnc")
|
||||||
import data_handler
|
import data_handler
|
||||||
import helpers
|
import helpers
|
||||||
import modem
|
import modem
|
||||||
|
import sock
|
||||||
import static
|
import static
|
||||||
|
|
||||||
ISS_original_arq_cleanup = object
|
ISS_original_arq_cleanup = object
|
||||||
MESSAGE: str
|
MESSAGE: str
|
||||||
|
|
||||||
|
log = structlog.get_logger("util_tnc_ISS")
|
||||||
|
|
||||||
|
|
||||||
def iss_arq_cleanup():
|
def iss_arq_cleanup():
|
||||||
"""Replacement for modem.arq_cleanup to detect when to exit process."""
|
"""Replacement for modem.arq_cleanup to detect when to exit process."""
|
||||||
if "TRANSMISSION;STOPPED" in static.INFO:
|
log.info(
|
||||||
print(f"{static.INFO=}")
|
"irs_arq_cleanup", socket_queue=sock.SOCKET_QUEUE.queue, message=MESSAGE.lower()
|
||||||
|
)
|
||||||
|
if '"arq":"transmission","status":"stopped"' in str(sock.SOCKET_QUEUE.queue):
|
||||||
|
# log.info("iss_arq_cleanup", socket_queue=sock.SOCKET_QUEUE.queue)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
# sys.exit does not terminate threads.
|
# sys.exit does not terminate threads.
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
if f"{MESSAGE};SENDING" not in static.INFO:
|
if f'"{MESSAGE.lower()}":"transmitting"' not in str(
|
||||||
|
sock.SOCKET_QUEUE.queue
|
||||||
|
) and f'"{MESSAGE.lower()}":"sending"' not in str(sock.SOCKET_QUEUE.queue):
|
||||||
print(f"{MESSAGE} was not sent.")
|
print(f"{MESSAGE} was not sent.")
|
||||||
|
log.info("iss_arq_cleanup", socket_queue=sock.SOCKET_QUEUE.queue)
|
||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
Loading…
Reference in a new issue