fix: bad list & bad SUITE
This commit is contained in:
parent
02e7f3bfe0
commit
95cc5a19c8
|
@ -160,4 +160,4 @@ import_content(Content) ->
|
|||
tmp_filename() ->
|
||||
Seconds = erlang:system_time(second),
|
||||
{{Y, M, D}, {H, MM, S}} = emqx_mgmt_util:datetime(Seconds),
|
||||
io_lib:format("emqx-export-~p-~p-~p-~p-~p-~p.json", [Y, M, D, H, MM, S]).
|
||||
list_to_binary(io_lib:format("emqx-export-~p-~p-~p-~p-~p-~p.json", [Y, M, D, H, MM, S])).
|
||||
|
|
|
@ -183,7 +183,10 @@ do_import(File, Config, Overrides) ->
|
|||
mnesia:clear_table(?ACL_TABLE2),
|
||||
mnesia:clear_table(emqx_user),
|
||||
emqx_acl_mnesia_migrator:migrate_records(),
|
||||
Filename = filename:join(proplists:get_value(data_dir, Config), File),
|
||||
Filename = filename:basename(File),
|
||||
FilePath = filename:join([proplists:get_value(data_dir, Config), File]),
|
||||
{ok, Bin} = file:read_file(FilePath),
|
||||
ok = emqx_mgmt_data_backup:upload_backup_file(Filename, Bin),
|
||||
emqx_mgmt_data_backup:import(Filename, Overrides).
|
||||
|
||||
test_import(username, {Username, Password}) ->
|
||||
|
|
|
@ -34,14 +34,18 @@ init_per_suite(Cfg) ->
|
|||
Cfg.
|
||||
|
||||
end_per_suite(Cfg) ->
|
||||
emqx_mgmt_data_backup:delete_all_backup_file(),
|
||||
emqx_ct_helpers:stop_apps([emqx_management, emqx_rule_engine]),
|
||||
Cfg.
|
||||
|
||||
get_data_path() ->
|
||||
emqx_ct_helpers:deps_path(emqx_management, "test/emqx_bridge_mqtt_data_export_import_SUITE_data/").
|
||||
|
||||
import(FilePath, Version) ->
|
||||
ok = emqx_mgmt_data_backup:import(get_data_path() ++ "/" ++ FilePath, <<"{}">>),
|
||||
import(FilePath0, Version) ->
|
||||
Filename = filename:basename(FilePath0),
|
||||
FilePath = filename:join([get_data_path(), FilePath0]),
|
||||
{ok, Bin} = file:read_file(FilePath),
|
||||
ok = emqx_mgmt_data_backup:upload_backup_file(Filename, Bin),
|
||||
timer:sleep(500),
|
||||
lists:foreach(fun(#resource{id = Id, config = Config} = _Resource) ->
|
||||
case Id of
|
||||
|
|
|
@ -719,6 +719,7 @@ t_data_import_content(_) ->
|
|||
Dir = emqx_mgmt_data_backup:backup_dir(),
|
||||
{ok, Bin} = file:read_file(filename:join(Dir, Filename)),
|
||||
Content = emqx_json:decode(Bin),
|
||||
ct:pal("Content:::: ~p~n", [Content]),
|
||||
?assertMatch({ok, "{\"code\":0}"},
|
||||
request_api(post, api_path(["data","import"]), [], auth_header_(), Content)),
|
||||
|
||||
|
|
|
@ -46,8 +46,11 @@ remove_resource(Id) ->
|
|||
emqx_rule_registry:remove_resource(Id),
|
||||
emqx_rule_registry:remove_resource_params(Id).
|
||||
|
||||
import(FilePath, Version) ->
|
||||
ok = emqx_mgmt_data_backup:import(get_data_path() ++ "/" ++ FilePath, <<"{}">>),
|
||||
import(FilePath0, Version) ->
|
||||
Filename = filename:basename(FilePath0),
|
||||
FilePath = filename:join([get_data_path(), FilePath0]),
|
||||
{ok, Bin} = file:read_file(FilePath),
|
||||
ok = emqx_mgmt_data_backup:upload_backup_file(Filename, Bin),
|
||||
lists:foreach(fun(#resource{id = Id, config = Config} = _Resource) ->
|
||||
case Id of
|
||||
<<"webhook">> ->
|
||||
|
|
Loading…
Reference in New Issue