Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add convert processor #11686

Merged
Prev Previous commit
Next Next commit
Add more tests for ignore_missing + fail_on_error
andrewkroh committed May 7, 2019
commit 15663e29635ea55df0d96c6a60ca4fb7a0d27447
11 changes: 11 additions & 0 deletions libbeat/processors/convert/convert_test.go
Original file line number Diff line number Diff line change
@@ -39,12 +39,23 @@ func TestConvert(t *testing.T) {

evt := &beat.Event{Fields: common.MapStr{}}

// Defaults.
p.IgnoreMissing = false
p.FailOnError = true
_, err = p.Run(evt)
if assert.Error(t, err) {
assert.Contains(t, err.Error(), "field [src] is missing")
}

p.IgnoreMissing = true
p.FailOnError = true
_, err = p.Run(evt)
if err != nil {
t.Fatal(err)
}

p.IgnoreMissing = true
p.FailOnError = false
_, err = p.Run(evt)
if err != nil {
t.Fatal(err)