Преглед изворни кода

fix: don't crash in http SUITE

zhongwencool пре 2 година
родитељ
комит
dae835635c

+ 3 - 2
apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl

@@ -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),
-    ActionState1 = ActionState#{render_template_func => RenderTemplate},
+    RenderTmplFunc = maps:get(render_template_func, ActionConfig, fun ?MODULE:render_template/2),
+    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}.

+ 1 - 1
apps/emqx_bridge_http/test/emqx_bridge_http_SUITE.erl

@@ -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 - 0
changes/feat-12348.en.md

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

+ 2 - 0
scripts/spellcheck/dicts/emqx.txt

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