1818-include_lib (" amqp10_common/include/amqp10_framing.hrl" ).
1919-include_lib (" rabbitmq_stomp/include/rabbit_stomp_frame.hrl" ).
2020
21+ -define (TIMEOUT , 30_000 ).
22+
2123-import (util ,
2224 [connect /2 ,
2325 connect /4 ]).
@@ -156,7 +158,7 @@ mqtt_amqpl_mqtt(Config) ->
156158 {<<" key" >>, <<" val" >>},
157159 {<<" rabbit🐇" /utf8 >>, <<" carrot🥕" /utf8 >>}],
158160 lists :sort (UserProperty1 ))
159- after 1000 -> ct :fail (" did not receive reply" )
161+ after ? TIMEOUT -> ct :fail (" did not receive reply" )
160162 end ,
161163
162164 % % Another message MQTT 5.0 to AMQP 0.9.1, this time with QoS 0
@@ -188,7 +190,7 @@ amqpl_mqtt_gh_12707(Config) ->
188190 payload := MqttPayload }} ->
189191 ? assertEqual (Topic , MqttTopic ),
190192 ? assertEqual (Payload , MqttPayload )
191- after 5000 ->
193+ after ? TIMEOUT ->
192194 ct :fail (" did not receive a delivery" )
193195 end ,
194196
@@ -277,7 +279,7 @@ mqtt_amqp_mqtt(Config) ->
277279 {ok , Sender } = amqp10_client :attach_sender_link (
278280 Session2 , SenderLinkName , ReplyToAddress , unsettled ),
279281 receive {amqp10_event , {link , Sender , credited }} -> ok
280- after 1000 -> ct :fail (credited_timeout )
282+ after ? TIMEOUT -> ct :fail (credited_timeout )
281283 end ,
282284
283285 DTag = <<" my-dtag" >>,
@@ -292,7 +294,7 @@ mqtt_amqp_mqtt(Config) ->
292294 Msg2 = amqp10_msg :set_headers (#{durable => True }, Msg2b ),
293295 ok = amqp10_client :send_msg (Sender , Msg2 ),
294296 receive {amqp10_disposition , {accepted , DTag }} -> ok
295- after 1000 -> ct :fail (settled_timeout )
297+ after ? TIMEOUT -> ct :fail (settled_timeout )
296298 end ,
297299
298300 ok = amqp10_client :detach_link (Sender ),
@@ -311,7 +313,7 @@ mqtt_amqp_mqtt(Config) ->
311313 'Subscription-Identifier' := 999 }
312314 },
313315 MqttMsg )
314- after 1000 -> ct :fail (" did not receive reply" )
316+ after ? TIMEOUT -> ct :fail (" did not receive reply" )
315317 end ,
316318 ok = emqtt :disconnect (C ).
317319
@@ -342,7 +344,7 @@ amqp_mqtt_amqp(Config) ->
342344 <<" sender" >>,
343345 rabbitmq_amqp_address :exchange (<<" amq.topic" >>, <<" t.1" >>)),
344346 receive {amqp10_event , {link , Sender , credited }} -> ok
345- after 2000 -> ct :fail (credited_timeout )
347+ after ? TIMEOUT -> ct :fail (credited_timeout )
346348 end ,
347349 RequestBody = <<" my request" >>,
348350
@@ -371,7 +373,7 @@ amqp_mqtt_amqp(Config) ->
371373 false ->
372374 ok
373375 end
374- after 2000 -> ct :fail (" did not receive request" )
376+ after ? TIMEOUT -> ct :fail (" did not receive request" )
375377 end ,
376378
377379 % % MQTT 5.0 to AMQP 1.0
@@ -420,7 +422,7 @@ amqp_mqtt(Qos, Config) ->
420422 <<" sender" >>,
421423 rabbitmq_amqp_address :exchange (<<" amq.topic" >>, <<" my.topic" >>)),
422424 receive {amqp10_event , {link , Sender , credited }} -> ok
423- after 2000 -> ct :fail (credited_timeout )
425+ after ? TIMEOUT -> ct :fail (credited_timeout )
424426 end ,
425427
426428 % % single amqp-value section
@@ -463,28 +465,28 @@ amqp_mqtt(Qos, Config) ->
463465 false ->
464466 ok
465467 end
466- after 5000 -> ct :fail ({missing_publish , ? LINE })
468+ after ? TIMEOUT -> ct :fail ({missing_publish , ? LINE })
467469 end ,
468470 receive {publish , #{payload := Payload2 }} ->
469471 ? assertEqual ([Body2 ], amqp10_framing :decode_bin (Payload2 ))
470- after 5000 -> ct :fail ({missing_publish , ? LINE })
472+ after ? TIMEOUT -> ct :fail ({missing_publish , ? LINE })
471473 end ,
472474 receive {publish , #{payload := Payload3 }} ->
473475 ? assertEqual (Body3 , amqp10_framing :decode_bin (Payload3 ))
474- after 5000 -> ct :fail ({missing_publish , ? LINE })
476+ after ? TIMEOUT -> ct :fail ({missing_publish , ? LINE })
475477 end ,
476478 receive {publish , #{payload := Payload4 }} ->
477479 ? assertEqual (Body4 , amqp10_framing :decode_bin (Payload4 ))
478- after 5000 -> ct :fail ({missing_publish , ? LINE })
480+ after ? TIMEOUT -> ct :fail ({missing_publish , ? LINE })
479481 end ,
480482 receive {publish , #{payload := Payload5 }} ->
481483 ? assertEqual (<<0 , 255 >>, Payload5 )
482- after 5000 -> ct :fail ({missing_publish , ? LINE })
484+ after ? TIMEOUT -> ct :fail ({missing_publish , ? LINE })
483485 end ,
484486 receive {publish , #{payload := Payload6 }} ->
485487 % % We expect that RabbitMQ concatenates the binaries of multiple data sections.
486488 ? assertEqual (<<0 , 1 , 2 , 3 >>, Payload6 )
487- after 5000 -> ct :fail ({missing_publish , ? LINE })
489+ after ? TIMEOUT -> ct :fail ({missing_publish , ? LINE })
488490 end ,
489491
490492 ok = emqtt :disconnect (C ).
@@ -567,7 +569,7 @@ mqtt_stomp_mqtt(Config) ->
567569 'Correlation-Data' := Correlation ,
568570 'User-Property' := UserProp }} = MqttMsg ,
569571 ? assert (lists :member ({<<" x-key" >>, <<" val4" >>}, UserProp ))
570- after 1000 -> ct :fail (" did not receive reply" )
572+ after ? TIMEOUT -> ct :fail (" did not receive reply" )
571573 end ,
572574
573575 ok = emqtt :disconnect (C ).
0 commit comments