@@ -90,20 +90,30 @@ declare_exchanges(Config) ->
9090 ? assertExit (_ , amqp_channel :call (Channel , DeclareErr )).
9191
9292deduplicate_message (Config ) ->
93+ Get = # 'basic.get' {queue = <<" test" >>},
9394 Channel = rabbit_ct_client_helpers :open_channel (Config ),
9495
9596 # 'exchange.declare_ok' {} = amqp_channel :call (
9697 Channel , make_exchange (<<" test" >>, 10 , 10000 )),
9798 bind_new_queue (Channel , <<" test" >>, <<" test" >>),
9899
100+ % % Deduplication header present
99101 publish_message (Channel , <<" test" >>, " deduplicate-this" ),
100102 publish_message (Channel , <<" test" >>, " deduplicate-this" ),
101103
102- timer :sleep (2000 ),
104+ timer :sleep (1000 ),
105+
106+ {# 'basic.get_ok' {}, _ } = amqp_channel :call (Channel , Get ),
107+ # 'basic.get_empty' {} = amqp_channel :call (Channel , Get ),
108+
109+ % % Deduplication header absent
110+ publish_message (Channel , <<" test" >>),
111+ publish_message (Channel , <<" test" >>),
112+
113+ timer :sleep (1000 ),
103114
104- Get = # 'basic.get' {queue = <<" test" >>},
105115 {# 'basic.get_ok' {}, _ } = amqp_channel :call (Channel , Get ),
106- # 'basic.get_empty' { } = amqp_channel :call (Channel , Get ).
116+ { # 'basic.get_ok' {}, _ } = amqp_channel :call (Channel , Get ).
107117
108118deduplicate_message_ttl (Config ) ->
109119 Channel = rabbit_ct_client_helpers :open_channel (Config ),
@@ -131,7 +141,7 @@ deduplicate_message_cache_overflow(Config) ->
131141 publish_message (Channel , <<" test" >>, " deduplicate-that" ),
132142 publish_message (Channel , <<" test" >>, " deduplicate-this" ),
133143
134- timer :sleep (2000 ),
144+ timer :sleep (1000 ),
135145
136146 Get = # 'basic.get' {queue = <<" test" >>},
137147 {# 'basic.get_ok' {}, _ } = amqp_channel :call (Channel , Get ),
@@ -156,6 +166,11 @@ bind_new_queue(Ch, Ex, Q) ->
156166 Binding = # 'queue.bind' {queue = Q , exchange = Ex , routing_key = <<" #" >>},
157167 # 'queue.bind_ok' {} = amqp_channel :call (Ch , Binding ).
158168
169+ publish_message (Ch , Ex ) ->
170+ Publish = # 'basic.publish' {exchange = Ex , routing_key = <<" #" >>},
171+ Msg = # amqp_msg {payload = <<" payload" >>},
172+ amqp_channel :cast (Ch , Publish , Msg ).
173+
159174publish_message (Ch , Ex , D ) ->
160175 Publish = # 'basic.publish' {exchange = Ex , routing_key = <<" #" >>},
161176 Props = # 'P_basic' {headers = [{<<" x-deduplication-header" >>, longstr , D }]},
0 commit comments