1616
1717-compile ([export_all , nowarn_export_all ]).
1818
19+ -define (TOUT , 30000 ).
20+
1921suite () ->
2022 [{timetrap , {minutes , 4 }}].
2123
@@ -184,7 +186,7 @@ open_close_connection(Config) ->
184186 {ok , Connection2 } = amqp10_client :open_connection (OpnConf ),
185187 receive
186188 {amqp10_event , {connection , Connection2 , opened }} -> ok
187- after 5000 -> exit (connection_timeout )
189+ after ? TOUT -> exit (connection_timeout )
188190 end ,
189191 ok = amqp10_client :close_connection (Connection2 ),
190192 ok = amqp10_client :close_connection (Connection ).
@@ -201,7 +203,7 @@ open_connection_plain_sasl(Config) ->
201203 {ok , Connection } = amqp10_client :open_connection (OpnConf ),
202204 receive
203205 {amqp10_event , {connection , Connection , opened }} -> ok
204- after 5000 -> exit (connection_timeout )
206+ after ? TOUT -> exit (connection_timeout )
205207 end ,
206208 ok = amqp10_client :close_connection (Connection ).
207209
@@ -225,7 +227,7 @@ open_connection_plain_sasl_parse_uri(Config) ->
225227 {ok , Connection } = amqp10_client :open_connection (OpnConf ),
226228 receive
227229 {amqp10_event , {connection , Connection , opened }} -> ok
228- after 5000 -> exit (connection_timeout )
230+ after ? TOUT -> exit (connection_timeout )
229231 end ,
230232 ok = amqp10_client :close_connection (Connection ).
231233
@@ -245,7 +247,7 @@ open_connection_plain_sasl_failure(Config) ->
245247 % some implementation may simply close the tcp_connection
246248 {amqp10_event , {connection , Connection , {closed , shutdown }}} -> ok
247249
248- after 5000 ->
250+ after ? TOUT ->
249251 ct :pal (" Connection process is alive? = ~tp~n " ,
250252 [erlang :is_process_alive (Connection )]),
251253 exit (connection_timeout )
@@ -469,27 +471,27 @@ notify_with_performative(Config) ->
469471
470472 {ok , Connection } = amqp10_client :open_connection (OpenConf ),
471473 receive {amqp10_event , {connection , Connection , {opened , # 'v1_0.open' {}}}} -> ok
472- after 5000 -> ct :fail ({missing_event , ? LINE })
474+ after ? TOUT -> ct :fail ({missing_event , ? LINE })
473475 end ,
474476
475477 {ok , Session1 } = amqp10_client :begin_session (Connection ),
476478 receive {amqp10_event , {session , Session1 , {begun , # 'v1_0.begin' {}}}} -> ok
477- after 5000 -> ct :fail ({missing_event , ? LINE })
479+ after ? TOUT -> ct :fail ({missing_event , ? LINE })
478480 end ,
479481
480482 {ok , Sender1 } = amqp10_client :attach_sender_link (Session1 , <<" sender 1" >>, <<" /exchanges/amq.fanout" >>),
481483 receive {amqp10_event , {link , Sender1 , {attached , # 'v1_0.attach' {}}}} -> ok
482- after 5000 -> ct :fail ({missing_event , ? LINE })
484+ after ? TOUT -> ct :fail ({missing_event , ? LINE })
483485 end ,
484486
485487 ok = amqp10_client :detach_link (Sender1 ),
486488 receive {amqp10_event , {link , Sender1 , {detached , # 'v1_0.detach' {}}}} -> ok
487- after 5000 -> ct :fail ({missing_event , ? LINE })
489+ after ? TOUT -> ct :fail ({missing_event , ? LINE })
488490 end ,
489491
490492 ok = amqp10_client :end_session (Session1 ),
491493 receive {amqp10_event , {session , Session1 , {ended , # 'v1_0.end' {}}}} -> ok
492- after 5000 -> ct :fail ({missing_event , ? LINE })
494+ after ? TOUT -> ct :fail ({missing_event , ? LINE })
493495 end ,
494496
495497 % % Test that the amqp10_client:*_sync functions work.
@@ -501,7 +503,7 @@ notify_with_performative(Config) ->
501503
502504 ok = amqp10_client :close_connection (Connection ),
503505 receive {amqp10_event , {connection , Connection , {closed , # 'v1_0.close' {}}}} -> ok
504- after 5000 -> ct :fail ({missing_event , ? LINE })
506+ after ? TOUT -> ct :fail ({missing_event , ? LINE })
505507 end .
506508
507509% a message is sent before the link attach is guaranteed to
@@ -600,13 +602,13 @@ subscribe(Config) ->
600602 [begin
601603 receive {amqp10_msg , Receiver , Msg } ->
602604 ok = amqp10_client :accept_msg (Receiver , Msg )
603- after 2000 -> ct :fail (timeout )
605+ after ? TOUT -> ct :fail (timeout )
604606 end
605607 end || _ <- lists :seq (1 , 10 )],
606608 ok = assert_no_message (Receiver ),
607609
608610 receive {amqp10_event , {link , Receiver , credit_exhausted }} -> ok
609- after 5000 -> flush (),
611+ after ? TOUT -> flush (),
610612 exit (credit_exhausted_assert )
611613 end ,
612614
@@ -854,7 +856,7 @@ multi_transfer_without_delivery_id(Config) ->
854856 receive
855857 {amqp10_msg , Receiver , _InMsg } ->
856858 ok
857- after 2000 ->
859+ after ? TOUT ->
858860 exit (delivery_timeout )
859861 end ,
860862
@@ -909,7 +911,7 @@ incoming_heartbeat(Config) ->
909911 {closed , _ }}}
910912 when Connection0 =:= Connection ->
911913 ok
912- after 5000 ->
914+ after ? TOUT ->
913915 exit (incoming_heartbeat_assert )
914916 end ,
915917 demonitor (MockRef ).
@@ -926,7 +928,7 @@ await_link(Who, What, Err) ->
926928 {amqp10_event , {link , Who0 , {detached , Why }}}
927929 when Who0 =:= Who ->
928930 ct :fail (Why )
929- after 5000 ->
931+ after ? TOUT ->
930932 flush (),
931933 ct :fail (Err )
932934 end .
@@ -943,7 +945,7 @@ await_disposition(DeliveryTag) ->
943945 receive
944946 {amqp10_disposition , {accepted , DeliveryTag0 }}
945947 when DeliveryTag0 =:= DeliveryTag -> ok
946- after 3000 ->
948+ after ? TOUT ->
947949 flush (),
948950 ct :fail (dispostion_timeout )
949951 end .
@@ -955,7 +957,7 @@ count_received_messages0(Receiver, Count) ->
955957 receive
956958 {amqp10_msg , Receiver , _Msg } ->
957959 count_received_messages0 (Receiver , Count + 1 )
958- after 500 ->
960+ after 5000 ->
959961 Count
960962 end .
961963
@@ -968,7 +970,7 @@ receive_messages0(Receiver, N, Acc) ->
968970 receive
969971 {amqp10_msg , Receiver , Msg } ->
970972 receive_messages0 (Receiver , N - 1 , [Msg | Acc ])
971- after 5000 ->
973+ after ? TOUT ->
972974 LastReceivedMsg = case Acc of
973975 [] -> none ;
974976 [M | _ ] -> M
0 commit comments