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