aboutsummaryrefslogtreecommitdiff
path: root/plugin/proxy/dnstap_test.go
diff options
context:
space:
mode:
authorGravatar Yong Tang <yong.tang.github@outlook.com> 2019-03-03 23:32:38 -0800
committerGravatar Miek Gieben <miek@miek.nl> 2019-03-04 07:32:38 +0000
commit9dd288943a778c19d5a798e1c1535cd0ba5d53c0 (patch)
tree2f555f01f74f41c005f75aa5a27659d6c5133410 /plugin/proxy/dnstap_test.go
parentdfa413af096646e04882bb8312eef27fe1a160ef (diff)
downloadcoredns-9dd288943a778c19d5a798e1c1535cd0ba5d53c0.tar.gz
coredns-9dd288943a778c19d5a798e1c1535cd0ba5d53c0.tar.zst
coredns-9dd288943a778c19d5a798e1c1535cd0ba5d53c0.zip
Move *proxy* to external (#2651)
* Move *proxy* to external move the proxy plugin into coredns/proxy and remove it as a default plugin. Link the proxy to deprecated in plugin.cfg coredns/proxy doesn't compile because of the vendoring :( Signed-off-by: Miek Gieben <miek@miek.nl> * Add github.com/coredns/proxy Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to 'plugin/proxy/dnstap_test.go')
-rw-r--r--plugin/proxy/dnstap_test.go57
1 files changed, 0 insertions, 57 deletions
diff --git a/plugin/proxy/dnstap_test.go b/plugin/proxy/dnstap_test.go
deleted file mode 100644
index b07b081bc..000000000
--- a/plugin/proxy/dnstap_test.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package proxy
-
-import (
- "context"
- "testing"
- "time"
-
- "github.com/coredns/coredns/plugin/dnstap/msg"
- "github.com/coredns/coredns/plugin/dnstap/test"
- mwtest "github.com/coredns/coredns/plugin/test"
- "github.com/coredns/coredns/request"
-
- tap "github.com/dnstap/golang-dnstap"
- "github.com/miekg/dns"
-)
-
-func testCase(t *testing.T, ex Exchanger, q, r *dns.Msg, datq, datr *msg.Builder) {
- tapq, _ := datq.ToOutsideQuery(tap.Message_FORWARDER_QUERY)
- tapr, _ := datr.ToOutsideResponse(tap.Message_FORWARDER_RESPONSE)
- ctx := test.Context{}
- err := toDnstap(&ctx, "10.240.0.1:40212", ex,
- request.Request{W: &mwtest.ResponseWriter{}, Req: q}, r, time.Now())
- if err != nil {
- t.Fatal(err)
- }
- if len(ctx.Trap) != 2 {
- t.Fatalf("Messages: %d", len(ctx.Trap))
- }
- if !test.MsgEqual(ctx.Trap[0], tapq) {
- t.Errorf("Want: %v\nhave: %v", tapq, ctx.Trap[0])
- }
- if !test.MsgEqual(ctx.Trap[1], tapr) {
- t.Errorf("Want: %v\nhave: %v", tapr, ctx.Trap[1])
- }
-}
-
-func TestDnstap(t *testing.T) {
- q := mwtest.Case{Qname: "example.org", Qtype: dns.TypeA}.Msg()
- r := mwtest.Case{
- Qname: "example.org.", Qtype: dns.TypeA,
- Answer: []dns.RR{
- mwtest.A("example.org. 3600 IN A 10.0.0.1"),
- },
- }.Msg()
- tapq, tapr := test.TestingData(), test.TestingData()
- testCase(t, newDNSEx(), q, r, tapq, tapr)
- tapq.SocketProto = tap.SocketProtocol_TCP
- tapr.SocketProto = tap.SocketProtocol_TCP
- testCase(t, newDNSExWithOption(Options{ForceTCP: true}), q, r, tapq, tapr)
-}
-
-func TestNoDnstap(t *testing.T) {
- err := toDnstap(context.TODO(), "", nil, request.Request{}, nil, time.Now())
- if err != nil {
- t.Fatal(err)
- }
-}