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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 188 additions and 82 deletions

View file

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