Skip to content

Commit

Permalink
Add test-cases for dropping fields by unexpected type.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Rebhan committed Nov 20, 2020
1 parent 860d81a commit b9fa86f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions plugins/processors/starlark/starlark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2477,6 +2477,40 @@ func TestScript(t *testing.T) {
),
},
},
{
name: "drop fields with unexpected type",
plugin: &Starlark{
Script: "testdata/drop_fields_with_unexpected_type.star",
Log: testutil.Logger{},
},
input: []telegraf.Metric{
testutil.MustMetric("device",
map[string]string{},
map[string]interface{}{
"a": 42,
"b": "42",
"c": 42.0,
"d": "42.0",
"e": true,
"f": 23.0,
},
time.Unix(0, 0),
),
},
expected: []telegraf.Metric{
testutil.MustMetric("device",
map[string]string{},
map[string]interface{}{
"a": 42,
"c": 42.0,
"d": "42.0",
"e": true,
"f": 23.0,
},
time.Unix(0, 0),
),
},
},
{
name: "scale",
plugin: &Starlark{
Expand Down

0 comments on commit b9fa86f

Please sign in to comment.