aboutsummaryrefslogtreecommitdiff
path: root/plugin/rewrite/ttl_test.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-09-22 15:28:13 +0100
committerGravatar GitHub <noreply@github.com> 2018-09-22 15:28:13 +0100
commit7b078a885f4948592dcaa14d528aab73d9f41110 (patch)
tree1b74f98ceb8d49e709c6ffbcfafc0e9a05f64d33 /plugin/rewrite/ttl_test.go
parent7b40b14e960f6952600a3736488571d7ffd51444 (diff)
downloadcoredns-7b078a885f4948592dcaa14d528aab73d9f41110.tar.gz
coredns-7b078a885f4948592dcaa14d528aab73d9f41110.tar.zst
coredns-7b078a885f4948592dcaa14d528aab73d9f41110.zip
plugin/rewrite: silence these tests (#2120)
* plugin/rewrite: silence these tests The old Unix saying: no news, is good news. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix da tests Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/rewrite/ttl_test.go')
-rw-r--r--plugin/rewrite/ttl_test.go19
1 files changed, 3 insertions, 16 deletions
diff --git a/plugin/rewrite/ttl_test.go b/plugin/rewrite/ttl_test.go
index 5857f776b..5ede4cdae 100644
--- a/plugin/rewrite/ttl_test.go
+++ b/plugin/rewrite/ttl_test.go
@@ -2,11 +2,12 @@ package rewrite
import (
"context"
+ "reflect"
+ "testing"
+
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/pkg/dnstest"
"github.com/coredns/coredns/plugin/test"
- "reflect"
- "testing"
"github.com/miekg/dns"
)
@@ -40,11 +41,9 @@ func TestNewTtlRule(t *testing.T) {
failed = true
}
if !failed && !tc.expectedFail {
- t.Logf("Test %d: PASS, passed as expected: (%s) %s", i, tc.next, tc.args)
continue
}
if failed && tc.expectedFail {
- t.Logf("Test %d: PASS, failed as expected: (%s) %s: %s", i, tc.next, tc.args, err)
continue
}
t.Fatalf("Test %d: FAIL, expected fail=%t, but received fail=%t: (%s) %s, rule=%v", i, tc.expectedFail, failed, tc.next, tc.args, rule)
@@ -57,11 +56,9 @@ func TestNewTtlRule(t *testing.T) {
failed = true
}
if !failed && !tc.expectedFail {
- t.Logf("Test %d: PASS, passed as expected: (%s) %s", i, tc.next, tc.args)
continue
}
if failed && tc.expectedFail {
- t.Logf("Test %d: PASS, failed as expected: (%s) %s: %s", i, tc.next, tc.args, err)
continue
}
t.Fatalf("Test %d: FAIL, expected fail=%t, but received fail=%t: (%s) %s, rule=%v", i, tc.expectedFail, failed, tc.next, tc.args, rule)
@@ -119,7 +116,6 @@ func doTtlTests(rules []Rule, t *testing.T) {
}
ctx := context.TODO()
for i, tc := range tests {
- failed := false
m := new(dns.Msg)
m.SetQuestion(tc.from, tc.fromType)
m.Question[0].Qclass = dns.ClassINET
@@ -134,22 +130,13 @@ func doTtlTests(rules []Rule, t *testing.T) {
resp := rec.Msg
if len(resp.Answer) == 0 {
t.Errorf("Test %d: FAIL %s (%d) Expected valid response but received %q", i, tc.from, tc.fromType, resp)
- failed = true
continue
}
for _, a := range resp.Answer {
if a.Header().Ttl != tc.ttl {
t.Errorf("Test %d: FAIL %s (%d) Expected TTL to be %d but was %d", i, tc.from, tc.fromType, tc.ttl, a.Header().Ttl)
- failed = true
break
}
}
- if !failed {
- if tc.noRewrite {
- t.Logf("Test %d: PASS %s (%d) worked as expected, no rewrite for ttl %d", i, tc.from, tc.fromType, tc.ttl)
- } else {
- t.Logf("Test %d: PASS %s (%d) worked as expected, rewrote ttl to %d", i, tc.from, tc.fromType, tc.ttl)
- }
- }
}
}