diff --git a/unit-tests/dds/device-2nd-client.py b/unit-tests/dds/device-2nd-client.py index e93247e7a4..c77ce85afd 100644 --- a/unit-tests/dds/device-2nd-client.py +++ b/unit-tests/dds/device-2nd-client.py @@ -8,7 +8,15 @@ participant = dds.participant() -participant.init( 123, f'client-{log.nested.strip()}' ) +# in some cases we need a bigger buffer for our messages, to avoid missing messages sent +settings = { "device" : + { "notification" : + { "history" : + { "depth" : 60 } + } + } + } +participant.init( 123, f'client-{log.nested.strip()}', settings ) info = dds.message.device_info() diff --git a/unit-tests/dds/device-broadcaster.py b/unit-tests/dds/device-broadcaster.py index 0229be6c7b..8a56ea50e0 100644 --- a/unit-tests/dds/device-broadcaster.py +++ b/unit-tests/dds/device-broadcaster.py @@ -40,7 +40,9 @@ def close_server( instance ): Close the instance returned by broadcast_device() """ global servers - del servers[instance] # throws if does not exist + server = servers[instance]["server"] # throws if does not exist + server.broadcast_disconnect() + del servers[instance] # From here down, we're in "interactive" mode (see test-device-init.py) diff --git a/unit-tests/dds/device-init-server.py b/unit-tests/dds/device-init-server.py index a36f9abf71..ee58c00e40 100644 --- a/unit-tests/dds/device-init-server.py +++ b/unit-tests/dds/device-init-server.py @@ -11,7 +11,15 @@ participant = dds.participant() -participant.init( 123, "device-init-server" ) +# in some cases we need a bigger buffer for our messages, to avoid missing messages sent +settings = { "device" : + { "notification" : + { "history" : + { "depth" : 60 } + } + } + } +participant.init( 123, "device-init-server", settings ) def test_one_stream(): @@ -77,8 +85,15 @@ def notification_flooder(): i = 0 while server is not None: i += 1 - log.d( f'----> {i}' ) - server.publish_notification( { 'id' : 'some-notification', 'counter' : i } ) + #log.d( f'----> {i}' ) + try: + server.publish_notification( { 'id' : 'some-notification', 'counter' : i } ) + except AttributeError as e: + # another thread had just made the server None at this point + if not server: + log.d("tried calling publish_notification but server is None, was close_server called?") + else: + raise e # unexpected error sleep( 0.005 ) global notification_thread notification_thread = threading.Thread( target=notification_flooder )