Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions pkg/remotewrite/remotewrite_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package remotewrite

import (
"bytes"
"fmt"
"io"
"math"
"testing"
"time"
Expand All @@ -11,7 +11,6 @@ import (
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.k6.io/k6/lib/testutils"
"go.k6.io/k6/lib/types"
"go.k6.io/k6/metrics"
"gopkg.in/guregu/null.v3"
Expand Down Expand Up @@ -352,11 +351,10 @@ func TestOutputStopWithStaleMarkers(t *testing.T) {
t.Parallel()

for _, tc := range []bool{true, false} {
logHook := &testutils.SimpleLogrusHook{HookedLevels: []logrus.Level{logrus.DebugLevel}}
buf := bytes.NewBuffer(nil)
logger := logrus.New()
logger.SetLevel(logrus.DebugLevel)
logger.AddHook(logHook)
logger.SetOutput(io.Discard)
logger.SetOutput(buf)

o := Output{
logger: logger,
Expand All @@ -380,17 +378,7 @@ func TestOutputStopWithStaleMarkers(t *testing.T) {
// then this test will break
// A mock of the client and check if Store is invoked
// should be a more stable method.
entries := logHook.Drain()
require.NotEmpty(t, entries)

messages := func() []string {
s := make([]string, 0, len(entries))
for _, e := range entries {
s = append(s, e.Message)
}
return s
}()

messages := buf.String()
msg := "No time series to mark as stale"
assertfn := assert.Contains
if !tc {
Expand Down
2 changes: 1 addition & 1 deletion pkg/remotewrite/trend.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (tg *trendAsGauges) CacheNameIndex() {
})

if i < len(tg.labels) && tg.labels[i].Name == namelbl {
tg.ixname = uint16(i)
tg.ixname = uint16(i) //nolint:gosec
}
}

Expand Down
Loading