Skip to content

Commit

Permalink
Test processors without Enabled method
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias committed Sep 16, 2024
1 parent 35916a4 commit 6fbd500
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions processors/minsev/minsev_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,26 @@ func TestLogProcessorEnabled(t *testing.T) {
}
}
})

t.Run("NoFiltered", func(t *testing.T) {
wrapped := &processor{}

pruned := struct{ log.Processor }{wrapped} // Remove the Enabled method.
p := NewLogProcessor(pruned, SeverityInfo)
ctx := context.Background()
r := &log.Record{}

r.SetSeverity(api.SeverityDebug)
assert.False(t, p.Enabled(ctx, *r))

r.SetSeverity(api.SeverityInfo)
assert.True(t, p.Enabled(ctx, *r))

r.SetSeverity(api.SeverityError)
assert.True(t, p.Enabled(ctx, *r))

assert.Len(t, wrapped.EnabledCalls, 0)
})
}

func TestLogProcessorForceFlushPassthrough(t *testing.T) {
Expand Down

0 comments on commit 6fbd500

Please sign in to comment.