diff --git a/core/dnsserver/log_test.go b/core/dnsserver/log_test.go new file mode 100644 index 000000000..cee92cc57 --- /dev/null +++ b/core/dnsserver/log_test.go @@ -0,0 +1,5 @@ +package dnsserver + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/auto/log_test.go b/plugin/auto/log_test.go new file mode 100644 index 000000000..6047eebda --- /dev/null +++ b/plugin/auto/log_test.go @@ -0,0 +1,5 @@ +package auto + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/bind/log_test.go b/plugin/bind/log_test.go new file mode 100644 index 000000000..4ee3ffcca --- /dev/null +++ b/plugin/bind/log_test.go @@ -0,0 +1,5 @@ +package bind + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/cache/log_test.go b/plugin/cache/log_test.go new file mode 100644 index 000000000..220b2068a --- /dev/null +++ b/plugin/cache/log_test.go @@ -0,0 +1,5 @@ +package cache + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/chaos/log_test.go b/plugin/chaos/log_test.go new file mode 100644 index 000000000..92c98af69 --- /dev/null +++ b/plugin/chaos/log_test.go @@ -0,0 +1,5 @@ +package chaos + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/debug/log_test.go b/plugin/debug/log_test.go new file mode 100644 index 000000000..6e256db37 --- /dev/null +++ b/plugin/debug/log_test.go @@ -0,0 +1,5 @@ +package debug + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/dnssec/log_test.go b/plugin/dnssec/log_test.go new file mode 100644 index 000000000..e8f3a1ddc --- /dev/null +++ b/plugin/dnssec/log_test.go @@ -0,0 +1,5 @@ +package dnssec + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/dnstap/dnstapio/log_test.go b/plugin/dnstap/dnstapio/log_test.go new file mode 100644 index 000000000..c37b3df73 --- /dev/null +++ b/plugin/dnstap/dnstapio/log_test.go @@ -0,0 +1,5 @@ +package dnstapio + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/dnstap/log_test.go b/plugin/dnstap/log_test.go new file mode 100644 index 000000000..145aa1db2 --- /dev/null +++ b/plugin/dnstap/log_test.go @@ -0,0 +1,5 @@ +package dnstap + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/erratic/log_test.go b/plugin/erratic/log_test.go new file mode 100644 index 000000000..f6fb4bff4 --- /dev/null +++ b/plugin/erratic/log_test.go @@ -0,0 +1,5 @@ +package erratic + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/errors/log_test.go b/plugin/errors/log_test.go new file mode 100644 index 000000000..643c16a2d --- /dev/null +++ b/plugin/errors/log_test.go @@ -0,0 +1,5 @@ +package errors + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/etcd/log_test.go b/plugin/etcd/log_test.go new file mode 100644 index 000000000..57735be09 --- /dev/null +++ b/plugin/etcd/log_test.go @@ -0,0 +1,5 @@ +package etcd + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/federation/log_test.go b/plugin/federation/log_test.go new file mode 100644 index 000000000..fa9481726 --- /dev/null +++ b/plugin/federation/log_test.go @@ -0,0 +1,5 @@ +package federation + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/file/log_test.go b/plugin/file/log_test.go new file mode 100644 index 000000000..c9609eecf --- /dev/null +++ b/plugin/file/log_test.go @@ -0,0 +1,5 @@ +package file + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/forward/log_test.go b/plugin/forward/log_test.go new file mode 100644 index 000000000..a7f0a8589 --- /dev/null +++ b/plugin/forward/log_test.go @@ -0,0 +1,5 @@ +package forward + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/health/log_test.go b/plugin/health/log_test.go new file mode 100644 index 000000000..7e6c97bc4 --- /dev/null +++ b/plugin/health/log_test.go @@ -0,0 +1,5 @@ +package health + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/hosts/log_test.go b/plugin/hosts/log_test.go new file mode 100644 index 000000000..e784bd6ee --- /dev/null +++ b/plugin/hosts/log_test.go @@ -0,0 +1,5 @@ +package hosts + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/kubernetes/log_test.go b/plugin/kubernetes/log_test.go new file mode 100644 index 000000000..b8b7b7473 --- /dev/null +++ b/plugin/kubernetes/log_test.go @@ -0,0 +1,5 @@ +package kubernetes + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/loadbalance/log_test.go b/plugin/loadbalance/log_test.go new file mode 100644 index 000000000..e4dbd6de1 --- /dev/null +++ b/plugin/loadbalance/log_test.go @@ -0,0 +1,5 @@ +package loadbalance + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/log/log_test.go b/plugin/log/log_test.go index 484135cd5..d1ff8d36d 100644 --- a/plugin/log/log_test.go +++ b/plugin/log/log_test.go @@ -8,12 +8,15 @@ import ( "testing" "github.com/coredns/coredns/plugin/pkg/dnstest" + clog "github.com/coredns/coredns/plugin/pkg/log" "github.com/coredns/coredns/plugin/pkg/response" "github.com/coredns/coredns/plugin/test" "github.com/miekg/dns" ) +func init() { clog.Discard() } + func TestLoggedStatus(t *testing.T) { var f bytes.Buffer rule := Rule{ diff --git a/plugin/log_test.go b/plugin/log_test.go new file mode 100644 index 000000000..0ee4b7c6c --- /dev/null +++ b/plugin/log_test.go @@ -0,0 +1,5 @@ +package plugin + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/metadata/log_test.go b/plugin/metadata/log_test.go new file mode 100644 index 000000000..8d1e9249d --- /dev/null +++ b/plugin/metadata/log_test.go @@ -0,0 +1,5 @@ +package metadata + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/metrics/log_test.go b/plugin/metrics/log_test.go new file mode 100644 index 000000000..101098a8c --- /dev/null +++ b/plugin/metrics/log_test.go @@ -0,0 +1,5 @@ +package metrics + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/nsid/log_test.go b/plugin/nsid/log_test.go new file mode 100644 index 000000000..1aea37906 --- /dev/null +++ b/plugin/nsid/log_test.go @@ -0,0 +1,5 @@ +package nsid + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/pkg/healthcheck/log_test.go b/plugin/pkg/healthcheck/log_test.go new file mode 100644 index 000000000..95808771c --- /dev/null +++ b/plugin/pkg/healthcheck/log_test.go @@ -0,0 +1,5 @@ +package healthcheck + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/pkg/log/log.go b/plugin/pkg/log/log.go index 161fbc886..387d7f8e2 100644 --- a/plugin/pkg/log/log.go +++ b/plugin/pkg/log/log.go @@ -10,6 +10,7 @@ package log import ( "fmt" + "io/ioutil" golog "log" ) @@ -61,6 +62,9 @@ func Error(v ...interface{}) { log(err, v...) } // Errorf is equivalent to log.Printf, but prefixed with "[ERROR] ". func Errorf(format string, v ...interface{}) { logf(err, format, v...) } +// Discard sets the log output to /dev/null. +func Discard() { golog.SetOutput(ioutil.Discard) } + const ( debug = "[DEBUG] " err = "[ERROR] " diff --git a/plugin/pprof/log_test.go b/plugin/pprof/log_test.go new file mode 100644 index 000000000..7e2c25234 --- /dev/null +++ b/plugin/pprof/log_test.go @@ -0,0 +1,5 @@ +package pprof + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/proxy/log_test.go b/plugin/proxy/log_test.go new file mode 100644 index 000000000..e0c50773b --- /dev/null +++ b/plugin/proxy/log_test.go @@ -0,0 +1,5 @@ +package proxy + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/reload/log_test.go b/plugin/reload/log_test.go new file mode 100644 index 000000000..2f6598dea --- /dev/null +++ b/plugin/reload/log_test.go @@ -0,0 +1,5 @@ +package reload + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/rewrite/log_test.go b/plugin/rewrite/log_test.go new file mode 100644 index 000000000..6ce362746 --- /dev/null +++ b/plugin/rewrite/log_test.go @@ -0,0 +1,5 @@ +package rewrite + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/root/log_test.go b/plugin/root/log_test.go new file mode 100644 index 000000000..f63caac29 --- /dev/null +++ b/plugin/root/log_test.go @@ -0,0 +1,5 @@ +package root + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/route53/log_test.go b/plugin/route53/log_test.go new file mode 100644 index 000000000..20d1f87bd --- /dev/null +++ b/plugin/route53/log_test.go @@ -0,0 +1,5 @@ +package route53 + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/secondary/log_test.go b/plugin/secondary/log_test.go new file mode 100644 index 000000000..15cab004f --- /dev/null +++ b/plugin/secondary/log_test.go @@ -0,0 +1,5 @@ +package secondary + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/template/log_test.go b/plugin/template/log_test.go new file mode 100644 index 000000000..13d6e6b28 --- /dev/null +++ b/plugin/template/log_test.go @@ -0,0 +1,5 @@ +package template + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/tls/log_test.go b/plugin/tls/log_test.go new file mode 100644 index 000000000..017affd09 --- /dev/null +++ b/plugin/tls/log_test.go @@ -0,0 +1,5 @@ +package tls + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/trace/log_test.go b/plugin/trace/log_test.go new file mode 100644 index 000000000..a0fe76142 --- /dev/null +++ b/plugin/trace/log_test.go @@ -0,0 +1,5 @@ +package trace + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/plugin/whoami/log_test.go b/plugin/whoami/log_test.go new file mode 100644 index 000000000..460c11cd2 --- /dev/null +++ b/plugin/whoami/log_test.go @@ -0,0 +1,5 @@ +package whoami + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/test/auto_test.go b/test/auto_test.go index ff130188b..275d84b06 100644 --- a/test/auto_test.go +++ b/test/auto_test.go @@ -2,7 +2,6 @@ package test import ( "io/ioutil" - "log" "os" "path" "testing" @@ -35,8 +34,6 @@ func TestAuto(t *testing.T) { } defer i.Stop() - log.SetOutput(ioutil.Discard) - p := proxy.NewLookup([]string{udp}) state := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)} @@ -82,7 +79,6 @@ func TestAutoNonExistentZone(t *testing.T) { if err != nil { t.Fatal(err) } - log.SetOutput(ioutil.Discard) corefile := `.:0 { auto { @@ -117,7 +113,6 @@ func TestAutoNonExistentZone(t *testing.T) { func TestAutoAXFR(t *testing.T) { t.Parallel() - log.SetOutput(ioutil.Discard) tmpdir, err := ioutil.TempDir(os.TempDir(), "coredns") if err != nil { diff --git a/test/chaos_test.go b/test/chaos_test.go index 991b6aa85..af5cbdf84 100644 --- a/test/chaos_test.go +++ b/test/chaos_test.go @@ -1,8 +1,6 @@ package test import ( - "io/ioutil" - "log" "testing" // Plug in CoreDNS, needed for AppVersion and AppName in this test. @@ -24,8 +22,6 @@ func TestChaos(t *testing.T) { } defer i.Stop() - log.SetOutput(ioutil.Discard) - m := new(dns.Msg) m.SetQuestion("version.bind.", dns.TypeTXT) m.Question[0].Qclass = dns.ClassCHAOS diff --git a/test/ds_file_test.go b/test/ds_file_test.go index 356fd2b0b..2b2be5795 100644 --- a/test/ds_file_test.go +++ b/test/ds_file_test.go @@ -1,8 +1,6 @@ package test import ( - "io/ioutil" - "log" "testing" "github.com/coredns/coredns/plugin/proxy" @@ -49,8 +47,6 @@ func TestLookupDS(t *testing.T) { } defer i.Stop() - log.SetOutput(ioutil.Discard) - p := proxy.NewLookup([]string{udp}) state := request.Request{W: &mtest.ResponseWriter{}, Req: new(dns.Msg)} diff --git a/test/etcd_cache_test.go b/test/etcd_cache_test.go index a0be86dc7..df670e107 100644 --- a/test/etcd_cache_test.go +++ b/test/etcd_cache_test.go @@ -4,8 +4,6 @@ package test import ( "context" - "io/ioutil" - "log" "testing" "github.com/coredns/coredns/plugin/etcd/msg" @@ -33,7 +31,6 @@ func TestEtcdCache(t *testing.T) { defer ex.Stop() etc := etcdPlugin() - log.SetOutput(ioutil.Discard) var ctx = context.TODO() for _, serv := range servicesCacheTest { diff --git a/test/etcd_test.go b/test/etcd_test.go index 2077ca985..134b2e63b 100644 --- a/test/etcd_test.go +++ b/test/etcd_test.go @@ -5,8 +5,6 @@ package test import ( "context" "encoding/json" - "io/ioutil" - "log" "testing" "time" @@ -53,7 +51,6 @@ func TestEtcdStubAndProxyLookup(t *testing.T) { defer ex.Stop() etc := etcdPlugin() - log.SetOutput(ioutil.Discard) var ctx = context.TODO() for _, serv := range servicesStub { // adds example.{net,org} as stubs diff --git a/test/file_cname_proxy_test.go b/test/file_cname_proxy_test.go index b0adcf203..6d086e091 100644 --- a/test/file_cname_proxy_test.go +++ b/test/file_cname_proxy_test.go @@ -1,8 +1,6 @@ package test import ( - "io/ioutil" - "log" "testing" "github.com/coredns/coredns/plugin/proxy" @@ -14,7 +12,6 @@ import ( func TestZoneExternalCNAMELookupWithoutProxy(t *testing.T) { t.Parallel() - log.SetOutput(ioutil.Discard) name, rm, err := TempFile(".", exampleOrg) if err != nil { @@ -48,7 +45,6 @@ func TestZoneExternalCNAMELookupWithoutProxy(t *testing.T) { func TestZoneExternalCNAMELookupWithProxy(t *testing.T) { t.Parallel() - log.SetOutput(ioutil.Discard) name, rm, err := TempFile(".", exampleOrg) if err != nil { diff --git a/test/file_serve_test.go b/test/file_serve_test.go index 3aca45bfb..3f0674dfd 100644 --- a/test/file_serve_test.go +++ b/test/file_serve_test.go @@ -1,8 +1,6 @@ package test import ( - "io/ioutil" - "log" "testing" "github.com/miekg/dns" @@ -10,7 +8,6 @@ import ( func TestZoneEDNS0Lookup(t *testing.T) { t.Parallel() - log.SetOutput(ioutil.Discard) name, rm, err := TempFile(".", `$ORIGIN example.org. @ 3600 IN SOA sns.dns.icann.org. noc.dns.icann.org. ( @@ -58,7 +55,6 @@ www IN AAAA ::1 func TestZoneNoNS(t *testing.T) { t.Parallel() - log.SetOutput(ioutil.Discard) name, rm, err := TempFile(".", `$ORIGIN example.org. @ 3600 IN SOA sns.dns.icann.org. noc.dns.icann.org. ( diff --git a/test/file_srv_additional_test.go b/test/file_srv_additional_test.go index 26ae1f9aa..106ae7faa 100644 --- a/test/file_srv_additional_test.go +++ b/test/file_srv_additional_test.go @@ -1,8 +1,6 @@ package test import ( - "io/ioutil" - "log" "testing" "github.com/coredns/coredns/plugin/proxy" @@ -14,7 +12,6 @@ import ( func TestZoneSRVAdditional(t *testing.T) { t.Parallel() - log.SetOutput(ioutil.Discard) name, rm, err := TempFile(".", exampleOrg) if err != nil { diff --git a/test/grpc_test.go b/test/grpc_test.go index acbd822d7..fe273e789 100644 --- a/test/grpc_test.go +++ b/test/grpc_test.go @@ -2,8 +2,6 @@ package test import ( "context" - "io/ioutil" - "log" "testing" "time" @@ -14,8 +12,6 @@ import ( ) func TestGrpc(t *testing.T) { - log.SetOutput(ioutil.Discard) - corefile := `grpc://.:0 { whoami } diff --git a/test/hosts_file_test.go b/test/hosts_file_test.go index 37ad43bc9..8e017aafa 100644 --- a/test/hosts_file_test.go +++ b/test/hosts_file_test.go @@ -1,8 +1,6 @@ package test import ( - "io/ioutil" - "log" "testing" "github.com/coredns/coredns/plugin/proxy" @@ -26,8 +24,6 @@ func TestHostsInlineLookup(t *testing.T) { } defer i.Stop() - log.SetOutput(ioutil.Discard) - p := proxy.NewLookup([]string{udp}) state := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)} diff --git a/test/log_test.go b/test/log_test.go new file mode 100644 index 000000000..51d972d5a --- /dev/null +++ b/test/log_test.go @@ -0,0 +1,5 @@ +package test + +import clog "github.com/coredns/coredns/plugin/pkg/log" + +func init() { clog.Discard() } diff --git a/test/metrics_test.go b/test/metrics_test.go index 4a1665c5b..58838e1e8 100644 --- a/test/metrics_test.go +++ b/test/metrics_test.go @@ -2,7 +2,6 @@ package test import ( "io/ioutil" - "log" "os" "path" "testing" @@ -145,8 +144,6 @@ func TestMetricsAuto(t *testing.T) { } defer i.Stop() - log.SetOutput(ioutil.Discard) - // Write db.example.org to get example.org. if err = ioutil.WriteFile(path.Join(tmpdir, "db.example.org"), []byte(zoneContent), 0644); err != nil { t.Fatal(err) diff --git a/test/plugin_dnssec_test.go b/test/plugin_dnssec_test.go index 3f8157b21..d48966927 100644 --- a/test/plugin_dnssec_test.go +++ b/test/plugin_dnssec_test.go @@ -2,7 +2,6 @@ package test import ( "io/ioutil" - "log" "os" "testing" @@ -36,7 +35,6 @@ func TestLookupBalanceRewriteCacheDnssec(t *testing.T) { } defer ex.Stop() - log.SetOutput(ioutil.Discard) c := new(dns.Client) m := new(dns.Msg) m.SetQuestion("example.org.", dns.TypeA) diff --git a/test/plugin_test.go b/test/plugin_test.go index cf1680d72..4003a958f 100644 --- a/test/plugin_test.go +++ b/test/plugin_test.go @@ -1,8 +1,6 @@ package test import ( - "io/ioutil" - "log" "testing" "github.com/coredns/coredns/plugin/test" @@ -34,7 +32,6 @@ func benchmarkLookupBalanceRewriteCache(b *testing.B) { } defer ex.Stop() - log.SetOutput(ioutil.Discard) c := new(dns.Client) m := new(dns.Msg) m.SetQuestion("example.org.", dns.TypeA) diff --git a/test/proxy_health_test.go b/test/proxy_health_test.go index 8d7c229b8..b0677691c 100644 --- a/test/proxy_health_test.go +++ b/test/proxy_health_test.go @@ -1,8 +1,6 @@ package test import ( - "io/ioutil" - "log" "testing" "github.com/coredns/coredns/plugin/proxy" @@ -13,8 +11,6 @@ import ( ) func TestProxyErratic(t *testing.T) { - log.SetOutput(ioutil.Discard) - corefile := `example.org:0 { erratic { drop 2 @@ -39,8 +35,7 @@ func TestProxyErratic(t *testing.T) { func TestProxyThreeWay(t *testing.T) { // Run 3 CoreDNS server, 2 upstream ones and a proxy. 1 Upstream is unhealthy after 1 query, but after - // that we should still be able to send to the other one - log.SetOutput(ioutil.Discard) + // that we should still be able to send to the other one. // Backend CoreDNS's. corefileUp1 := `example.org:0 { diff --git a/test/proxy_http_health_test.go b/test/proxy_http_health_test.go index 8ea778864..bda5a0f90 100644 --- a/test/proxy_http_health_test.go +++ b/test/proxy_http_health_test.go @@ -2,8 +2,6 @@ package test import ( "io" - "io/ioutil" - "log" "net" "net/http" "net/http/httptest" @@ -17,8 +15,6 @@ import ( ) func TestProxyWithHTTPCheckOK(t *testing.T) { - log.SetOutput(ioutil.Discard) - healthCheckServer := httptest.NewServer(http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) diff --git a/test/proxy_test.go b/test/proxy_test.go index d25ace689..87a05a21e 100644 --- a/test/proxy_test.go +++ b/test/proxy_test.go @@ -1,8 +1,6 @@ package test import ( - "io/ioutil" - "log" "testing" "github.com/coredns/coredns/plugin/proxy" @@ -31,8 +29,6 @@ func TestLookupProxy(t *testing.T) { } defer i.Stop() - log.SetOutput(ioutil.Discard) - p := proxy.NewLookup([]string{udp}) state := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)} resp, err := p.Lookup(state, "example.org.", dns.TypeA) @@ -70,8 +66,6 @@ func TestLookupDnsWithForcedTcp(t *testing.T) { } defer i.Stop() - log.SetOutput(ioutil.Discard) - p := proxy.NewLookupWithOption([]string{tcp}, proxy.Options{ForceTCP: true}) state := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)} resp, err := p.Lookup(state, "example.org.", dns.TypeA) @@ -114,8 +108,6 @@ func BenchmarkProxyLookup(b *testing.B) { } defer i.Stop() - log.SetOutput(ioutil.Discard) - p := proxy.NewLookup([]string{udp}) state := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)} diff --git a/test/readme_test.go b/test/readme_test.go index f8ae0e346..4d216b8c8 100644 --- a/test/readme_test.go +++ b/test/readme_test.go @@ -3,7 +3,6 @@ package test import ( "bufio" "io/ioutil" - "log" "os" "path/filepath" "strconv" @@ -48,8 +47,6 @@ func TestReadme(t *testing.T) { create(contents) defer remove(contents) - log.SetOutput(ioutil.Discard) - middle := filepath.Join("..", "plugin") dirs, err := ioutil.ReadDir(middle) if err != nil { diff --git a/test/reverse_test.go b/test/reverse_test.go index 4ff74c737..962601a28 100644 --- a/test/reverse_test.go +++ b/test/reverse_test.go @@ -1,8 +1,6 @@ package test import ( - "io/ioutil" - "log" "testing" "github.com/coredns/coredns/plugin/proxy" @@ -28,8 +26,6 @@ func TestReverseCorefile(t *testing.T) { t.Fatalf("Could not get UDP listening port") } - log.SetOutput(ioutil.Discard) - p := proxy.NewLookup([]string{udp}) state := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)} resp, err := p.Lookup(state, "17.0.0.10.in-addr.arpa.", dns.TypePTR) diff --git a/test/rewrite_test.go b/test/rewrite_test.go index 0ec3a9a70..34795413d 100644 --- a/test/rewrite_test.go +++ b/test/rewrite_test.go @@ -2,8 +2,6 @@ package test import ( "bytes" - "io/ioutil" - "log" "testing" "github.com/miekg/dns" @@ -26,8 +24,6 @@ func TestRewrite(t *testing.T) { defer i.Stop() - log.SetOutput(ioutil.Discard) - testMX(t, udp) testEdns0(t, udp) } diff --git a/test/server.go b/test/server.go index 4a0c200ee..bdd31a434 100644 --- a/test/server.go +++ b/test/server.go @@ -1,8 +1,6 @@ package test import ( - "io/ioutil" - "log" "sync" "github.com/coredns/coredns/core/dnsserver" @@ -21,7 +19,6 @@ func CoreDNSServer(corefile string) (*caddy.Instance, error) { defer mu.Unlock() caddy.Quiet = true dnsserver.Quiet = true - log.SetOutput(ioutil.Discard) return caddy.Start(NewInput(corefile)) } diff --git a/test/wildcard_test.go b/test/wildcard_test.go index f34b5c0eb..b04affe6b 100644 --- a/test/wildcard_test.go +++ b/test/wildcard_test.go @@ -1,8 +1,6 @@ package test import ( - "io/ioutil" - "log" "testing" "github.com/coredns/coredns/plugin/proxy" @@ -31,8 +29,6 @@ func TestLookupWildcard(t *testing.T) { } defer i.Stop() - log.SetOutput(ioutil.Discard) - p := proxy.NewLookup([]string{udp}) state := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)}