|
|
@@ -52,6 +52,8 @@
|
|
|
|
|
|
-export([parse_url/1]).
|
|
|
|
|
|
+-define(PROBE_ID_SEP, $_).
|
|
|
+
|
|
|
-callback connector_config(ParsedConfig, Context) ->
|
|
|
ParsedConfig
|
|
|
when
|
|
|
@@ -90,7 +92,8 @@ parse_connector_id(ConnectorId) ->
|
|
|
{atom(), atom() | binary()}.
|
|
|
parse_connector_id(<<"connector:", ConnectorId/binary>>, Opts) ->
|
|
|
parse_connector_id(ConnectorId, Opts);
|
|
|
-parse_connector_id(<<?TEST_ID_PREFIX, _:16/binary, ConnectorId/binary>>, Opts) ->
|
|
|
+parse_connector_id(?PROBE_ID_MATCH(Suffix), Opts) ->
|
|
|
+ <<?PROBE_ID_SEP, ConnectorId/binary>> = Suffix,
|
|
|
parse_connector_id(ConnectorId, Opts);
|
|
|
parse_connector_id(ConnectorId, Opts) ->
|
|
|
emqx_resource:parse_resource_id(ConnectorId, Opts).
|
|
|
@@ -214,9 +217,8 @@ create_dry_run(Type, Conf0, Callback) ->
|
|
|
TypeAtom = safe_atom(Type),
|
|
|
%% We use a fixed name here to avoid creating an atom
|
|
|
%% to avoid potential race condition, the resource id should be unique
|
|
|
- Prefix = emqx_resource_manager:make_test_id(),
|
|
|
- TmpName =
|
|
|
- iolist_to_binary([Prefix, TypeBin, ":", <<"probedryrun">>]),
|
|
|
+ Prefix = ?PROBE_ID_NEW(),
|
|
|
+ TmpName = iolist_to_binary([Prefix, ?PROBE_ID_SEP, TypeBin, $:, "dryrun"]),
|
|
|
TmpPath = emqx_utils:safe_filename(TmpName),
|
|
|
Conf1 = maps:without([<<"name">>], Conf0),
|
|
|
RawConf = #{<<"connectors">> => #{TypeBin => #{<<"temp_name">> => Conf1}}},
|