Просмотр исходного кода

test(emqx_authz): adjust meck and app start order

Zaiming Shi 4 лет назад
Родитель
Сommit
c0ffbd68c8

+ 2 - 1
apps/emqx_authz/test/emqx_authz_api_SUITE.erl

@@ -43,12 +43,13 @@ groups() ->
     [].
 
 init_per_suite(Config) ->
-    ok = emqx_ct_helpers:start_apps([emqx_authz]),
     %% important! let emqx_schema include the current app!
     meck:new(emqx_schema, [non_strict, passthrough, no_history, no_link]),
     meck:expect(emqx_schema, includes, fun() -> ["authorization"] end ),
     meck:expect(emqx_schema, extra_schema_fields, fun(FieldName) -> emqx_authz_schema:fields(FieldName) end),
 
+    ok = emqx_ct_helpers:start_apps([emqx_authz]),
+
     %create_default_app(),
     Config.
 

+ 2 - 2
apps/emqx_authz/test/emqx_authz_http_SUITE.erl

@@ -29,8 +29,6 @@ groups() ->
     [].
 
 init_per_suite(Config) ->
-    ok = emqx_ct_helpers:start_apps([emqx_authz]),
-
     meck:new(emqx_resource, [non_strict, passthrough, no_history, no_link]),
     meck:expect(emqx_resource, create, fun(_, _, _) -> {ok, meck_data} end ),
 
@@ -39,6 +37,8 @@ init_per_suite(Config) ->
     meck:expect(emqx_schema, includes, fun() -> ["authorization"] end ),
     meck:expect(emqx_schema, extra_schema_fields, fun(FieldName) -> emqx_authz_schema:fields(FieldName) end),
 
+    ok = emqx_ct_helpers:start_apps([emqx_authz]),
+
     ok = emqx_config:update([zones, default, authorization, cache, enable], false),
     ok = emqx_config:update([zones, default, authorization, enable], true),
     Rules = [#{ <<"config">> => #{

+ 4 - 5
apps/emqx_authz/test/emqx_authz_mongo_SUITE.erl

@@ -29,16 +29,15 @@ groups() ->
     [].
 
 init_per_suite(Config) ->
-    ok = emqx_ct_helpers:start_apps([emqx_authz]),
-
-    meck:new(emqx_resource, [non_strict, passthrough, no_history, no_link]),
-    meck:expect(emqx_resource, create, fun(_, _, _) -> {ok, meck_data} end ),
-
     %% important! let emqx_schema include the current app!
     meck:new(emqx_schema, [non_strict, passthrough, no_history, no_link]),
     meck:expect(emqx_schema, includes, fun() -> ["authorization"] end ),
     meck:expect(emqx_schema, extra_schema_fields, fun(FieldName) -> emqx_authz_schema:fields(FieldName) end),
 
+    meck:new(emqx_resource, [non_strict, passthrough, no_history, no_link]),
+    meck:expect(emqx_resource, create, fun(_, _, _) -> {ok, meck_data} end),
+
+    ok = emqx_ct_helpers:start_apps([emqx_authz]),
     ok = emqx_config:update([zones, default, authorization, cache, enable], false),
     ok = emqx_config:update([zones, default, authorization, enable], true),
     Rules = [#{ <<"config">> => #{

+ 2 - 1
apps/emqx_authz/test/emqx_authz_mysql_SUITE.erl

@@ -29,7 +29,6 @@ groups() ->
     [].
 
 init_per_suite(Config) ->
-    ok = emqx_ct_helpers:start_apps([emqx_authz]),
 
     meck:new(emqx_resource, [non_strict, passthrough, no_history, no_link]),
     meck:expect(emqx_resource, create, fun(_, _, _) -> {ok, meck_data} end ),
@@ -39,6 +38,8 @@ init_per_suite(Config) ->
     meck:expect(emqx_schema, includes, fun() -> ["authorization"] end ),
     meck:expect(emqx_schema, extra_schema_fields, fun(FieldName) -> emqx_authz_schema:fields(FieldName) end),
 
+    ok = emqx_ct_helpers:start_apps([emqx_authz]),
+
     ok = emqx_config:update([zones, default, authorization, cache, enable], false),
     ok = emqx_config:update([zones, default, authorization, enable], true),
     Rules = [#{ <<"config">> => #{

+ 2 - 2
apps/emqx_authz/test/emqx_authz_pgsql_SUITE.erl

@@ -29,8 +29,6 @@ groups() ->
     [].
 
 init_per_suite(Config) ->
-    ok = emqx_ct_helpers:start_apps([emqx_authz]),
-
     meck:new(emqx_resource, [non_strict, passthrough, no_history, no_link]),
     meck:expect(emqx_resource, create, fun(_, _, _) -> {ok, meck_data} end ),
 
@@ -39,6 +37,8 @@ init_per_suite(Config) ->
     meck:expect(emqx_schema, includes, fun() -> ["authorization"] end ),
     meck:expect(emqx_schema, extra_schema_fields, fun(FieldName) -> emqx_authz_schema:fields(FieldName) end),
 
+    ok = emqx_ct_helpers:start_apps([emqx_authz]),
+
     ok = emqx_config:update([zones, default, authorization, cache, enable], false),
     ok = emqx_config:update([zones, default, authorization, enable], true),
     Rules = [#{ <<"config">> => #{

+ 2 - 2
apps/emqx_authz/test/emqx_authz_redis_SUITE.erl

@@ -29,8 +29,6 @@ groups() ->
     [].
 
 init_per_suite(Config) ->
-    ok = emqx_ct_helpers:start_apps([emqx_authz]),
-
     meck:new(emqx_resource, [non_strict, passthrough, no_history, no_link]),
     meck:expect(emqx_resource, create, fun(_, _, _) -> {ok, meck_data} end ),
 
@@ -39,6 +37,8 @@ init_per_suite(Config) ->
     meck:expect(emqx_schema, includes, fun() -> ["authorization"] end ),
     meck:expect(emqx_schema, extra_schema_fields, fun(FieldName) -> emqx_authz_schema:fields(FieldName) end),
 
+    ok = emqx_ct_helpers:start_apps([emqx_authz]),
+
     ok = emqx_config:update([zones, default, authorization, cache, enable], false),
     ok = emqx_config:update([zones, default, authorization, enable], true),
     Rules = [#{ <<"config">> => #{