16
16
17
17
-compile ([export_all , nowarn_export_all ]).
18
18
19
+ -define (TOUT , 30000 ).
20
+
19
21
suite () ->
20
22
[{timetrap , {minutes , 4 }}].
21
23
@@ -184,7 +186,7 @@ open_close_connection(Config) ->
184
186
{ok , Connection2 } = amqp10_client :open_connection (OpnConf ),
185
187
receive
186
188
{amqp10_event , {connection , Connection2 , opened }} -> ok
187
- after 5000 -> exit (connection_timeout )
189
+ after ? TOUT -> exit (connection_timeout )
188
190
end ,
189
191
ok = amqp10_client :close_connection (Connection2 ),
190
192
ok = amqp10_client :close_connection (Connection ).
@@ -201,7 +203,7 @@ open_connection_plain_sasl(Config) ->
201
203
{ok , Connection } = amqp10_client :open_connection (OpnConf ),
202
204
receive
203
205
{amqp10_event , {connection , Connection , opened }} -> ok
204
- after 5000 -> exit (connection_timeout )
206
+ after ? TOUT -> exit (connection_timeout )
205
207
end ,
206
208
ok = amqp10_client :close_connection (Connection ).
207
209
@@ -225,7 +227,7 @@ open_connection_plain_sasl_parse_uri(Config) ->
225
227
{ok , Connection } = amqp10_client :open_connection (OpnConf ),
226
228
receive
227
229
{amqp10_event , {connection , Connection , opened }} -> ok
228
- after 5000 -> exit (connection_timeout )
230
+ after ? TOUT -> exit (connection_timeout )
229
231
end ,
230
232
ok = amqp10_client :close_connection (Connection ).
231
233
@@ -245,7 +247,7 @@ open_connection_plain_sasl_failure(Config) ->
245
247
% some implementation may simply close the tcp_connection
246
248
{amqp10_event , {connection , Connection , {closed , shutdown }}} -> ok
247
249
248
- after 5000 ->
250
+ after ? TOUT ->
249
251
ct :pal (" Connection process is alive? = ~tp~n " ,
250
252
[erlang :is_process_alive (Connection )]),
251
253
exit (connection_timeout )
@@ -469,27 +471,27 @@ notify_with_performative(Config) ->
469
471
470
472
{ok , Connection } = amqp10_client :open_connection (OpenConf ),
471
473
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 })
473
475
end ,
474
476
475
477
{ok , Session1 } = amqp10_client :begin_session (Connection ),
476
478
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 })
478
480
end ,
479
481
480
482
{ok , Sender1 } = amqp10_client :attach_sender_link (Session1 , <<" sender 1" >>, <<" /exchanges/amq.fanout" >>),
481
483
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 })
483
485
end ,
484
486
485
487
ok = amqp10_client :detach_link (Sender1 ),
486
488
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 })
488
490
end ,
489
491
490
492
ok = amqp10_client :end_session (Session1 ),
491
493
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 })
493
495
end ,
494
496
495
497
% % Test that the amqp10_client:*_sync functions work.
@@ -501,7 +503,7 @@ notify_with_performative(Config) ->
501
503
502
504
ok = amqp10_client :close_connection (Connection ),
503
505
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 })
505
507
end .
506
508
507
509
% a message is sent before the link attach is guaranteed to
@@ -600,13 +602,13 @@ subscribe(Config) ->
600
602
[begin
601
603
receive {amqp10_msg , Receiver , Msg } ->
602
604
ok = amqp10_client :accept_msg (Receiver , Msg )
603
- after 2000 -> ct :fail (timeout )
605
+ after ? TOUT -> ct :fail (timeout )
604
606
end
605
607
end || _ <- lists :seq (1 , 10 )],
606
608
ok = assert_no_message (Receiver ),
607
609
608
610
receive {amqp10_event , {link , Receiver , credit_exhausted }} -> ok
609
- after 5000 -> flush (),
611
+ after ? TOUT -> flush (),
610
612
exit (credit_exhausted_assert )
611
613
end ,
612
614
@@ -854,7 +856,7 @@ multi_transfer_without_delivery_id(Config) ->
854
856
receive
855
857
{amqp10_msg , Receiver , _InMsg } ->
856
858
ok
857
- after 2000 ->
859
+ after ? TOUT ->
858
860
exit (delivery_timeout )
859
861
end ,
860
862
@@ -909,7 +911,7 @@ incoming_heartbeat(Config) ->
909
911
{closed , _ }}}
910
912
when Connection0 =:= Connection ->
911
913
ok
912
- after 5000 ->
914
+ after ? TOUT ->
913
915
exit (incoming_heartbeat_assert )
914
916
end ,
915
917
demonitor (MockRef ).
@@ -926,7 +928,7 @@ await_link(Who, What, Err) ->
926
928
{amqp10_event , {link , Who0 , {detached , Why }}}
927
929
when Who0 =:= Who ->
928
930
ct :fail (Why )
929
- after 5000 ->
931
+ after ? TOUT ->
930
932
flush (),
931
933
ct :fail (Err )
932
934
end .
@@ -943,7 +945,7 @@ await_disposition(DeliveryTag) ->
943
945
receive
944
946
{amqp10_disposition , {accepted , DeliveryTag0 }}
945
947
when DeliveryTag0 =:= DeliveryTag -> ok
946
- after 3000 ->
948
+ after ? TOUT ->
947
949
flush (),
948
950
ct :fail (dispostion_timeout )
949
951
end .
@@ -955,7 +957,7 @@ count_received_messages0(Receiver, Count) ->
955
957
receive
956
958
{amqp10_msg , Receiver , _Msg } ->
957
959
count_received_messages0 (Receiver , Count + 1 )
958
- after 500 ->
960
+ after 5000 ->
959
961
Count
960
962
end .
961
963
@@ -968,7 +970,7 @@ receive_messages0(Receiver, N, Acc) ->
968
970
receive
969
971
{amqp10_msg , Receiver , Msg } ->
970
972
receive_messages0 (Receiver , N - 1 , [Msg | Acc ])
971
- after 5000 ->
973
+ after ? TOUT ->
972
974
LastReceivedMsg = case Acc of
973
975
[] -> none ;
974
976
[M | _ ] -> M
0 commit comments