test(retainer): add test case for stopping publish clear msg

This commit is contained in:
JianBo He 2021-12-03 14:42:27 +08:00
parent 4b3b29873a
commit f645a4eada
1 changed files with 15 additions and 0 deletions

View File

@ -195,6 +195,21 @@ t_clean(_) ->
ok = emqtt:disconnect(C1). ok = emqtt:disconnect(C1).
t_stop_publish_clear_msg(_) ->
emqx_retainer:update_config(#{<<"stop_publish_clear_msg">> => true}),
{ok, C1} = emqtt:start_link([{clean_start, true}, {proto_ver, v5}]),
{ok, _} = emqtt:connect(C1),
emqtt:publish(C1, <<"retained/0">>, <<"this is a retained message 0">>, [{qos, 0}, {retain, true}]),
{ok, #{}, [0]} = emqtt:subscribe(C1, <<"retained/#">>, [{qos, 0}, {rh, 0}]),
?assertEqual(1, length(receive_messages(1))),
emqtt:publish(C1, <<"retained/0">>, <<"">>, [{qos, 0}, {retain, true}]),
?assertEqual(0, length(receive_messages(1))),
emqx_retainer:update_config(#{<<"stop_publish_clear_msg">> => false}),
ok = emqtt:disconnect(C1).
t_flow_control(_) -> t_flow_control(_) ->
emqx_retainer:update_config(#{<<"flow_control">> => #{<<"max_read_number">> => 1, emqx_retainer:update_config(#{<<"flow_control">> => #{<<"max_read_number">> => 1,
<<"msg_deliver_quota">> => 1, <<"msg_deliver_quota">> => 1,