test: use end_per_testcase to restore default admin password
This commit is contained in:
parent
d219e475fb
commit
164209b576
|
@ -65,6 +65,13 @@ end_per_suite(_Config) ->
|
||||||
emqx_ct_helpers:stop_apps([emqx_dashboard, emqx_management, emqx_modules]),
|
emqx_ct_helpers:stop_apps([emqx_dashboard, emqx_management, emqx_modules]),
|
||||||
ekka_mnesia:ensure_stopped().
|
ekka_mnesia:ensure_stopped().
|
||||||
|
|
||||||
|
init_per_testcase(_, Config) ->
|
||||||
|
Config.
|
||||||
|
|
||||||
|
end_per_testcase(_, _) ->
|
||||||
|
%% revert to default password
|
||||||
|
emqx_dashboard_admin:change_password(<<"admin">>, <<"public">>).
|
||||||
|
|
||||||
t_overview(_) ->
|
t_overview(_) ->
|
||||||
[?assert(request_dashboard(get, api_path(erlang:atom_to_list(Overview)), auth_header_()))|| Overview <- ?OVERVIEWS].
|
[?assert(request_dashboard(get, api_path(erlang:atom_to_list(Overview)), auth_header_()))|| Overview <- ?OVERVIEWS].
|
||||||
|
|
||||||
|
@ -101,8 +108,7 @@ t_admins_persist_default_password(_) ->
|
||||||
|
|
||||||
%% It gets restarted by the app automatically
|
%% It gets restarted by the app automatically
|
||||||
[#mqtt_admin{password=PasswordAfterRestart}] = emqx_dashboard_admin:lookup_user(<<"admin">>),
|
[#mqtt_admin{password=PasswordAfterRestart}] = emqx_dashboard_admin:lookup_user(<<"admin">>),
|
||||||
?assertEqual(Password, PasswordAfterRestart),
|
?assertEqual(Password, PasswordAfterRestart).
|
||||||
emqx_dashboard_admin:change_password(<<"admin">>, <<"public">>).
|
|
||||||
|
|
||||||
debug(Label, Slave) ->
|
debug(Label, Slave) ->
|
||||||
ct:print(
|
ct:print(
|
||||||
|
@ -168,8 +174,7 @@ t_default_password_persists_after_leaving_cluster(_) ->
|
||||||
rpc:call(Slave, emqx_dashboard_admin, check, [<<"admin">>, <<"password">>])),
|
rpc:call(Slave, emqx_dashboard_admin, check, [<<"admin">>, <<"password">>])),
|
||||||
|
|
||||||
{ok, _} = stop_slave(Slave, [emqx_dashboard, emqx_management, emqx_modules]),
|
{ok, _} = stop_slave(Slave, [emqx_dashboard, emqx_management, emqx_modules]),
|
||||||
|
ok.
|
||||||
emqx_dashboard_admin:change_password(<<"admin">>, <<"public">>).
|
|
||||||
|
|
||||||
t_rest_api(_Config) ->
|
t_rest_api(_Config) ->
|
||||||
{ok, Res0} = http_get("users"),
|
{ok, Res0} = http_get("users"),
|
||||||
|
|
Loading…
Reference in New Issue