@@ -71,6 +71,7 @@ cluster_size_1_tests() ->
71
71
session_expiry_reconnect_non_zero ,
72
72
session_expiry_reconnect_zero ,
73
73
session_expiry_reconnect_infinity_to_zero ,
74
+ zero_session_expiry_disconnect_autodeletes_qos0_queue ,
74
75
client_publish_qos2 ,
75
76
client_rejects_publish ,
76
77
client_receive_maximum_min ,
@@ -188,6 +189,12 @@ init_per_testcase(T, Config)
188
189
ok = rpc (Config , application , set_env , [? APP , Par , infinity ]),
189
190
Config1 = rabbit_ct_helpers :set_config (Config , {Par , Default }),
190
191
init_per_testcase0 (T , Config1 );
192
+
193
+ init_per_testcase (T , Config )
194
+ when T =:= zero_session_expiry_disconnect_autodeletes_qos0_queue ->
195
+ rpc (Config , rabbit_registry , register , [queue , <<" qos0" >>, rabbit_mqtt_qos0_queue ]),
196
+ init_per_testcase0 (T , Config );
197
+
191
198
init_per_testcase (T , Config ) ->
192
199
init_per_testcase0 (T , Config ).
193
200
@@ -202,6 +209,11 @@ end_per_testcase(T, Config)
202
209
Default = ? config (Par , Config ),
203
210
ok = rpc (Config , application , set_env , [? APP , Par , Default ]),
204
211
end_per_testcase0 (T , Config );
212
+ end_per_testcase (T , Config )
213
+ when T =:= zero_session_expiry_disconnect_autodeletes_qos0_queue ->
214
+ ok = rpc (Config , rabbit_registry , unregister , [queue , <<" qos0" >>]),
215
+ init_per_testcase0 (T , Config );
216
+
205
217
end_per_testcase (T , Config ) ->
206
218
end_per_testcase0 (T , Config ).
207
219
@@ -389,6 +401,22 @@ session_expiry_quorum_queue_disconnect_decrease(Config) ->
389
401
ok = session_expiry_disconnect_decrease (rabbit_quorum_queue , Config ),
390
402
ok = rpc (Config , application , unset_env , [? APP , durable_queue_type ]).
391
403
404
+ zero_session_expiry_disconnect_autodeletes_qos0_queue (Config ) ->
405
+ ClientId = ? FUNCTION_NAME ,
406
+ C = connect (ClientId , Config , [
407
+ {clean_start , false },
408
+ {properties , #{'Session-Expiry-Interval' => 0 }}]),
409
+ {ok , _ , _ } = emqtt :subscribe (C , <<" topic0" >>, qos0 ),
410
+ QsQos0 = rpc (Config , rabbit_amqqueue , list_by_type , [rabbit_mqtt_qos0_queue ]),
411
+ ? assertEqual (1 , length (QsQos0 )),
412
+
413
+ ok = emqtt :disconnect (C ),
414
+ % % After terminating a clean session, we expect any session state to be cleaned up on the server.
415
+ % % Give the node some time to clean up the MQTT QoS 0 queue.
416
+ timer :sleep (200 ),
417
+ L = rpc (Config , rabbit_amqqueue , list , []),
418
+ ? assertEqual (0 , length (L )).
419
+
392
420
session_expiry_disconnect_decrease (QueueType , Config ) ->
393
421
ClientId = ? FUNCTION_NAME ,
394
422
C1 = connect (ClientId , Config , [{properties , #{'Session-Expiry-Interval' => 100 }}]),
0 commit comments