fix: license validations is not working

This commit is contained in:
zhongwencool 2023-07-12 14:40:38 +08:00
parent 43866b8e55
commit f40d8318b7
3 changed files with 18 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{application, emqx_enterprise, [
{description, "EMQX Enterprise Edition"},
{vsn, "0.1.1"},
{vsn, "0.1.2"},
{registered, []},
{applications, [
kernel,

View File

@ -35,7 +35,7 @@ desc(Name) ->
ee_delegate(desc, ?EE_SCHEMA_MODULES, Name).
validations() ->
emqx_conf_schema:validations().
emqx_conf_schema:validations() ++ emqx_license_schema:validations().
%%------------------------------------------------------------------------------
%% helpers

View File

@ -193,6 +193,22 @@ t_license_setting(_Config) ->
validate_setting(UpdateRes, Low, High),
?assertEqual(0.5, emqx_config:get([license, connection_low_watermark])),
?assertEqual(0.55, emqx_config:get([license, connection_high_watermark])),
%% update bad setting low >= high
?assertMatch(
{ok, 400, _},
request(post, uri(["license", "setting"]), #{
<<"connection_low_watermark">> => <<"50%">>,
<<"connection_high_watermark">> => <<"50%">>
})
),
?assertMatch(
{ok, 400, _},
request(post, uri(["license", "setting"]), #{
<<"connection_low_watermark">> => <<"51%">>,
<<"connection_high_watermark">> => <<"50%">>
})
),
ok.
validate_setting(Res, ExpectLow, ExpectHigh) ->