fix(bridge): use the same dry run prefix

Kafka Producer and Consumer bridges rely on this prefix for detecting
a dry run and avoid leaking atoms.  At some point, this prefix was
changed, effectively disabling the check in Kafka Producer.
This commit is contained in:
Thales Macedo Garitezi 2023-03-08 11:29:46 -03:00
parent 27dfd98f46
commit 03342923b9
3 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,7 @@
{erl_opts, [debug_info]}. {erl_opts, [debug_info]}.
{deps, [{emqx, {path, "../emqx"}}]}. {deps, [ {emqx, {path, "../emqx"}}
, {emqx_resource, {path, "../../apps/emqx_resource"}}
]}.
{shell, [ {shell, [
% {config, "config/sys.config"}, % {config, "config/sys.config"},

View File

@ -16,6 +16,7 @@
-module(emqx_bridge_resource). -module(emqx_bridge_resource).
-include_lib("emqx/include/logger.hrl"). -include_lib("emqx/include/logger.hrl").
-include_lib("emqx_resource/include/emqx_resource.hrl").
-export([ -export([
bridge_to_resource_type/1, bridge_to_resource_type/1,
@ -224,7 +225,7 @@ recreate(Type, Name, Conf, Opts) ->
). ).
create_dry_run(Type, Conf0) -> create_dry_run(Type, Conf0) ->
TmpPath0 = iolist_to_binary(["bridges-create-dry-run:", emqx_misc:gen_id(8)]), TmpPath0 = iolist_to_binary([?TEST_ID_PREFIX, emqx_misc:gen_id(8)]),
TmpPath = emqx_misc:safe_filename(TmpPath0), TmpPath = emqx_misc:safe_filename(TmpPath0),
Conf = emqx_map_lib:safe_atom_key_map(Conf0), Conf = emqx_map_lib:safe_atom_key_map(Conf0),
case emqx_connector_ssl:convert_certs(TmpPath, Conf) of case emqx_connector_ssl:convert_certs(TmpPath, Conf) of

View File

@ -119,5 +119,5 @@
-define(AUTO_RESTART_INTERVAL, 60000). -define(AUTO_RESTART_INTERVAL, 60000).
-define(AUTO_RESTART_INTERVAL_RAW, <<"60s">>). -define(AUTO_RESTART_INTERVAL_RAW, <<"60s">>).
-define(TEST_ID_PREFIX, "_test_:"). -define(TEST_ID_PREFIX, "_test-create-dry-run:").
-define(RES_METRICS, resource_metrics). -define(RES_METRICS, resource_metrics).