diff --git a/etcdserver/server_test.go b/etcdserver/server_test.go index 9e6031d20..f057e0c92 100644 --- a/etcdserver/server_test.go +++ b/etcdserver/server_test.go @@ -23,6 +23,7 @@ import ( "log" "math/rand" "net/http" + "os" "path" "reflect" "strconv" @@ -41,10 +42,6 @@ import ( "github.com/coreos/etcd/store" ) -func init() { - log.SetOutput(ioutil.Discard) -} - // TestDoLocalAction tests requests which do not need to go through raft to be applied, // and are served through local data. func TestDoLocalAction(t *testing.T) { @@ -530,6 +527,9 @@ func (s *fakeTransporter) Pause() {} func (s *fakeTransporter) Resume() {} func testServer(t *testing.T, ns uint64) { + log.SetOutput(ioutil.Discard) + defer log.SetOutput(os.Stderr) + ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -1227,6 +1227,8 @@ func TestPublishStopped(t *testing.T) { // TestPublishRetry tests that publish will keep retry until success. func TestPublishRetry(t *testing.T) { + log.SetOutput(ioutil.Discard) + defer log.SetOutput(os.Stderr) n := &nodeRecorder{} srv := &EtcdServer{ node: n,