From ff7f37ccf5e38fafdd6d77a8652308b3594faeeb Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Mon, 25 Sep 2023 13:22:41 -0300 Subject: [PATCH 1/2] test(cth): allow defining schema to load for app --- apps/emqx/test/emqx_cth_suite.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/emqx/test/emqx_cth_suite.erl b/apps/emqx/test/emqx_cth_suite.erl index 24105b2b4..5cbca3243 100644 --- a/apps/emqx/test/emqx_cth_suite.erl +++ b/apps/emqx/test/emqx_cth_suite.erl @@ -52,7 +52,7 @@ %% (e.g. in `init_per_suite/1` / `init_per_group/2`), providing the appspecs %% and unique work dir for the testrun (e.g. `work_dir/1`). Save the result %% in a context. -%% 3. Call `emqx_cth_sutie:stop/1` to stop the applications after the testrun +%% 3. Call `emqx_cth_suite:stop/1` to stop the applications after the testrun %% finishes (e.g. in `end_per_suite/1` / `end_per_group/2`), providing the %% result from step 2. -module(emqx_cth_suite). @@ -245,6 +245,9 @@ spec_fmt(ffun, {_, X}) -> X. maybe_configure_app(_App, #{config := false}) -> ok; +maybe_configure_app(_App, AppConfig = #{schema_mod := SchemaModule}) when is_atom(SchemaModule) -> + #{config := Config} = AppConfig, + configure_app(SchemaModule, Config); maybe_configure_app(App, #{config := Config}) -> case app_schema(App) of {ok, SchemaModule} -> From 5d212e1086e9dcbc31001bd5c4e6be039866977f Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Mon, 25 Sep 2023 13:23:39 -0300 Subject: [PATCH 2/2] fix(audit): only support audit log on enterprise edition Fixes https://emqx.atlassian.net/browse/EMQX-11039 --- apps/emqx_conf/src/emqx_conf_schema.erl | 57 +------------- .../emqx_conf/test/emqx_conf_logger_SUITE.erl | 11 +-- .../emqx_conf/test/emqx_conf_schema_tests.erl | 19 +---- .../src/emqx_enterprise_schema.erl | 77 ++++++++++++++++++- .../test/emqx_enterprise_schema_SUITE.erl | 52 +++++++++++++ .../test/emqx_enterprise_schema_tests.erl | 35 +++++++++ rel/i18n/emqx_conf_schema.hocon | 3 - 7 files changed, 169 insertions(+), 85 deletions(-) diff --git a/apps/emqx_conf/src/emqx_conf_schema.erl b/apps/emqx_conf/src/emqx_conf_schema.erl index f1bfc3d31..27799fa93 100644 --- a/apps/emqx_conf/src/emqx_conf_schema.erl +++ b/apps/emqx_conf/src/emqx_conf_schema.erl @@ -43,6 +43,9 @@ ]). -export([conf_get/2, conf_get/3, keys/2, filter/1]). +%% internal exports for `emqx_enterprise_schema' only. +-export([ensure_unicode_path/2, convert_rotation/2, log_handler_common_confs/2]). + %% Static apps which merge their configs into the merged emqx.conf %% The list can not be made a dynamic read at run-time as it is used %% by nodetool to generate app.