dnstap.TapperFromContext always returns nil (#2018)
Automatically submitted.
This commit is contained in:
parent
2b4878195c
commit
9cea32f013
2 changed files with 16 additions and 1 deletions
15
plugin/dnstap/context_test.go
Normal file
15
plugin/dnstap/context_test.go
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
package dnstap
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestDnstapContext(t *testing.T) {
|
||||||
|
ctx := tapContext{context.TODO(), Dnstap{}}
|
||||||
|
tapper := TapperFromContext(ctx)
|
||||||
|
|
||||||
|
if tapper == nil {
|
||||||
|
t.Fatal("Can't get tapper")
|
||||||
|
}
|
||||||
|
}
|
|
@ -51,7 +51,7 @@ func TapperFromContext(ctx context.Context) (t Tapper) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TapMessage implements Tapper.
|
// TapMessage implements Tapper.
|
||||||
func (h *Dnstap) TapMessage(m *tap.Message) {
|
func (h Dnstap) TapMessage(m *tap.Message) {
|
||||||
t := tap.Dnstap_MESSAGE
|
t := tap.Dnstap_MESSAGE
|
||||||
h.IO.Dnstap(tap.Dnstap{
|
h.IO.Dnstap(tap.Dnstap{
|
||||||
Type: &t,
|
Type: &t,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue