5353-define (RC_SERVER_SHUTTING_DOWN , 16#8B ).
5454-define (RC_KEEP_ALIVE_TIMEOUT , 16#8D ).
5555-define (RC_SESSION_TAKEN_OVER , 16#8E ).
56+ -define (TIMEOUT , 30_000 ).
5657
5758all () ->
5859 [{group , mqtt }].
@@ -340,7 +341,7 @@ quorum_queue_rejects(Config) ->
340341 V = ? config (mqtt_version , Config ),
341342 if V =:= v3 orelse V =:= v4 ->
342343 % % v3 and v4 do not support NACKs. Therefore, the server should drop the message.
343- ? assertEqual (puback_timeout , util :publish_qos1_timeout (C , Name , <<" m3" >>, 700 ));
344+ ? assertEqual (puback_timeout , util :publish_qos1_timeout (C , Name , <<" m3" >>, 30_000 ));
344345 V =:= v5 ->
345346 % % v5 supports NACKs. Therefore, the server should send us a NACK.
346347 ? assertMatch ({ok , #{reason_code_name := implementation_specific_error }},
@@ -719,28 +720,28 @@ pubsub(Config) ->
719720 receive {publish , #{client_pid := C1 ,
720721 qos := 1 ,
721722 payload := <<" m1" >>}} -> ok
722- after 1000 -> ct :fail (" missing m1" )
723+ after ? TIMEOUT -> ct :fail (" missing m1" )
723724 end ,
724725
725726 ok = emqtt :publish (C0 , Topic1 , <<" m2" >>, qos0 ),
726727 receive {publish , #{client_pid := C1 ,
727728 qos := 0 ,
728729 payload := <<" m2" >>}} -> ok
729- after 1000 -> ct :fail (" missing m2" )
730+ after ? TIMEOUT -> ct :fail (" missing m2" )
730731 end ,
731732
732733 {ok , _ } = emqtt :publish (C1 , Topic0 , <<" m3" >>, qos1 ),
733734 receive {publish , #{client_pid := C0 ,
734735 qos := 1 ,
735736 payload := <<" m3" >>}} -> ok
736- after 1000 -> ct :fail (" missing m3" )
737+ after ? TIMEOUT -> ct :fail (" missing m3" )
737738 end ,
738739
739740 ok = emqtt :publish (C1 , Topic0 , <<" m4" >>, qos0 ),
740741 receive {publish , #{client_pid := C0 ,
741742 qos := 0 ,
742743 payload := <<" m4" >>}} -> ok
743- after 1000 -> ct :fail (" missing m4" )
744+ after ? TIMEOUT -> ct :fail (" missing m4" )
744745 end ,
745746
746747 ok = emqtt :disconnect (C0 ),
@@ -758,7 +759,7 @@ queue_down_qos1(Config) ->
758759 % % classic queue is down, therefore message is rejected
759760 V = ? config (mqtt_version , Config ),
760761 if V =:= v3 orelse V =:= v4 ->
761- ? assertEqual (puback_timeout , util :publish_qos1_timeout (C , Topic , <<" msg" >>, 500 )),
762+ ? assertEqual (puback_timeout , util :publish_qos1_timeout (C , Topic , <<" msg" >>, 30_000 )),
762763 ok = rabbit_ct_broker_helpers :start_node (Config , 1 ),
763764 % % Classic queue is up. Therefore, message should arrive.
764765 eventually (? _assertEqual ([[<<" 1" >>]],
@@ -1111,7 +1112,7 @@ many_qos1_messages(Config) ->
11111112 end , Payloads ),
11121113 receive
11131114 proceed -> ok
1114- after 30000 ->
1115+ after ? TIMEOUT ->
11151116 ct :fail (" message to proceed never received" )
11161117 end ,
11171118 ok = expect_publishes (C , Topic , Payloads ),
@@ -1364,7 +1365,7 @@ keepalive(Config) ->
13641365 retain := true ,
13651366 topic := WillTopic ,
13661367 payload := WillPayload }} -> ok
1367- after 3000 -> ct :fail (" missing will" )
1368+ after ? TIMEOUT -> ct :fail (" missing will" )
13681369 end ,
13691370 ok = emqtt :disconnect (C2 ).
13701371
@@ -1434,7 +1435,7 @@ session_switch(Config, Disconnect) ->
14341435 receive {publish , #{client_pid := C2 ,
14351436 payload := <<" m1" >>,
14361437 qos := 0 }} -> ok
1437- after 1000 -> ct :fail (" did not receive m1 with QoS 0" )
1438+ after ? TIMEOUT -> ct :fail (" did not receive m1 with QoS 0" )
14381439 end ,
14391440 % % New connection should be able to unsubscribe.
14401441 ? assertMatch ({ok , _ , _ }, emqtt :unsubscribe (C2 , Topic )),
@@ -1460,8 +1461,8 @@ block(Config) ->
14601461 timer :sleep (100 ),
14611462
14621463 % % Blocked, but still will publish when unblocked
1463- puback_timeout = publish_qos1_timeout (C , Topic , <<" Now blocked" >>, 1000 ),
1464- puback_timeout = publish_qos1_timeout (C , Topic , <<" Still blocked" >>, 1000 ),
1464+ puback_timeout = publish_qos1_timeout (C , Topic , <<" Now blocked" >>, 30_000 ),
1465+ puback_timeout = publish_qos1_timeout (C , Topic , <<" Still blocked" >>, 30_000 ),
14651466
14661467 % % Unblock
14671468 rpc (Config , vm_memory_monitor , set_vm_memory_high_watermark , [0.6 ]),
@@ -1502,7 +1503,7 @@ block_only_publisher(Config) ->
15021503 ok = expect_publishes (Sub , Topic , [<<" from Con 1" >>]),
15031504 % % But now the new publisher should be blocked as well.
15041505 ? assertEqual ({error , ack_timeout }, emqtt :ping (Con )),
1505- ? assertEqual (puback_timeout , publish_qos1_timeout (Con , Topic , <<" from Con 2" >>, 500 )),
1506+ ? assertEqual (puback_timeout , publish_qos1_timeout (Con , Topic , <<" from Con 2" >>, 30_000 )),
15061507 ? assertEqual (pong , emqtt :ping (Sub )),
15071508
15081509 rpc (Config , vm_memory_monitor , set_vm_memory_high_watermark , [0.6 ]),
@@ -1701,7 +1702,7 @@ max_packet_size_authenticated(Config) ->
17011702 v4 -> ok ;
17021703 v5 -> ? assertMatch (#{'Maximum-Packet-Size' := MaxSize }, ConnAckProps ),
17031704 receive {disconnected , _ReasonCodePacketTooLarge = 149 , _Props } -> ok
1704- after 1000 -> ct :fail (" missing DISCONNECT packet from server" )
1705+ after ? TIMEOUT -> ct :fail (" missing DISCONNECT packet from server" )
17051706 end
17061707 end ,
17071708 ok = rpc (Config , persistent_term , put , [Key , OldMaxSize ]).
@@ -1786,7 +1787,7 @@ incoming_message_interceptors(Config) ->
17861787 headers = [{<<" timestamp_in_ms" >>, long , Millis } | _XHeaders ]
17871788 }}} ->
17881789 ok
1789- after 5000 -> ct :fail (missing_deliver )
1790+ after ? TIMEOUT -> ct :fail (missing_deliver )
17901791 end ,
17911792
17921793 delete_queue (Ch , Stream ),
@@ -1812,7 +1813,7 @@ retained_message_conversion(Config) ->
18121813 retain := true ,
18131814 topic := Topic ,
18141815 payload := Payload }} -> ok
1815- after 1000 -> ct :fail (" missing retained message" )
1816+ after ? TIMEOUT -> ct :fail (" missing retained message" )
18161817 end ,
18171818 ok = emqtt :publish (C , Topic , <<>>, [{retain , true }]),
18181819 ok = emqtt :disconnect (C ).
@@ -1898,7 +1899,7 @@ await_confirms_ordered(From, N, To) ->
18981899 await_confirms_ordered (From , N + 1 , To );
18991900 Got ->
19001901 ct :fail (" Received unexpected message. Expected: ~p Got: ~p " , [Expected , Got ])
1901- after 10_000 ->
1902+ after ? TIMEOUT ->
19021903 ct :fail (" Did not receive expected message: ~p " , [Expected ])
19031904 end .
19041905
@@ -1910,7 +1911,7 @@ await_confirms_unordered(From, Left) ->
19101911 await_confirms_unordered (From , Left - 1 );
19111912 Other ->
19121913 ct :fail (" Received unexpected message: ~p " , [Other ])
1913- after 10_000 ->
1914+ after ? TIMEOUT ->
19141915 ct :fail (" ~b confirms are missing" , [Left ])
19151916 end .
19161917
@@ -1957,6 +1958,6 @@ assert_v5_disconnect_reason_code(Config, ReasonCode) ->
19571958 v3 -> ok ;
19581959 v4 -> ok ;
19591960 v5 -> receive {disconnected , ReasonCode , _Props } -> ok
1960- after 1000 -> ct :fail (" missing DISCONNECT packet from server" )
1961+ after ? TIMEOUT -> ct :fail (" missing DISCONNECT packet from server" )
19611962 end
19621963 end .
0 commit comments