浏览代码

fix(test): test case failed by unload

zhongwencool 4 年之前
父节点
当前提交
4317845482

+ 4 - 0
lib-ce/emqx_modules/src/emqx_modules.appup.src

@@ -2,21 +2,25 @@
 {VSN,
   [
     {"4.3.3", [
+        {apply, {emqx_metrics, ensure, [['client.acl.allow', 'client.acl.ignore', 'client.acl.deny']]}},
         {load_module, emqx_mod_acl_internal, brutal_purge, soft_purge, []}
     ]},
     {"4.3.2", [
       {load_module, emqx_mod_presence, brutal_purge, soft_purge, []},
+      {apply, {emqx_metrics, ensure, [['client.acl.allow', 'client.acl.ignore', 'client.acl.deny']]}},
       {load_module, emqx_mod_acl_internal, brutal_purge, soft_purge, []}
     ]},
     {"4.3.1", [
       {load_module, emqx_mod_presence, brutal_purge, soft_purge, []},
       {load_module, emqx_mod_api_topic_metrics, brutal_purge, soft_purge, []},
+      {apply, {emqx_metrics, ensure, [['client.acl.allow', 'client.acl.ignore', 'client.acl.deny']]}},
       {load_module, emqx_mod_acl_internal, brutal_purge, soft_purge, []}
     ]},
     {"4.3.0", [
       {update, emqx_mod_delayed, {advanced, []}},
       {load_module, emqx_mod_presence, brutal_purge, soft_purge, []},
       {load_module, emqx_mod_api_topic_metrics, brutal_purge, soft_purge, []},
+      {apply, {emqx_metrics, ensure, [['client.acl.allow', 'client.acl.ignore', 'client.acl.deny']]}},
       {load_module, emqx_mod_acl_internal, brutal_purge, soft_purge, []}
     ]},
     {<<".*">>, []}

+ 3 - 1
lib-ce/emqx_modules/test/emqx_mod_acl_internal_SUITE.erl

@@ -38,10 +38,12 @@ t_load_unload(_) ->
     ?assertEqual({error,already_exists}, emqx_mod_acl_internal:load([])).
 
 t_check_acl(_) ->
+    emqx_mod_acl_internal:load([]),
     Rules=#{publish => [{allow,all}], subscribe => [{deny, all}]},
     ?assertEqual({ok, allow}, emqx_mod_acl_internal:check_acl(clientinfo(), publish,  <<"t">>, [], Rules)),
     ?assertEqual({ok, deny}, emqx_mod_acl_internal:check_acl(clientinfo(), subscribe,  <<"t">>, [], Rules)),
-    ?assertEqual(ok, emqx_mod_acl_internal:check_acl(clientinfo(), connect,  <<"t">>, [], Rules)).
+    ?assertEqual(ok, emqx_mod_acl_internal:check_acl(clientinfo(), connect,  <<"t">>, [], Rules)),
+    emqx_mod_acl_internal:unload([]).
 
 t_reload_acl(_) ->
     ?assertEqual(ok, emqx_mod_acl_internal:reload([])).