fix: don't crash in http SUITE

This commit is contained in:
zhongwencool 2024-01-18 16:23:02 +08:00
parent 59797cfea7
commit dae835635c
4 changed files with 7 additions and 3 deletions

View File

@ -38,6 +38,7 @@
]). ]).
-export([reply_delegator/3]). -export([reply_delegator/3]).
-export([render_template/2]).
-export([ -export([
roots/0, roots/0,
@ -266,8 +267,8 @@ on_add_channel(
) -> ) ->
InstalledActions = maps:get(installed_actions, OldState, #{}), InstalledActions = maps:get(installed_actions, OldState, #{}),
{ok, ActionState} = do_create_http_action(ActionConfig), {ok, ActionState} = do_create_http_action(ActionConfig),
RenderTemplate = maps:get(render_template_func, ActionConfig, fun render_template/2), RenderTmplFunc = maps:get(render_template_func, ActionConfig, fun ?MODULE:render_template/2),
ActionState1 = ActionState#{render_template_func => RenderTemplate}, ActionState1 = ActionState#{render_template_func => RenderTmplFunc},
NewInstalledActions = maps:put(ActionId, ActionState1, InstalledActions), NewInstalledActions = maps:put(ActionId, ActionState1, InstalledActions),
NewState = maps:put(installed_actions, NewInstalledActions, OldState), NewState = maps:put(installed_actions, NewInstalledActions, OldState),
{ok, NewState}. {ok, NewState}.

View File

@ -146,7 +146,7 @@ end_per_testcase(_TestCase, Config) ->
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
%% HTTP server for testing %% HTTP server for testing
%% (Orginally copied from emqx_bridge_api_SUITE) %% (Originally copied from emqx_bridge_api_SUITE)
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
start_http_server(HTTPServerConfig) -> start_http_server(HTTPServerConfig) ->
process_flag(trap_exit, true), process_flag(trap_exit, true),

1
changes/feat-12348.en.md Normal file
View File

@ -0,0 +1 @@
Added support for Elasticsearch Bridge.

View File

@ -299,3 +299,5 @@ now_us
ns ns
elasticsearch elasticsearch
ElasticSearch ElasticSearch
doc_as_upsert
upsert