fix(test): update the testcases for emqx_channel_SUITE
This commit is contained in:
parent
868b31d123
commit
871353704a
|
@ -879,7 +879,7 @@ zones.default {
|
|||
## Maximum MQTT packet size allowed.
|
||||
##
|
||||
## @doc zones.<name>.mqtt.max_packet_size
|
||||
## ValueType: Bytes | infinity
|
||||
## ValueType: Bytes
|
||||
## Default: 1MB
|
||||
max_packet_size: 1MB
|
||||
|
||||
|
|
|
@ -193,8 +193,8 @@ stats(#channel{session = Session})->
|
|||
emqx_session:stats(Session).
|
||||
|
||||
-spec(caps(channel()) -> emqx_types:caps()).
|
||||
caps(#channel{clientinfo = #{zone := Zone}}) ->
|
||||
emqx_mqtt_caps:get_caps(Zone).
|
||||
caps(#channel{clientinfo = #{zone := Zone, listener := Listener}}) ->
|
||||
emqx_mqtt_caps:get_caps(Zone, Listener).
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
|
@ -1193,8 +1193,8 @@ run_conn_hooks(ConnPkt, Channel = #channel{conninfo = ConnInfo}) ->
|
|||
%%--------------------------------------------------------------------
|
||||
%% Check Connect Packet
|
||||
|
||||
check_connect(ConnPkt, #channel{clientinfo = #{zone := Zone}}) ->
|
||||
emqx_packet:check(ConnPkt, emqx_mqtt_caps:get_caps(Zone)).
|
||||
check_connect(ConnPkt, #channel{clientinfo = #{zone := Zone, listener := Listener}}) ->
|
||||
emqx_packet:check(ConnPkt, emqx_mqtt_caps:get_caps(Zone, Listener)).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Enrich Client Info
|
||||
|
@ -1434,8 +1434,8 @@ check_pub_caps(#mqtt_packet{header = #mqtt_packet_header{qos = QoS,
|
|||
retain = Retain},
|
||||
variable = #mqtt_packet_publish{topic_name = Topic}
|
||||
},
|
||||
#channel{clientinfo = #{zone := Zone}}) ->
|
||||
emqx_mqtt_caps:check_pub(Zone, #{qos => QoS, retain => Retain, topic => Topic}).
|
||||
#channel{clientinfo = #{zone := Zone, listener := Listener}}) ->
|
||||
emqx_mqtt_caps:check_pub(Zone, Listener, #{qos => QoS, retain => Retain, topic => Topic}).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Check Sub ACL
|
||||
|
@ -1463,8 +1463,9 @@ check_sub_acl(TopicFilter, #channel{clientinfo = ClientInfo}) ->
|
|||
%%--------------------------------------------------------------------
|
||||
%% Check Sub Caps
|
||||
|
||||
check_sub_caps(TopicFilter, SubOpts, #channel{clientinfo = #{zone := Zone}}) ->
|
||||
emqx_mqtt_caps:check_sub(Zone, TopicFilter, SubOpts).
|
||||
check_sub_caps(TopicFilter, SubOpts, #channel{clientinfo = #{zone := Zone,
|
||||
listener := Listener}}) ->
|
||||
emqx_mqtt_caps:check_sub(Zone, Listener, TopicFilter, SubOpts).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Enrich SubId
|
||||
|
@ -1486,14 +1487,15 @@ enrich_subopts(SubOpts, #channel{clientinfo = #{zone := Zone, is_bridge := IsBri
|
|||
%%--------------------------------------------------------------------
|
||||
%% Enrich ConnAck Caps
|
||||
|
||||
enrich_connack_caps(AckProps, ?IS_MQTT_V5 = #channel{clientinfo = #{zone := Zone}}) ->
|
||||
enrich_connack_caps(AckProps, ?IS_MQTT_V5 = #channel{clientinfo = #{
|
||||
zone := Zone, listener := Listener}}) ->
|
||||
#{max_packet_size := MaxPktSize,
|
||||
max_qos_allowed := MaxQoS,
|
||||
retain_available := Retain,
|
||||
max_topic_alias := MaxAlias,
|
||||
shared_subscription := Shared,
|
||||
wildcard_subscription := Wildcard
|
||||
} = emqx_mqtt_caps:get_caps(Zone),
|
||||
} = emqx_mqtt_caps:get_caps(Zone, Listener),
|
||||
NAckProps = AckProps#{'Retain-Available' => flag(Retain),
|
||||
'Maximum-Packet-Size' => MaxPktSize,
|
||||
'Topic-Alias-Maximum' => MaxAlias,
|
||||
|
@ -1517,7 +1519,7 @@ enrich_connack_caps(AckProps, _Channel) -> AckProps.
|
|||
|
||||
enrich_server_keepalive(AckProps, #channel{clientinfo = #{zone := Zone, listener := Listener}}) ->
|
||||
case get_mqtt_conf(Zone, Listener, server_keepalive) of
|
||||
undefined -> AckProps;
|
||||
disabled -> AckProps;
|
||||
Keepalive -> AckProps#{'Server-Keep-Alive' => Keepalive}
|
||||
end.
|
||||
|
||||
|
@ -1562,9 +1564,9 @@ ensure_connected(Channel = #channel{conninfo = ConnInfo,
|
|||
|
||||
init_alias_maximum(#mqtt_packet_connect{proto_ver = ?MQTT_PROTO_V5,
|
||||
properties = Properties},
|
||||
#{zone := Zone} = _ClientInfo) ->
|
||||
#{zone := Zone, listener := Listener} = _ClientInfo) ->
|
||||
#{outbound => emqx_mqtt_props:get('Topic-Alias-Maximum', Properties, 0),
|
||||
inbound => emqx_mqtt_caps:get_caps(Zone, max_topic_alias, ?MAX_TOPIC_AlIAS)
|
||||
inbound => maps:get(max_topic_alias, emqx_mqtt_caps:get_caps(Zone, Listener))
|
||||
};
|
||||
init_alias_maximum(_ConnPkt, _ClientInfo) -> undefined.
|
||||
|
||||
|
@ -1579,6 +1581,7 @@ ensure_keepalive(#{'Server-Keep-Alive' := Interval}, Channel = #channel{conninfo
|
|||
ensure_keepalive(_AckProps, Channel = #channel{conninfo = ConnInfo}) ->
|
||||
ensure_keepalive_timer(maps:get(keepalive, ConnInfo), Channel).
|
||||
|
||||
ensure_keepalive_timer(0, Channel) -> Channel;
|
||||
ensure_keepalive_timer(disabled, Channel) -> Channel;
|
||||
ensure_keepalive_timer(Interval, Channel = #channel{clientinfo = #{zone := Zone,
|
||||
listener := Listener}}) ->
|
||||
|
|
|
@ -256,7 +256,7 @@ fields("acl_cache") ->
|
|||
fields("mqtt") ->
|
||||
[ {"mountpoint", t(binary(), undefined, <<>>)}
|
||||
, {"idle_timeout", maybe_infinity(duration(), "15s")}
|
||||
, {"max_packet_size", maybe_infinity(bytesize(), "1MB")}
|
||||
, {"max_packet_size", t(bytesize(), undefined, "1MB")}
|
||||
, {"max_clientid_len", t(integer(), undefined, 65535)}
|
||||
, {"max_topic_levels", t(integer(), undefined, 65535)}
|
||||
, {"max_qos_allowed", t(range(0, 2), undefined, 2)}
|
||||
|
@ -479,7 +479,7 @@ fields("sysmon") ->
|
|||
];
|
||||
|
||||
fields("sysmon_vm") ->
|
||||
[ {"process_check_interval", t(duration_s(), undefined, 30)}
|
||||
[ {"process_check_interval", t(duration(), undefined, "30s")}
|
||||
, {"process_high_watermark", t(percent(), undefined, "80%")}
|
||||
, {"process_low_watermark", t(percent(), undefined, "60%")}
|
||||
, {"long_gc", maybe_disabled(duration())}
|
||||
|
|
|
@ -206,7 +206,8 @@ end_per_suite(_Config) ->
|
|||
emqx_session,
|
||||
emqx_broker,
|
||||
emqx_hooks,
|
||||
emqx_cm
|
||||
emqx_cm,
|
||||
emqx_banned
|
||||
]).
|
||||
|
||||
init_per_testcase(_TestCase, Config) ->
|
||||
|
|
Loading…
Reference in New Issue