Skip to content

Commit

Permalink
Merge pull request #2020 from Shopify/dnwe/no-test-logger
Browse files Browse the repository at this point in the history
fix(test): remove testLogger from TrackLeader test
  • Loading branch information
bai authored Sep 14, 2021
2 parents 52ac254 + fdf47c6 commit c3c1c33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 0 additions & 4 deletions consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,10 +900,6 @@ func TestConsumeMessagesFromReadReplicaErrorUnknown(t *testing.T) {
//
// See https://github.com/Shopify/sarama/issues/1927
func TestConsumeMessagesTrackLeader(t *testing.T) {
prevLogger := Logger
defer func() { Logger = prevLogger }()
Logger = &testLogger{t}

cfg := NewConfig()
cfg.ClientID = t.Name()
cfg.Metadata.RefreshFrequency = time.Millisecond * 50
Expand Down
5 changes: 4 additions & 1 deletion logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,28 @@ import "testing"
// logs of the given T passed from Test functions.
// and records the text in the error log.
//

// nolint:unused
type testLogger struct {
t *testing.T
}

// nolint:unused
func (l *testLogger) Print(v ...interface{}) {
if l.t != nil {
l.t.Helper()
l.t.Log(v...)
}
}

// nolint:unused
func (l *testLogger) Printf(format string, v ...interface{}) {
if l.t != nil {
l.t.Helper()
l.t.Logf(format, v...)
}
}

// nolint:unused
func (l *testLogger) Println(v ...interface{}) {
if l.t != nil {
l.t.Helper()
Expand Down

0 comments on commit c3c1c33

Please sign in to comment.