From 24dfa4172294d19c0b028efc2992bde85ce08e52 Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Tue, 30 Jan 2024 21:07:40 +0100 Subject: [PATCH] feat(cth-suite): use cheaper heuristic for schema modules --- apps/emqx/test/emqx_cth_suite.erl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/emqx/test/emqx_cth_suite.erl b/apps/emqx/test/emqx_cth_suite.erl index 93813cab9..eae12145f 100644 --- a/apps/emqx/test/emqx_cth_suite.erl +++ b/apps/emqx/test/emqx_cth_suite.erl @@ -470,9 +470,12 @@ clean_suite_state() -> app_schema(App) -> Mod = list_to_atom(atom_to_list(App) ++ "_schema"), - try is_list(Mod:roots()) of - true -> {ok, Mod}; - false -> {error, schema_no_roots} + try + Exports = Mod:module_info(exports), + case lists:member({roots, 0}, Exports) of + true -> {ok, Mod}; + false -> {error, schema_no_roots} + end catch error:undef -> {error, schema_not_found}