Skip to content

Commit

Permalink
fix: fix influx sink validate (#2893)
Browse files Browse the repository at this point in the history
Signed-off-by: yisaer <disxiaofei@163.com>
  • Loading branch information
Yisaer authored and ngjaying committed Jun 24, 2024
1 parent b1b2326 commit db3afa4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion extensions/sinks/influx2/ext/influx2.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (m *influxSink2) Configure(props map[string]any) error {
default:
return fmt.Errorf("precision %s is not supported", m.conf.PrecisionStr)
}
if len(m.conf.Measurement) == 0 && m.conf.UseLineProtocol {
if len(m.conf.Measurement) == 0 && !m.conf.UseLineProtocol {
return fmt.Errorf("measurement is required")
}
err = cast.MapToStruct(props, &m.conf.WriteOptions)
Expand Down
4 changes: 2 additions & 2 deletions extensions/sinks/influx2/ext/influx2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestConfig(t *testing.T) {
"precision": "ns",
"useLineProtocol": true,
},
error: "measurement is required",
error: "",
},
{
name: "no err",
Expand All @@ -127,7 +127,7 @@ func TestConfig(t *testing.T) {
"precision": "ns",
"useLineProtocol": false,
},
error: "",
error: "measurement is required",
},
{
name: "unmarshall error for tls",
Expand Down

0 comments on commit db3afa4

Please sign in to comment.