From 050f68cf5df486a632a73ccc5f1d5a907187a114 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Tue, 19 Jul 2022 20:13:54 +0200 Subject: [PATCH] test: allow missing schema for app in tests --- apps/emqx/test/emqx_common_test_helpers.erl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/emqx/test/emqx_common_test_helpers.erl b/apps/emqx/test/emqx_common_test_helpers.erl index b3292ded3..ce998656a 100644 --- a/apps/emqx/test/emqx_common_test_helpers.erl +++ b/apps/emqx/test/emqx_common_test_helpers.erl @@ -181,11 +181,15 @@ start_app(App, Handler) -> app_conf_file(emqx_conf) -> "emqx.conf.all"; app_conf_file(App) -> atom_to_list(App) ++ ".conf". -%% TODO: get rid of cuttlefish app_schema(App) -> Mod = list_to_atom(atom_to_list(App) ++ "_schema"), - true = is_list(Mod:roots()), - Mod. + try + true = is_list(Mod:roots()), + Mod + catch + error:undef -> + no_schema + end. mustache_vars(App) -> [ @@ -221,6 +225,8 @@ render_config_file(ConfigFile, Vars0) -> ok = file:write_file(NewName, Targ), NewName. +read_schema_configs(no_schema, _ConfigFile) -> + ok; read_schema_configs(Schema, ConfigFile) -> NewConfig = generate_config(Schema, ConfigFile), lists:foreach(