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 }].
@@ -738,28 +739,28 @@ pubsub(Config) ->
738739 receive {publish , #{client_pid := C1 ,
739740 qos := 1 ,
740741 payload := <<" m1" >>}} -> ok
741- after 1000 -> ct :fail (" missing m1" )
742+ after ? TIMEOUT -> ct :fail (" missing m1" )
742743 end ,
743744
744745 ok = emqtt :publish (C0 , Topic1 , <<" m2" >>, qos0 ),
745746 receive {publish , #{client_pid := C1 ,
746747 qos := 0 ,
747748 payload := <<" m2" >>}} -> ok
748- after 1000 -> ct :fail (" missing m2" )
749+ after ? TIMEOUT -> ct :fail (" missing m2" )
749750 end ,
750751
751752 {ok , _ } = emqtt :publish (C1 , Topic0 , <<" m3" >>, qos1 ),
752753 receive {publish , #{client_pid := C0 ,
753754 qos := 1 ,
754755 payload := <<" m3" >>}} -> ok
755- after 1000 -> ct :fail (" missing m3" )
756+ after ? TIMEOUT -> ct :fail (" missing m3" )
756757 end ,
757758
758759 ok = emqtt :publish (C1 , Topic0 , <<" m4" >>, qos0 ),
759760 receive {publish , #{client_pid := C0 ,
760761 qos := 0 ,
761762 payload := <<" m4" >>}} -> ok
762- after 1000 -> ct :fail (" missing m4" )
763+ after ? TIMEOUT -> ct :fail (" missing m4" )
763764 end ,
764765
765766 ok = emqtt :disconnect (C0 ),
@@ -1130,7 +1131,7 @@ many_qos1_messages(Config) ->
11301131 end , Payloads ),
11311132 receive
11321133 proceed -> ok
1133- after 30000 ->
1134+ after ? TIMEOUT ->
11341135 ct :fail (" message to proceed never received" )
11351136 end ,
11361137 ok = expect_publishes (C , Topic , Payloads ),
@@ -1383,7 +1384,7 @@ keepalive(Config) ->
13831384 retain := true ,
13841385 topic := WillTopic ,
13851386 payload := WillPayload }} -> ok
1386- after 3000 -> ct :fail (" missing will" )
1387+ after ? TIMEOUT -> ct :fail (" missing will" )
13871388 end ,
13881389 ok = emqtt :disconnect (C2 ).
13891390
@@ -1453,7 +1454,7 @@ session_switch(Config, Disconnect) ->
14531454 receive {publish , #{client_pid := C2 ,
14541455 payload := <<" m1" >>,
14551456 qos := 0 }} -> ok
1456- after 1000 -> ct :fail (" did not receive m1 with QoS 0" )
1457+ after ? TIMEOUT -> ct :fail (" did not receive m1 with QoS 0" )
14571458 end ,
14581459 % % New connection should be able to unsubscribe.
14591460 ? assertMatch ({ok , _ , _ }, emqtt :unsubscribe (C2 , Topic )),
@@ -1521,7 +1522,7 @@ block_only_publisher(Config) ->
15211522 ok = expect_publishes (Sub , Topic , [<<" from Con 1" >>]),
15221523 % % But now the new publisher should be blocked as well.
15231524 ? assertEqual ({error , ack_timeout }, emqtt :ping (Con )),
1524- ? assertEqual (puback_timeout , publish_qos1_timeout (Con , Topic , <<" from Con 2" >>, 500 )) ,
1525+ ? assertEqual (puback_timeout , publish_qos1_timeout (Con , Topic , <<" from Con 2" >>, 500 ),
15251526 ? assertEqual (pong , emqtt :ping (Sub )),
15261527
15271528 rpc (Config , vm_memory_monitor , set_vm_memory_high_watermark , [0.6 ]),
@@ -1720,7 +1721,7 @@ max_packet_size_authenticated(Config) ->
17201721 v4 -> ok ;
17211722 v5 -> ? assertMatch (#{'Maximum-Packet-Size' := MaxSize }, ConnAckProps ),
17221723 receive {disconnected , _ReasonCodePacketTooLarge = 149 , _Props } -> ok
1723- after 1000 -> ct :fail (" missing DISCONNECT packet from server" )
1724+ after ? TIMEOUT -> ct :fail (" missing DISCONNECT packet from server" )
17241725 end
17251726 end ,
17261727 ok = rpc (Config , persistent_term , put , [Key , OldMaxSize ]).
@@ -1805,7 +1806,7 @@ incoming_message_interceptors(Config) ->
18051806 headers = [{<<" timestamp_in_ms" >>, long , Millis } | _XHeaders ]
18061807 }}} ->
18071808 ok
1808- after 5000 -> ct :fail (missing_deliver )
1809+ after ? TIMEOUT -> ct :fail (missing_deliver )
18091810 end ,
18101811
18111812 delete_queue (Ch , Stream ),
@@ -1831,7 +1832,7 @@ retained_message_conversion(Config) ->
18311832 retain := true ,
18321833 topic := Topic ,
18331834 payload := Payload }} -> ok
1834- after 1000 -> ct :fail (" missing retained message" )
1835+ after ? TIMEOUT -> ct :fail (" missing retained message" )
18351836 end ,
18361837 ok = emqtt :publish (C , Topic , <<>>, [{retain , true }]),
18371838 ok = emqtt :disconnect (C ).
@@ -1917,7 +1918,7 @@ await_confirms_ordered(From, N, To) ->
19171918 await_confirms_ordered (From , N + 1 , To );
19181919 Got ->
19191920 ct :fail (" Received unexpected message. Expected: ~p Got: ~p " , [Expected , Got ])
1920- after 10_000 ->
1921+ after ? TIMEOUT ->
19211922 ct :fail (" Did not receive expected message: ~p " , [Expected ])
19221923 end .
19231924
@@ -1929,7 +1930,7 @@ await_confirms_unordered(From, Left) ->
19291930 await_confirms_unordered (From , Left - 1 );
19301931 Other ->
19311932 ct :fail (" Received unexpected message: ~p " , [Other ])
1932- after 10_000 ->
1933+ after ? TIMEOUT ->
19331934 ct :fail (" ~b confirms are missing" , [Left ])
19341935 end .
19351936
@@ -1976,6 +1977,6 @@ assert_v5_disconnect_reason_code(Config, ReasonCode) ->
19761977 v3 -> ok ;
19771978 v4 -> ok ;
19781979 v5 -> receive {disconnected , ReasonCode , _Props } -> ok
1979- after 1000 -> ct :fail (" missing DISCONNECT packet from server" )
1980+ after ? TIMEOUT -> ct :fail (" missing DISCONNECT packet from server" )
19801981 end
19811982 end .
0 commit comments