Explorar o código

test: allow missing schema for app in tests

Zaiming (Stone) Shi %!s(int64=3) %!d(string=hai) anos
pai
achega
050f68cf5d
Modificáronse 1 ficheiros con 9 adicións e 3 borrados
  1. 9 3
      apps/emqx/test/emqx_common_test_helpers.erl

+ 9 - 3
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(