Clean up tests logging (#1979)

* Clean up tests logging

This cleans up the travis logs so you can see the failures better.

Older tests in tests/ would call log.SetOutput(ioutil.Discard) in
a haphazard way. This add log.Discard and put an `init` function in each
package's dir (no way to do this globally). The cleanup in tests/ is
clear.

All plugins also got this init function to have some uniformity and kill
any (future) logging there in the tests as well.

There is a one-off in pkg/healthcheck because that does log.

Signed-off-by: Miek Gieben <miek@miek.nl>

* bring back original log_test.go

Signed-off-by: Miek Gieben <miek@miek.nl>

* suppress logging here as well

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben
2018-07-19 16:23:06 +01:00
committed by GitHub
parent c69bed726b
commit f3134da45e
59 changed files with 188 additions and 82 deletions

View File

@@ -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 {