Merge pull request #11453 from thalesmg/fix-influxdb-probe-write-syntax-20230815

fix(influxdb_bridge): avoid double-parsing write syntax during probe
This commit is contained in:
Thales Macedo Garitezi 2023-08-16 11:13:02 -03:00 committed by GitHub
commit c60751b401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{application, emqx_bridge_influxdb, [
{description, "EMQX Enterprise InfluxDB Bridge"},
{vsn, "0.1.3"},
{vsn, "0.1.4"},
{registered, []},
{applications, [
kernel,

View File

@ -168,6 +168,9 @@ write_syntax(format) ->
write_syntax(_) ->
undefined.
to_influx_lines(Lines = [#{} | _]) ->
%% already parsed/converted (e.g.: bridge_probe, after hocon_tconf:check_plain)
Lines;
to_influx_lines(RawLines) ->
try
influx_lines(str(RawLines), [])

View File

@ -66,7 +66,9 @@ on_start(InstId, Config) ->
on_stop(InstId, _State) ->
case emqx_resource:get_allocated_resources(InstId) of
#{?influx_client := Client} ->
influxdb:stop_client(Client);
Res = influxdb:stop_client(Client),
?tp(influxdb_client_stopped, #{instance_id => InstId}),
Res;
_ ->
ok
end.

View File

@ -124,6 +124,9 @@ init_per_group(InfluxDBType, Config0) when
{influxdb_config, InfluxDBConfig},
{influxdb_config_string, ConfigString},
{ehttpc_pool_name, EHttpcPoolName},
{bridge_type, influxdb_api_v1},
{bridge_name, Name},
{bridge_config, InfluxDBConfig},
{influxdb_name, Name}
| Config
];
@ -193,6 +196,9 @@ init_per_group(InfluxDBType, Config0) when
{influxdb_config, InfluxDBConfig},
{influxdb_config_string, ConfigString},
{ehttpc_pool_name, EHttpcPoolName},
{bridge_type, influxdb_api_v2},
{bridge_name, Name},
{bridge_config, InfluxDBConfig},
{influxdb_name, Name}
| Config
];
@ -570,6 +576,10 @@ t_start_ok(Config) ->
),
ok.
t_start_stop(Config) ->
ok = emqx_bridge_testlib:t_start_stop(Config, influxdb_client_stopped),
ok.
t_start_already_started(Config) ->
Type = influxdb_type_bin(?config(influxdb_type, Config)),
Name = ?config(influxdb_name, Config),

View File

@ -0,0 +1 @@
Fixed an issue which would yield false negatives when testing the connectivity of InfluxDB bridges.