Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not use testutils #172

Merged
merged 2 commits into from
Jan 21, 2025
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