From 9cea32f013739a17a07b096f117b6e5899006d3f Mon Sep 17 00:00:00 2001 From: varyoo Date: Thu, 2 Aug 2018 00:58:23 +0200 Subject: [PATCH] dnstap.TapperFromContext always returns nil (#2018) Automatically submitted. --- plugin/dnstap/context_test.go | 15 +++++++++++++++ plugin/dnstap/handler.go | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 plugin/dnstap/context_test.go diff --git a/plugin/dnstap/context_test.go b/plugin/dnstap/context_test.go new file mode 100644 index 000000000..04728e032 --- /dev/null +++ b/plugin/dnstap/context_test.go @@ -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") + } +} diff --git a/plugin/dnstap/handler.go b/plugin/dnstap/handler.go index 1c411e2aa..b09c70406 100644 --- a/plugin/dnstap/handler.go +++ b/plugin/dnstap/handler.go @@ -51,7 +51,7 @@ func TapperFromContext(ctx context.Context) (t Tapper) { } // TapMessage implements Tapper. -func (h *Dnstap) TapMessage(m *tap.Message) { +func (h Dnstap) TapMessage(m *tap.Message) { t := tap.Dnstap_MESSAGE h.IO.Dnstap(tap.Dnstap{ Type: &t,