@@ -255,8 +255,14 @@ async fn dynamic_subscribers_receive_retain_messages() {
255
255
let mqtt_config = MqttConfig :: default ( ) . with_port ( broker. port ) ;
256
256
let mut mqtt = MqttActorBuilder :: new ( mqtt_config) ;
257
257
258
- broker. publish_with_opts ( "a/b" , "retain" , QoS :: AtLeastOnce , true ) . await . unwrap ( ) ;
259
- broker. publish_with_opts ( "b/c" , "retain" , QoS :: AtLeastOnce , true ) . await . unwrap ( ) ;
258
+ broker
259
+ . publish_with_opts ( "a/b" , "retain" , QoS :: AtLeastOnce , true )
260
+ . await
261
+ . unwrap ( ) ;
262
+ broker
263
+ . publish_with_opts ( "b/c" , "retain" , QoS :: AtLeastOnce , true )
264
+ . await
265
+ . unwrap ( ) ;
260
266
261
267
let mut client_0 = SimpleMessageBoxBuilder :: < _ , PublishOrSubscribe > :: new ( "dyn-subscriber" , 16 ) ;
262
268
let mut client_1 = SimpleMessageBoxBuilder :: < _ , PublishOrSubscribe > :: new ( "dyn-subscriber1" , 16 ) ;
@@ -275,14 +281,27 @@ async fn dynamic_subscribers_receive_retain_messages() {
275
281
// client_0 receives retain message upon subscribing to "a/b"
276
282
assert_eq ! ( timeout( client_0. recv( ) ) . await . unwrap( ) , msg) ;
277
283
278
- client_1. send ( PublishOrSubscribe :: Subscribe ( SubscriptionRequest { diff : SubscriptionDiff { subscribe : [ "a/b" . into ( ) , "b/c" . into ( ) ] . into ( ) , unsubscribe : [ ] . into ( ) } , client_id : client_id_1 } ) ) . await . unwrap ( ) ;
284
+ client_1
285
+ . send ( PublishOrSubscribe :: Subscribe ( SubscriptionRequest {
286
+ diff : SubscriptionDiff {
287
+ subscribe : [ "a/b" . into ( ) , "b/c" . into ( ) ] . into ( ) ,
288
+ unsubscribe : [ ] . into ( ) ,
289
+ } ,
290
+ client_id : client_id_1,
291
+ } ) )
292
+ . await
293
+ . unwrap ( ) ;
279
294
280
295
// client_1 should receive both "a/b" and "b/c" retain messages upon subscribing
281
296
let recv = timeout ( client_1. recv ( ) ) . await . unwrap ( ) ;
282
297
let recv2 = timeout ( client_1. recv ( ) ) . await . unwrap ( ) ;
283
298
284
299
// Retain message should not be redelivered to client_0
285
- assert ! ( tokio:: time:: timeout( Duration :: from_millis( 200 ) , client_0. recv( ) ) . await . is_err( ) ) ;
300
+ assert ! (
301
+ tokio:: time:: timeout( Duration :: from_millis( 200 ) , client_0. recv( ) )
302
+ . await
303
+ . is_err( )
304
+ ) ;
286
305
287
306
if recv. topic . name == "a/b" {
288
307
assert_eq ! ( recv, msg) ;
0 commit comments