test: add facility for starting `emqx_dashboard` with `emqx_cth_suite`

This commit is contained in:
Andrew Mayorov 2024-02-08 13:23:58 +01:00 committed by Thales Macedo Garitezi
parent 755b59b7fe
commit 0515c5528f
1 changed files with 15 additions and 0 deletions

View File

@ -50,6 +50,21 @@ set_special_configs(emqx_dashboard) ->
set_special_configs(_App) ->
ok.
-spec emqx_dashboard() -> emqx_cth_suite:appspec().
emqx_dashboard() ->
emqx_dashboard("dashboard.listeners.http { enable = true, bind = 18083 }").
emqx_dashboard(Config) ->
{emqx_dashboard, #{
config => Config,
before_start => fun() ->
{ok, _} = emqx_common_test_http:create_default_app()
end,
after_start => fun() ->
true = emqx_dashboard_listener:is_ready(infinity)
end
}}.
%% there is no difference between the 'request' and 'request_api'
%% the 'request' is only to be compatible with the 'emqx_dashboard_api_test_helpers:request'
request(Method, Url) ->