Skip to content

Commit

Permalink
stabilize dds tests device-init and librs-device-properties
Browse files Browse the repository at this point in the history
  • Loading branch information
AviaAv committed Dec 4, 2024
1 parent 684cebc commit 35ad42b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
10 changes: 9 additions & 1 deletion unit-tests/dds/device-2nd-client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion unit-tests/dds/device-broadcaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 18 additions & 3 deletions unit-tests/dds/device-init-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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 )
Expand Down

0 comments on commit 35ad42b

Please sign in to comment.