aboutsummaryrefslogtreecommitdiff
path: root/plugin/rewrite/rewrite_test.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-07-02 15:39:50 +0100
committerGravatar Yong Tang <yong.tang.github@outlook.com> 2018-07-02 07:39:50 -0700
commit6dd2cf8c4b30822f1d718fbef728f6856628a3df (patch)
treefce20dc6ee9a9400130c0c82292ba470be82fe7b /plugin/rewrite/rewrite_test.go
parent1abecf99d97270075731b9f7cc01c9e2b687d570 (diff)
downloadcoredns-6dd2cf8c4b30822f1d718fbef728f6856628a3df.tar.gz
coredns-6dd2cf8c4b30822f1d718fbef728f6856628a3df.tar.zst
coredns-6dd2cf8c4b30822f1d718fbef728f6856628a3df.zip
plugin/rewrite: use request.Request and other cleanups (#1920)
This was done anyway, but only deep in the functions, just do this everywhere; allows for shorter code and request.Request allows for caching as well. Cleanups, make it more Go like. * remove unneeded switches * remove testdir (why was this there??) * simplify the logic * remove unneeded variables * put short functions on a single line * fix documentation. * spin off wire funcs in wire.go, make them functions. Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/rewrite/rewrite_test.go')
-rw-r--r--plugin/rewrite/rewrite_test.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/plugin/rewrite/rewrite_test.go b/plugin/rewrite/rewrite_test.go
index 56c446f49..d67f8d0bf 100644
--- a/plugin/rewrite/rewrite_test.go
+++ b/plugin/rewrite/rewrite_test.go
@@ -482,14 +482,14 @@ func TestRewriteEDNS0LocalVariable(t *testing.T) {
},
{
[]dns.EDNS0{},
- []string{"local", "set", "0xffee", "{server_ip}"},
- []dns.EDNS0{&dns.EDNS0_LOCAL{Code: 0xffee, Data: []byte{0x7F, 0x00, 0x00, 0x01}}},
+ []string{"local", "set", "0xffee", "{server_port}"},
+ []dns.EDNS0{&dns.EDNS0_LOCAL{Code: 0xffee, Data: []byte{0x00, 0x35}}},
true,
},
{
[]dns.EDNS0{},
- []string{"local", "set", "0xffee", "{server_port}"},
- []dns.EDNS0{&dns.EDNS0_LOCAL{Code: 0xffee, Data: []byte{0x00, 0x35}}},
+ []string{"local", "set", "0xffee", "{server_ip}"},
+ []dns.EDNS0{&dns.EDNS0_LOCAL{Code: 0xffee, Data: []byte{0x7F, 0x00, 0x00, 0x01}}},
true,
},
}
@@ -498,7 +498,6 @@ func TestRewriteEDNS0LocalVariable(t *testing.T) {
for i, tc := range tests {
m := new(dns.Msg)
m.SetQuestion("example.com.", dns.TypeA)
- m.Question[0].Qclass = dns.ClassINET
r, err := newEdns0Rule("stop", tc.args...)
if err != nil {
@@ -620,7 +619,6 @@ func TestRewriteEDNS0Subnet(t *testing.T) {
for i, tc := range tests {
m := new(dns.Msg)
m.SetQuestion("example.com.", dns.TypeA)
- m.Question[0].Qclass = dns.ClassINET
r, err := newEdns0Rule("stop", tc.args...)
if err != nil {