Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit e29b259

Browse files
committed
do not use testutils
1 parent 1511bc9 commit e29b259

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

pkg/remotewrite/remotewrite_test.go

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package remotewrite
22

33
import (
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

Comments
 (0)