Browse Source

etcdserver: print out log of normal tests

Yicheng Qin 11 years ago
parent
commit
3748088b96
1 changed files with 6 additions and 4 deletions
  1. 6 4
      etcdserver/server_test.go

+ 6 - 4
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,