Merge pull request #7957 from EMQ-YangM/fix_other_events

fix: ignore all other events
This commit is contained in:
Xinyu Liu 2022-05-16 18:23:36 +08:00 committed by GitHub
commit 5d5a6a14cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View File

@ -53,7 +53,7 @@ init_per_suite(Config) ->
emqx_bridge
]
),
ok = emqx_common_test_helpers:load_config(emqx_connector_schema, <<"connectors: {}">>),
Config.
end_per_suite(_Config) ->

View File

@ -18,6 +18,7 @@
-include("emqx_resource.hrl").
-include("emqx_resource_utils.hrl").
-include_lib("emqx/include/logger.hrl").
% API
-export([
@ -273,7 +274,20 @@ handle_event({call, From}, health_check, stopped, _Data) ->
Actions = [{reply, From, {error, stopped}}],
{keep_state_and_data, Actions};
handle_event({call, From}, health_check, _State, Data) ->
handle_health_check_event(From, Data).
handle_health_check_event(From, Data);
% Ignore all other events
handle_event(EventType, EventData, State, Data) ->
?SLOG(
error,
#{
msg => "ignore all other events",
event_type => EventType,
event_data => EventData,
state => State,
data => Data
}
),
{next_state, State, Data}.
%%------------------------------------------------------------------------------
%% internal functions

View File

@ -318,7 +318,7 @@ t_create_dry_run_local(_) ->
#{name => test_resource, register => true}
)
),
timer:sleep(100),
?assertEqual(undefined, whereis(test_resource)).
t_create_dry_run_local_failed(_) ->