fix: only set default for max_conn_rate and update test case

This revert the change in commit e291dcd for all listener "short
path fields" except the field max_conn_rate so they no longer have a
default value. It also updates a test case that assume that no listener
config is created by default but this is no longer the case when there
is a default value for the max_conn_rate field.
This commit is contained in:
Kjell Winblad 2024-07-04 14:32:10 +02:00
parent 82bb03a2a3
commit d206d24975
2 changed files with 21 additions and 9 deletions

View File

@ -212,17 +212,29 @@ short_paths_fields() ->
short_paths_fields(Importance) ->
[
{Name,
?HOCON(rate_type(), #{
?HOCON(
rate_type(),
maps:merge(
#{
desc => ?DESC(Name),
required => false,
default => infinity,
importance => Importance,
example => Example
})}
},
short_paths_fields_extra(Name)
)
)}
|| {Name, Example} <-
lists:zip(short_paths(), [<<"1000/s">>, <<"1000/s">>, <<"100MB/s">>])
].
short_paths_fields_extra(max_conn_rate) ->
#{
default => infinity
};
short_paths_fields_extra(_Name) ->
#{}.
desc(limiter) ->
"Settings for the rate limiter.";
desc(node_opts) ->

View File

@ -816,8 +816,8 @@ t_no_limiter_for_listener(_) ->
CfgStr = <<>>,
ok = emqx_common_test_helpers:load_config(emqx_schema, CfgStr),
ListenerOpt = emqx:get_config([listeners, tcp, default]),
?assertEqual(
undefined,
?assertMatch(
#{connection := #{rate := infinity}},
emqx_limiter_utils:get_listener_opts(ListenerOpt)
).