浏览代码

fix: remove Logger inadvertently left in test

This Logger modification would occasionally hit a data racein Travis:
```
WARNING: DATA RACE
Read at 0x00000130ced0 by goroutine 60:
  github.com/Shopify/sarama.(*Broker).Close()
      /home/travis/gopath/src/github.com/Shopify/sarama/broker.go:253 +0x4f0
  github.com/Shopify/sarama.safeAsyncClose.func1()
      /home/travis/gopath/src/github.com/Shopify/sarama/utils.go:52 +0xa3
  github.com/Shopify/sarama.withRecover()
      /home/travis/gopath/src/github.com/Shopify/sarama/utils.go:45 +0x84

Previous write at 0x00000130ced0 by goroutine 75:
  github.com/Shopify/sarama.TestClusterAdminDescribeBrokerConfig()
      /home/travis/gopath/src/github.com/Shopify/sarama/admin_test.go:553 +0x220
  testing.tRunner()
      /home/travis/.gimme/versions/go1.12.15.linux.amd64/src/testing/testing.go:865 +0x163
```

It had inadvertently been included in the test, so just remove it
Dominic Evans 6 年之前
父节点
当前提交
9ba6d8e14f
共有 1 个文件被更改,包括 0 次插入7 次删除
  1. 0 7
      admin_test.go

+ 0 - 7
admin_test.go

@@ -2,10 +2,6 @@ package sarama
 
 import (
 	"errors"
-	"fmt"
-	"io/ioutil"
-	"log"
-	"os"
 	"strings"
 	"testing"
 )
@@ -550,9 +546,6 @@ func TestClusterAdminDescribeConfig(t *testing.T) {
 // TestClusterAdminDescribeBrokerConfig ensures that a describe broker config
 // is sent to the broker in the resource struct, _not_ the controller
 func TestClusterAdminDescribeBrokerConfig(t *testing.T) {
-	Logger = log.New(os.Stdout, fmt.Sprintf("[%s] ", t.Name()), log.LstdFlags)
-	defer func() { Logger = log.New(ioutil.Discard, "[Sarama] ", log.LstdFlags) }()
-
 	controllerBroker := NewMockBroker(t, 1)
 	defer controllerBroker.Close()
 	configBroker := NewMockBroker(t, 2)