|
@@ -284,62 +284,62 @@ t_nodes(_) ->
|
|
|
?assertEqual(<<"undefined">>, maps:get(<<"error">>, Error)),
|
|
?assertEqual(<<"undefined">>, maps:get(<<"error">>, Error)),
|
|
|
meck:unload(emqx_mgmt).
|
|
meck:unload(emqx_mgmt).
|
|
|
|
|
|
|
|
-t_plugins(_) ->
|
|
|
|
|
- application:ensure_all_started(emqx_retainer),
|
|
|
|
|
- {ok, Plugins1} = request_api(get, api_path(["plugins"]), auth_header_()),
|
|
|
|
|
- [Plugins11] = filter(get(<<"data">>, Plugins1), <<"node">>, atom_to_binary(node(), utf8)),
|
|
|
|
|
- [Plugin1] = filter(maps:get(<<"plugins">>, Plugins11), <<"name">>, <<"emqx_retainer">>),
|
|
|
|
|
- ?assertEqual(<<"emqx_retainer">>, maps:get(<<"name">>, Plugin1)),
|
|
|
|
|
- ?assertEqual(true, maps:get(<<"active">>, Plugin1)),
|
|
|
|
|
-
|
|
|
|
|
- {ok, _} = request_api(put,
|
|
|
|
|
- api_path(["plugins",
|
|
|
|
|
- atom_to_list(emqx_retainer),
|
|
|
|
|
- "unload"]),
|
|
|
|
|
- auth_header_()),
|
|
|
|
|
- {ok, Error1} = request_api(put,
|
|
|
|
|
- api_path(["plugins",
|
|
|
|
|
- atom_to_list(emqx_retainer),
|
|
|
|
|
- "unload"]),
|
|
|
|
|
- auth_header_()),
|
|
|
|
|
- ?assertEqual(<<"not_started">>, get(<<"message">>, Error1)),
|
|
|
|
|
- {ok, Plugins2} = request_api(get,
|
|
|
|
|
- api_path(["nodes", atom_to_list(node()), "plugins"]),
|
|
|
|
|
- auth_header_()),
|
|
|
|
|
- [Plugin2] = filter(get(<<"data">>, Plugins2), <<"name">>, <<"emqx_retainer">>),
|
|
|
|
|
- ?assertEqual(<<"emqx_retainer">>, maps:get(<<"name">>, Plugin2)),
|
|
|
|
|
- ?assertEqual(false, maps:get(<<"active">>, Plugin2)),
|
|
|
|
|
-
|
|
|
|
|
- {ok, _} = request_api(put,
|
|
|
|
|
- api_path(["nodes",
|
|
|
|
|
- atom_to_list(node()),
|
|
|
|
|
- "plugins",
|
|
|
|
|
- atom_to_list(emqx_retainer),
|
|
|
|
|
- "load"]),
|
|
|
|
|
- auth_header_()),
|
|
|
|
|
- {ok, Plugins3} = request_api(get,
|
|
|
|
|
- api_path(["nodes", atom_to_list(node()), "plugins"]),
|
|
|
|
|
- auth_header_()),
|
|
|
|
|
- [Plugin3] = filter(get(<<"data">>, Plugins3), <<"name">>, <<"emqx_retainer">>),
|
|
|
|
|
- ?assertEqual(<<"emqx_retainer">>, maps:get(<<"name">>, Plugin3)),
|
|
|
|
|
- ?assertEqual(true, maps:get(<<"active">>, Plugin3)),
|
|
|
|
|
-
|
|
|
|
|
- {ok, _} = request_api(put,
|
|
|
|
|
- api_path(["nodes",
|
|
|
|
|
- atom_to_list(node()),
|
|
|
|
|
- "plugins",
|
|
|
|
|
- atom_to_list(emqx_retainer),
|
|
|
|
|
- "unload"]),
|
|
|
|
|
- auth_header_()),
|
|
|
|
|
- {ok, Error2} = request_api(put,
|
|
|
|
|
- api_path(["nodes",
|
|
|
|
|
- atom_to_list(node()),
|
|
|
|
|
- "plugins",
|
|
|
|
|
- atom_to_list(emqx_retainer),
|
|
|
|
|
- "unload"]),
|
|
|
|
|
- auth_header_()),
|
|
|
|
|
- ?assertEqual(<<"not_started">>, get(<<"message">>, Error2)),
|
|
|
|
|
- application:stop(emqx_retainer).
|
|
|
|
|
|
|
+% t_plugins(_) ->
|
|
|
|
|
+% application:ensure_all_started(emqx_retainer),
|
|
|
|
|
+% {ok, Plugins1} = request_api(get, api_path(["plugins"]), auth_header_()),
|
|
|
|
|
+% [Plugins11] = filter(get(<<"data">>, Plugins1), <<"node">>, atom_to_binary(node(), utf8)),
|
|
|
|
|
+% [Plugin1] = filter(maps:get(<<"plugins">>, Plugins11), <<"name">>, <<"emqx_retainer">>),
|
|
|
|
|
+% ?assertEqual(<<"emqx_retainer">>, maps:get(<<"name">>, Plugin1)),
|
|
|
|
|
+% ?assertEqual(true, maps:get(<<"active">>, Plugin1)),
|
|
|
|
|
+%
|
|
|
|
|
+% {ok, _} = request_api(put,
|
|
|
|
|
+% api_path(["plugins",
|
|
|
|
|
+% atom_to_list(emqx_retainer),
|
|
|
|
|
+% "unload"]),
|
|
|
|
|
+% auth_header_()),
|
|
|
|
|
+% {ok, Error1} = request_api(put,
|
|
|
|
|
+% api_path(["plugins",
|
|
|
|
|
+% atom_to_list(emqx_retainer),
|
|
|
|
|
+% "unload"]),
|
|
|
|
|
+% auth_header_()),
|
|
|
|
|
+% ?assertEqual(<<"not_started">>, get(<<"message">>, Error1)),
|
|
|
|
|
+% {ok, Plugins2} = request_api(get,
|
|
|
|
|
+% api_path(["nodes", atom_to_list(node()), "plugins"]),
|
|
|
|
|
+% auth_header_()),
|
|
|
|
|
+% [Plugin2] = filter(get(<<"data">>, Plugins2), <<"name">>, <<"emqx_retainer">>),
|
|
|
|
|
+% ?assertEqual(<<"emqx_retainer">>, maps:get(<<"name">>, Plugin2)),
|
|
|
|
|
+% ?assertEqual(false, maps:get(<<"active">>, Plugin2)),
|
|
|
|
|
+%
|
|
|
|
|
+% {ok, _} = request_api(put,
|
|
|
|
|
+% api_path(["nodes",
|
|
|
|
|
+% atom_to_list(node()),
|
|
|
|
|
+% "plugins",
|
|
|
|
|
+% atom_to_list(emqx_retainer),
|
|
|
|
|
+% "load"]),
|
|
|
|
|
+% auth_header_()),
|
|
|
|
|
+% {ok, Plugins3} = request_api(get,
|
|
|
|
|
+% api_path(["nodes", atom_to_list(node()), "plugins"]),
|
|
|
|
|
+% auth_header_()),
|
|
|
|
|
+% [Plugin3] = filter(get(<<"data">>, Plugins3), <<"name">>, <<"emqx_retainer">>),
|
|
|
|
|
+% ?assertEqual(<<"emqx_retainer">>, maps:get(<<"name">>, Plugin3)),
|
|
|
|
|
+% ?assertEqual(true, maps:get(<<"active">>, Plugin3)),
|
|
|
|
|
+%
|
|
|
|
|
+% {ok, _} = request_api(put,
|
|
|
|
|
+% api_path(["nodes",
|
|
|
|
|
+% atom_to_list(node()),
|
|
|
|
|
+% "plugins",
|
|
|
|
|
+% atom_to_list(emqx_retainer),
|
|
|
|
|
+% "unload"]),
|
|
|
|
|
+% auth_header_()),
|
|
|
|
|
+% {ok, Error2} = request_api(put,
|
|
|
|
|
+% api_path(["nodes",
|
|
|
|
|
+% atom_to_list(node()),
|
|
|
|
|
+% "plugins",
|
|
|
|
|
+% atom_to_list(emqx_retainer),
|
|
|
|
|
+% "unload"]),
|
|
|
|
|
+% auth_header_()),
|
|
|
|
|
+% ?assertEqual(<<"not_started">>, get(<<"message">>, Error2)),
|
|
|
|
|
+% application:stop(emqx_retainer).
|
|
|
|
|
|
|
|
t_acl_cache(_) ->
|
|
t_acl_cache(_) ->
|
|
|
ClientId = <<"client1">>,
|
|
ClientId = <<"client1">>,
|