Files
slsDetectorPackage/python/tests/test_zmq.py
T
maliakal_dandmazzol_a 9c0bfe3517 dev: zmq hwm rebind (#1480)
* move hwm into the zmq constructor and reconstruct the socket instead of rebind. seems to work better than rebind (most connections cant bind so fast?)

* fix after merge

* added tests to reconnect zmq sockets when setting rx zmqport and rx zmqhwm, changed the tests scripts a bit to make the receiver starting tcp port configurable

* tests: slsreceiver also starting up  with 2000 as default tcp port, using latest cli args for receiver and multi receiver

* releasr notes

---------

Co-authored-by: AliceMazzoleni99 <alice.mazzoleni@psi.ch>
2026-08-03 09:34:57 +02:00

52 lines
1.0 KiB
Python

import pytest
import sys
import time
from conftest import session_simulator
from slsdet import Detector
from slsdet.utils import element_if_equal
from slsdet._slsdet import slsDetectorDefs
from utils_for_test import (
Log,
LogLevel,
)
detectorType = slsDetectorDefs.detectorType
@pytest.mark.detectorintegration
@pytest.mark.parametrize(
"session_simulator",
[
("eiger", 1, 20)
],
indirect=True,
)
def test_zmq_reconnect(session_simulator, request):
""" Test changing zmq ports and zmq hwm with zmq sockets connected (reconnect). """
det_type, num_interfaces, num_mods, d = session_simulator
assert d is not None
assert d.type == detectorType.EIGER
d.rx_zmqstream = True
assert d.rx_zmqstream == True
port = 14000
hwm = 2
for _ in range(10):
d.rx_zmqport = port
d.rx_zmqhwm = hwm
Log(LogLevel.INFOGREEN, f"Set zmqport={port}, zmqhwm={hwm}")
port += 1000
hwm += 5
time.sleep(1)
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")