From e2f386383d2dd16fba38f2d4781a4f31cdc43a24 Mon Sep 17 00:00:00 2001 From: Zhongwen Deng Date: Fri, 4 Mar 2022 09:13:56 +0800 Subject: [PATCH] fix: replace local ref by remote ref --- apps/emqx/test/emqx_authentication_SUITE.erl | 2 +- apps/emqx/test/emqx_config_handler_SUITE.erl | 4 ++-- apps/emqx_authz/src/emqx_authz_api_schema.erl | 2 +- apps/emqx_authz/src/emqx_authz_api_sources.erl | 2 +- apps/emqx_conf/src/emqx_conf_schema.erl | 10 +++++----- apps/emqx_modules/test/emqx_rewrite_SUITE.erl | 2 +- apps/emqx_plugins/src/emqx_plugins_schema.erl | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/emqx/test/emqx_authentication_SUITE.erl b/apps/emqx/test/emqx_authentication_SUITE.erl index c02685884..77f7e7f9d 100644 --- a/apps/emqx/test/emqx_authentication_SUITE.erl +++ b/apps/emqx/test/emqx_authentication_SUITE.erl @@ -35,7 +35,7 @@ %% Hocon Schema %%------------------------------------------------------------------------------ -roots() -> [{config, #{type => hoconsc:union([hoconsc:ref(type1), hoconsc:ref(type2)])}}]. +roots() -> [{config, #{type => hoconsc:union([hoconsc:ref(?MODULE, type1), hoconsc:ref(?MODULE, type2)])}}]. fields(type1) -> [ {mechanism, {enum, ['password-based']}} diff --git a/apps/emqx/test/emqx_config_handler_SUITE.erl b/apps/emqx/test/emqx_config_handler_SUITE.erl index dc587189a..ca4903e63 100644 --- a/apps/emqx/test/emqx_config_handler_SUITE.erl +++ b/apps/emqx/test/emqx_config_handler_SUITE.erl @@ -101,7 +101,7 @@ t_root_key_update(_Config) -> ?assertEqual("81%", emqx:get_raw_config(SubKey)), %% remove ?assertEqual({error, "remove_root_is_forbidden"}, emqx:remove_config(PathKey)), - ?assertMatch(#{<<"os">> := _, <<"vm">> := _ }, emqx:get_raw_config(PathKey)), + ?assertMatch(true, is_map(emqx:get_raw_config(PathKey))), ok = emqx_config_handler:remove_handler(PathKey), ok. @@ -213,9 +213,9 @@ t_get_raw_cluster_override_conf(_Config) -> ok. t_save_config_failed(_Config) -> - ok. + pre_config_update([sysmon], UpdateReq, RawConf) -> {ok, emqx_map_lib:deep_merge(RawConf, UpdateReq)}; pre_config_update([sysmon, os], UpdateReq, _RawConf) -> diff --git a/apps/emqx_authz/src/emqx_authz_api_schema.erl b/apps/emqx_authz/src/emqx_authz_api_schema.erl index f74792f42..663de11ad 100644 --- a/apps/emqx_authz/src/emqx_authz_api_schema.erl +++ b/apps/emqx_authz/src/emqx_authz_api_schema.erl @@ -19,7 +19,7 @@ -include_lib("typerefl/include/types.hrl"). -include_lib("emqx_connector/include/emqx_connector.hrl"). --import(hoconsc, [mk/2, ref/1, ref/2, array/1, enum/1]). +-import(hoconsc, [mk/2, enum/1]). -import(emqx_schema, [mk_duration/2]). -export([fields/1, authz_sources_types/1]). diff --git a/apps/emqx_authz/src/emqx_authz_api_sources.erl b/apps/emqx_authz/src/emqx_authz_api_sources.erl index 4a58adaca..78a58126c 100644 --- a/apps/emqx_authz/src/emqx_authz_api_sources.erl +++ b/apps/emqx_authz/src/emqx_authz_api_sources.erl @@ -22,7 +22,7 @@ -include("emqx_authz.hrl"). -include_lib("emqx/include/logger.hrl"). --import(hoconsc, [mk/1, mk/2, ref/1, ref/2, array/1, enum/1]). +-import(hoconsc, [mk/1, mk/2, ref/2, array/1, enum/1]). -define(BAD_REQUEST, 'BAD_REQUEST'). -define(NOT_FOUND, 'NOT_FOUND'). diff --git a/apps/emqx_conf/src/emqx_conf_schema.erl b/apps/emqx_conf/src/emqx_conf_schema.erl index a65d17b98..96c2ed925 100644 --- a/apps/emqx_conf/src/emqx_conf_schema.erl +++ b/apps/emqx_conf/src/emqx_conf_schema.erl @@ -72,23 +72,23 @@ roots() -> end, emqx_schema_high_prio_roots() ++ [ {"node", - sc(hoconsc:ref("node"), + sc(ref("node"), #{ desc => "Node name, cookie, config & data directories " "and the Erlang virtual machine (BEAM) boot parameters." })} , {"cluster", - sc(hoconsc:ref("cluster"), + sc(ref("cluster"), #{ desc => "EMQX nodes can form a cluster to scale up the total capacity.
" "Here holds the configs to instruct how individual nodes " "can discover each other." })} , {"log", - sc(hoconsc:ref("log"), + sc(ref("log"), #{ desc => "Configure logging backends (to console or to file), " "and logging level for each logger backend." })} , {"rpc", - sc(hoconsc:ref("rpc"), + sc(ref("rpc"), #{ desc => "EMQX uses a library called gen_rpc for " "inter-broker communication.
Most of the time the default config " "should work, but in case you need to do performance " @@ -941,7 +941,7 @@ roots(Module) -> emqx_schema_high_prio_roots() -> Roots = emqx_schema:roots(high), Authz = {"authorization", - sc(hoconsc:ref("authorization"), + sc(hoconsc:ref(?MODULE, "authorization"), #{ desc => """ Authorization a.k.a. ACL.
In EMQX, MQTT client access control is extremely flexible.
diff --git a/apps/emqx_modules/test/emqx_rewrite_SUITE.erl b/apps/emqx_modules/test/emqx_rewrite_SUITE.erl index e388790f5..5b12208be 100644 --- a/apps/emqx_modules/test/emqx_rewrite_SUITE.erl +++ b/apps/emqx_modules/test/emqx_rewrite_SUITE.erl @@ -173,7 +173,7 @@ t_update_re_failed(_Config) -> {array, {ref,emqx_modules_schema,"rewrite"}}}]}, roots => [root]}, [{validation_error, - #{path => "rewrite.1.re", + #{path => "root.rewrite.1.re", reason => {<<"*^test/*">>,{"nothing to repeat",0}}, value => <<"*^test/*">>}}]}}}, ?assertError(Error, emqx_rewrite:update(Rules)), diff --git a/apps/emqx_plugins/src/emqx_plugins_schema.erl b/apps/emqx_plugins/src/emqx_plugins_schema.erl index 9dfb77589..2de8430a1 100644 --- a/apps/emqx_plugins/src/emqx_plugins_schema.erl +++ b/apps/emqx_plugins/src/emqx_plugins_schema.erl @@ -68,7 +68,7 @@ root_fields() -> , {install_dir, fun install_dir/1} ]. -states(type) -> hoconsc:array(hoconsc:ref(state)); +states(type) -> hoconsc:array(hoconsc:ref(?MODULE, state)); states(required) -> false; states(default) -> []; states(desc) -> "An array of plugins in the desired states.
"