fix: make eunit happy
This commit is contained in:
parent
d2e0c09f2e
commit
2686a66b14
|
@ -193,7 +193,7 @@ purge(NameVsn) ->
|
||||||
%% @doc Delete the package file.
|
%% @doc Delete the package file.
|
||||||
-spec delete_package(name_vsn()) -> ok.
|
-spec delete_package(name_vsn()) -> ok.
|
||||||
delete_package(NameVsn) ->
|
delete_package(NameVsn) ->
|
||||||
File = pkg_file(NameVsn),
|
File = pkg_file_path(NameVsn),
|
||||||
_ = emqx_plugins_serde:delete_schema(NameVsn),
|
_ = emqx_plugins_serde:delete_schema(NameVsn),
|
||||||
case file:delete(File) of
|
case file:delete(File) of
|
||||||
ok ->
|
ok ->
|
||||||
|
@ -317,7 +317,7 @@ put_config(Key, Value) ->
|
||||||
|
|
||||||
-spec get_tar(name_vsn()) -> {ok, binary()} | {error, any}.
|
-spec get_tar(name_vsn()) -> {ok, binary()} | {error, any}.
|
||||||
get_tar(NameVsn) ->
|
get_tar(NameVsn) ->
|
||||||
TarGz = pkg_file(NameVsn),
|
TarGz = pkg_file_path(NameVsn),
|
||||||
case file:read_file(TarGz) of
|
case file:read_file(TarGz) of
|
||||||
{ok, Content} ->
|
{ok, Content} ->
|
||||||
{ok, Content};
|
{ok, Content};
|
||||||
|
@ -407,7 +407,7 @@ top_dir_test_() ->
|
||||||
-endif.
|
-endif.
|
||||||
|
|
||||||
do_ensure_installed(NameVsn) ->
|
do_ensure_installed(NameVsn) ->
|
||||||
TarGz = pkg_file(NameVsn),
|
TarGz = pkg_file_path(NameVsn),
|
||||||
case erl_tar:extract(TarGz, [compressed, memory]) of
|
case erl_tar:extract(TarGz, [compressed, memory]) of
|
||||||
{ok, TarContent} ->
|
{ok, TarContent} ->
|
||||||
ok = write_tar_file_content(install_dir(), TarContent),
|
ok = write_tar_file_content(install_dir(), TarContent),
|
||||||
|
@ -633,7 +633,7 @@ ensure_exists_and_installed(NameVsn) ->
|
||||||
%% Do we have the package, but it's not extracted yet?
|
%% Do we have the package, but it's not extracted yet?
|
||||||
case get_tar(NameVsn) of
|
case get_tar(NameVsn) of
|
||||||
{ok, TarContent} ->
|
{ok, TarContent} ->
|
||||||
ok = file:write_file(pkg_file(NameVsn), TarContent),
|
ok = file:write_file(pkg_file_path(NameVsn), TarContent),
|
||||||
ok = do_ensure_installed(NameVsn);
|
ok = do_ensure_installed(NameVsn);
|
||||||
_ ->
|
_ ->
|
||||||
%% If not, try to get it from the cluster.
|
%% If not, try to get it from the cluster.
|
||||||
|
@ -645,7 +645,7 @@ do_get_from_cluster(NameVsn) ->
|
||||||
Nodes = [N || N <- mria:running_nodes(), N /= node()],
|
Nodes = [N || N <- mria:running_nodes(), N /= node()],
|
||||||
case get_from_any_node(Nodes, NameVsn, []) of
|
case get_from_any_node(Nodes, NameVsn, []) of
|
||||||
{ok, TarContent} ->
|
{ok, TarContent} ->
|
||||||
ok = file:write_file(pkg_file(NameVsn), TarContent),
|
ok = file:write_file(pkg_file_path(NameVsn), TarContent),
|
||||||
ok = do_ensure_installed(NameVsn);
|
ok = do_ensure_installed(NameVsn);
|
||||||
{error, NodeErrors} when Nodes =/= [] ->
|
{error, NodeErrors} when Nodes =/= [] ->
|
||||||
?SLOG(error, #{
|
?SLOG(error, #{
|
||||||
|
@ -1073,7 +1073,7 @@ plugin_config_dir(NameVsn) ->
|
||||||
filename:join([plugin_dir(NameVsn), "data", "configs"]).
|
filename:join([plugin_dir(NameVsn), "data", "configs"]).
|
||||||
|
|
||||||
%% Files
|
%% Files
|
||||||
pkg_file(NameVsn) ->
|
pkg_file_path(NameVsn) ->
|
||||||
filename:join([install_dir(), bin([NameVsn, ".tar.gz"])]).
|
filename:join([install_dir(), bin([NameVsn, ".tar.gz"])]).
|
||||||
|
|
||||||
info_file_path(NameVsn) ->
|
info_file_path(NameVsn) ->
|
||||||
|
|
|
@ -56,7 +56,7 @@ read_plugin_test() ->
|
||||||
try
|
try
|
||||||
ok = write_file(InfoFile, FakeInfo),
|
ok = write_file(InfoFile, FakeInfo),
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
{error, #{error := "bad_rel_apps"}},
|
{error, #{error_msg := "bad_rel_apps"}},
|
||||||
emqx_plugins:read_plugin_info(NameVsn, #{})
|
emqx_plugins:read_plugin_info(NameVsn, #{})
|
||||||
)
|
)
|
||||||
after
|
after
|
||||||
|
|
Loading…
Reference in New Issue