From 0515c5528fbec2920e724a86dd957b6c39f4aa89 Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Thu, 8 Feb 2024 13:23:58 +0100 Subject: [PATCH] test: add facility for starting `emqx_dashboard` with `emqx_cth_suite` --- .../test/emqx_mgmt_api_test_util.erl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/emqx_management/test/emqx_mgmt_api_test_util.erl b/apps/emqx_management/test/emqx_mgmt_api_test_util.erl index cd768a529..2f38bc7b9 100644 --- a/apps/emqx_management/test/emqx_mgmt_api_test_util.erl +++ b/apps/emqx_management/test/emqx_mgmt_api_test_util.erl @@ -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) ->