diff --git a/plugins/inputs/tail/tail_test.go b/plugins/inputs/tail/tail_test.go index 874587f8ee78c..a8eae196ce588 100644 --- a/plugins/inputs/tail/tail_test.go +++ b/plugins/inputs/tail/tail_test.go @@ -32,6 +32,9 @@ func TestTailBadLine(t *testing.T) { tmpfile.Close() + buf := &bytes.Buffer{} + log.SetOutput(buf) + tt := NewTail() tt.Log = testutil.Logger{} tt.FromBeginning = true @@ -44,9 +47,6 @@ func TestTailBadLine(t *testing.T) { acc := testutil.Accumulator{} require.NoError(t, tt.Start(&acc)) - buf := &bytes.Buffer{} - log.SetOutput(buf) - require.NoError(t, acc.GatherError(tt.Gather)) acc.Wait(1)