11package remotewrite
22
33import (
4+ "bytes"
45 "fmt"
5- "io"
66 "math"
77 "testing"
88 "time"
@@ -11,7 +11,6 @@ import (
1111 "github.com/sirupsen/logrus"
1212 "github.com/stretchr/testify/assert"
1313 "github.com/stretchr/testify/require"
14- "go.k6.io/k6/lib/testutils"
1514 "go.k6.io/k6/lib/types"
1615 "go.k6.io/k6/metrics"
1716 "gopkg.in/guregu/null.v3"
@@ -352,11 +351,10 @@ func TestOutputStopWithStaleMarkers(t *testing.T) {
352351 t .Parallel ()
353352
354353 for _ , tc := range []bool {true , false } {
355- logHook := & testutils. SimpleLogrusHook { HookedLevels : []logrus. Level { logrus . DebugLevel }}
354+ buf := bytes . NewBuffer ( nil )
356355 logger := logrus .New ()
357356 logger .SetLevel (logrus .DebugLevel )
358- logger .AddHook (logHook )
359- logger .SetOutput (io .Discard )
357+ logger .SetOutput (buf )
360358
361359 o := Output {
362360 logger : logger ,
@@ -380,17 +378,7 @@ func TestOutputStopWithStaleMarkers(t *testing.T) {
380378 // then this test will break
381379 // A mock of the client and check if Store is invoked
382380 // should be a more stable method.
383- entries := logHook .Drain ()
384- require .NotEmpty (t , entries )
385-
386- messages := func () []string {
387- s := make ([]string , 0 , len (entries ))
388- for _ , e := range entries {
389- s = append (s , e .Message )
390- }
391- return s
392- }()
393-
381+ messages := buf .String ()
394382 msg := "No time series to mark as stale"
395383 assertfn := assert .Contains
396384 if ! tc {
0 commit comments