From 63c34a4c40c1973fb0cd05692d78499bb1c6c944 Mon Sep 17 00:00:00 2001 From: zmstone Date: Wed, 22 May 2024 23:45:54 +0200 Subject: [PATCH 1/3] ci: run apps/emqx tests in 8 groups --- scripts/find-apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/find-apps.sh b/scripts/find-apps.sh index 42c2d7b69..a64c3519f 100755 --- a/scripts/find-apps.sh +++ b/scripts/find-apps.sh @@ -82,8 +82,8 @@ matrix() { fi case "${app}" in apps/emqx) - entries+=("$(format_app_entry "$app" 5 emqx "$runner")") - entries+=("$(format_app_entry "$app" 5 emqx-enterprise "$runner")") + entries+=("$(format_app_entry "$app" 8 emqx "$runner")") + entries+=("$(format_app_entry "$app" 8 emqx-enterprise "$runner")") ;; apps/emqx_bridge) entries+=("$(format_app_entry "$app" 1 emqx "$runner")") From b0832ecc74a9fcdd17e7215e6f4b38587f84b10d Mon Sep 17 00:00:00 2001 From: zmstone Date: Thu, 23 May 2024 08:55:28 +0200 Subject: [PATCH 2/3] test: fix a flaky one --- .../src/emqx_authn/emqx_authn_chains.erl | 16 ++++++++-------- .../test/emqx_authn/emqx_authn_init_SUITE.erl | 6 ++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/emqx_auth/src/emqx_authn/emqx_authn_chains.erl b/apps/emqx_auth/src/emqx_authn/emqx_authn_chains.erl index 27fc19ca7..1b29ff0ef 100644 --- a/apps/emqx_auth/src/emqx_authn/emqx_authn_chains.erl +++ b/apps/emqx_auth/src/emqx_authn/emqx_authn_chains.erl @@ -355,13 +355,13 @@ init(_Opts) -> ok = emqx_config_handler:add_handler([listeners, '?', '?', ?CONF_ROOT], Module), ok = hook_deny(), {ok, #{hooked => false, providers => #{}, init_done => false}, - {continue, {initialize_authentication, init}}}. + {continue, initialize_authentication}}. handle_call(get_providers, _From, #{providers := Providers} = State) -> reply(Providers, State); handle_call( {register_providers, Providers}, - From, + _From, #{providers := Reg0} = State ) -> case lists:filter(fun({T, _}) -> maps:is_key(T, Reg0) end, Providers) of @@ -373,7 +373,7 @@ handle_call( Reg0, Providers ), - reply(ok, State#{providers := Reg}, {initialize_authentication, From}); + reply(ok, State#{providers := Reg}, initialize_authentication); Clashes -> reply({error, {authentication_type_clash, Clashes}}, State) end; @@ -449,10 +449,10 @@ handle_call(Req, _From, State) -> ?SLOG(error, #{msg => "unexpected_call", call => Req}), {reply, ignored, State}. -handle_continue({initialize_authentication, _From}, #{init_done := true} = State) -> +handle_continue(initialize_authentication, #{init_done := true} = State) -> {noreply, State}; -handle_continue({initialize_authentication, From}, #{providers := Providers} = State) -> - InitDone = initialize_authentication(Providers, From), +handle_continue(initialize_authentication, #{providers := Providers} = State) -> + InitDone = initialize_authentication(Providers), {noreply, maybe_hook(State#{init_done := InitDone})}. handle_cast(Req, State) -> @@ -486,12 +486,12 @@ code_change(_OldVsn, State, _Extra) -> %% Private functions %%------------------------------------------------------------------------------ -initialize_authentication(Providers, From) -> +initialize_authentication(Providers) -> ProviderTypes = maps:keys(Providers), Chains = chain_configs(), HasProviders = has_providers_for_configs(Chains, ProviderTypes), Result = do_initialize_authentication(Providers, Chains, HasProviders), - ?tp(info, authn_chains_initialization_done, #{from => From, result => Result}), + ?tp(info, authn_chains_initialization_done, #{providers => Providers}), Result. do_initialize_authentication(_Providers, _Chains, _HasProviders = false) -> diff --git a/apps/emqx_auth/test/emqx_authn/emqx_authn_init_SUITE.erl b/apps/emqx_auth/test/emqx_authn/emqx_authn_init_SUITE.erl index 78e179ccb..9f9d32f34 100644 --- a/apps/emqx_auth/test/emqx_authn/emqx_authn_init_SUITE.erl +++ b/apps/emqx_auth/test/emqx_authn/emqx_authn_init_SUITE.erl @@ -69,10 +69,12 @@ t_initialize(_Config) -> emqx_access_control:authenticate(?CLIENTINFO) ), - Self = self(), ?assertWaitEvent( ok = emqx_authn_test_lib:register_fake_providers([{password_based, built_in_database}]), - #{?snk_kind := authn_chains_initialization_done, from := {Self, _}}, + #{ + ?snk_kind := authn_chains_initialization_done, + providers := #{{password_based, built_in_database} := emqx_authn_fake_provider} + }, 100 ), From 1d5f3d7a36c847cc9e0462a7b3e1a21395308d41 Mon Sep 17 00:00:00 2001 From: zmstone Date: Thu, 23 May 2024 08:58:31 +0200 Subject: [PATCH 3/3] chore: handle ctl command return 'true' --- dev | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev b/dev index 06249c843..a849f549e 100755 --- a/dev +++ b/dev @@ -506,6 +506,8 @@ ctl() { case rpc:call('$EMQX_NODE_NAME', emqx_ctl, run_command, [[$args]]) of ok -> init:stop(0); + true -> + init:stop(0); Error -> io:format(\"~p~n\", [Error]), init:stop(1)