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

[chore]: enable compares and negative-positive rules from testifylint #11128

Merged
merged 1 commit into from
Sep 11, 2024
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
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,11 @@ linters-settings:
testifylint:
# TODO: enable all rules
disable:
- compares
- error-is-as
- expected-actual
- float-compare
- formatter
- go-require
- negative-positive
- require-error
enable-all: true

Expand Down
2 changes: 1 addition & 1 deletion Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ SEMCONVGEN := $(TOOLS_BIN_DIR)/semconvgen
SEMCONVKIT := $(TOOLS_BIN_DIR)/semconvkit
TESTIFYLINT := $(TOOLS_BIN_DIR)/testifylint

TESTIFYLINT_OPT?= --enable-all --disable=compares,error-is-as,expected-actual,float-compare,formatter,go-require,negative-positive,require-error
TESTIFYLINT_OPT?= --enable-all --disable=error-is-as,expected-actual,float-compare,formatter,go-require,require-error

.PHONY: install-tools
install-tools: $(TOOLS_BIN_NAMES)
Expand Down
2 changes: 1 addition & 1 deletion exporter/exporterhelper/retry_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func TestQueuedRetry_ThrottleError(t *testing.T) {
ocs.awaitAsyncProcessing()

// The initial backoff is 10ms, but because of the throttle this should wait at least 100ms.
assert.True(t, 100*time.Millisecond < time.Since(start))
assert.Less(t, 100*time.Millisecond, time.Since(start))

mockR.checkNumRequests(t, 2)
ocs.checkSendItemsCount(t, 2)
Expand Down
64 changes: 32 additions & 32 deletions internal/fanoutconsumer/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ func TestLogsMultiplexingNonMutating(t *testing.T) {
}
}

assert.True(t, ld == p1.AllLogs()[0])
assert.True(t, ld == p1.AllLogs()[1])
assert.Equal(t, ld, p1.AllLogs()[0])
assert.Equal(t, ld, p1.AllLogs()[1])
assert.EqualValues(t, ld, p1.AllLogs()[0])
assert.EqualValues(t, ld, p1.AllLogs()[1])

assert.True(t, ld == p2.AllLogs()[0])
assert.True(t, ld == p2.AllLogs()[1])
assert.Equal(t, ld, p2.AllLogs()[0])
assert.Equal(t, ld, p2.AllLogs()[1])
assert.EqualValues(t, ld, p2.AllLogs()[0])
assert.EqualValues(t, ld, p2.AllLogs()[1])

assert.True(t, ld == p3.AllLogs()[0])
assert.True(t, ld == p3.AllLogs()[1])
assert.Equal(t, ld, p3.AllLogs()[0])
assert.Equal(t, ld, p3.AllLogs()[1])
assert.EqualValues(t, ld, p3.AllLogs()[0])
assert.EqualValues(t, ld, p3.AllLogs()[1])

Expand All @@ -80,19 +80,19 @@ func TestLogsMultiplexingMutating(t *testing.T) {
}
}

assert.True(t, ld != p1.AllLogs()[0])
assert.True(t, ld != p1.AllLogs()[1])
assert.NotSame(t, ld, p1.AllLogs()[0])
assert.NotSame(t, ld, p1.AllLogs()[1])
assert.EqualValues(t, ld, p1.AllLogs()[0])
assert.EqualValues(t, ld, p1.AllLogs()[1])

assert.True(t, ld != p2.AllLogs()[0])
assert.True(t, ld != p2.AllLogs()[1])
assert.NotSame(t, ld, p2.AllLogs()[0])
assert.NotSame(t, ld, p2.AllLogs()[1])
assert.EqualValues(t, ld, p2.AllLogs()[0])
assert.EqualValues(t, ld, p2.AllLogs()[1])

// For this consumer, will receive the initial data.
assert.True(t, ld == p3.AllLogs()[0])
assert.True(t, ld == p3.AllLogs()[1])
assert.Equal(t, ld, p3.AllLogs()[0])
assert.Equal(t, ld, p3.AllLogs()[1])
assert.EqualValues(t, ld, p3.AllLogs()[0])
assert.EqualValues(t, ld, p3.AllLogs()[1])

Expand Down Expand Up @@ -121,18 +121,18 @@ func TestReadOnlyLogsMultiplexingMutating(t *testing.T) {

// All consumers should receive the cloned data.

assert.True(t, ld != p1.AllLogs()[0])
assert.True(t, ld != p1.AllLogs()[1])
assert.NotEqual(t, ld, p1.AllLogs()[0])
assert.NotEqual(t, ld, p1.AllLogs()[1])
assert.EqualValues(t, ldOrig, p1.AllLogs()[0])
assert.EqualValues(t, ldOrig, p1.AllLogs()[1])

assert.True(t, ld != p2.AllLogs()[0])
assert.True(t, ld != p2.AllLogs()[1])
assert.NotEqual(t, ld, p2.AllLogs()[0])
assert.NotEqual(t, ld, p2.AllLogs()[1])
assert.EqualValues(t, ldOrig, p2.AllLogs()[0])
assert.EqualValues(t, ldOrig, p2.AllLogs()[1])

assert.True(t, ld != p3.AllLogs()[0])
assert.True(t, ld != p3.AllLogs()[1])
assert.NotEqual(t, ld, p3.AllLogs()[0])
assert.NotEqual(t, ld, p3.AllLogs()[1])
assert.EqualValues(t, ldOrig, p3.AllLogs()[0])
assert.EqualValues(t, ldOrig, p3.AllLogs()[1])
}
Expand All @@ -154,20 +154,20 @@ func TestLogsMultiplexingMixLastMutating(t *testing.T) {
}
}

assert.True(t, ld != p1.AllLogs()[0])
assert.True(t, ld != p1.AllLogs()[1])
assert.NotSame(t, ld, p1.AllLogs()[0])
assert.NotSame(t, ld, p1.AllLogs()[1])
assert.EqualValues(t, ld, p1.AllLogs()[0])
assert.EqualValues(t, ld, p1.AllLogs()[1])

// For this consumer, will receive the initial data.
assert.True(t, ld == p2.AllLogs()[0])
assert.True(t, ld == p2.AllLogs()[1])
assert.Equal(t, ld, p2.AllLogs()[0])
assert.Equal(t, ld, p2.AllLogs()[1])
assert.EqualValues(t, ld, p2.AllLogs()[0])
assert.EqualValues(t, ld, p2.AllLogs()[1])

// For this consumer, will clone the initial data.
assert.True(t, ld != p3.AllLogs()[0])
assert.True(t, ld != p3.AllLogs()[1])
assert.NotSame(t, ld, p3.AllLogs()[0])
assert.NotSame(t, ld, p3.AllLogs()[1])
assert.EqualValues(t, ld, p3.AllLogs()[0])
assert.EqualValues(t, ld, p3.AllLogs()[1])

Expand All @@ -192,19 +192,19 @@ func TestLogsMultiplexingMixLastNonMutating(t *testing.T) {
}
}

assert.True(t, ld != p1.AllLogs()[0])
assert.True(t, ld != p1.AllLogs()[1])
assert.NotSame(t, ld, p1.AllLogs()[0])
assert.NotSame(t, ld, p1.AllLogs()[1])
assert.EqualValues(t, ld, p1.AllLogs()[0])
assert.EqualValues(t, ld, p1.AllLogs()[1])

assert.True(t, ld != p2.AllLogs()[0])
assert.True(t, ld != p2.AllLogs()[1])
assert.NotSame(t, ld, p2.AllLogs()[0])
assert.NotSame(t, ld, p2.AllLogs()[1])
assert.EqualValues(t, ld, p2.AllLogs()[0])
assert.EqualValues(t, ld, p2.AllLogs()[1])

// For this consumer, will receive the initial data.
assert.True(t, ld == p3.AllLogs()[0])
assert.True(t, ld == p3.AllLogs()[1])
assert.Equal(t, ld, p3.AllLogs()[0])
assert.Equal(t, ld, p3.AllLogs()[1])
assert.EqualValues(t, ld, p3.AllLogs()[0])
assert.EqualValues(t, ld, p3.AllLogs()[1])

Expand All @@ -224,8 +224,8 @@ func TestLogsWhenErrors(t *testing.T) {
assert.Error(t, lfc.ConsumeLogs(context.Background(), ld))
}

assert.True(t, ld == p3.AllLogs()[0])
assert.True(t, ld == p3.AllLogs()[1])
assert.Equal(t, ld, p3.AllLogs()[0])
assert.Equal(t, ld, p3.AllLogs()[1])
assert.EqualValues(t, ld, p3.AllLogs()[0])
assert.EqualValues(t, ld, p3.AllLogs()[1])
}
Expand Down
64 changes: 32 additions & 32 deletions internal/fanoutconsumer/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ func TestMetricsMultiplexingNonMutating(t *testing.T) {
}
}

assert.True(t, md == p1.AllMetrics()[0])
assert.True(t, md == p1.AllMetrics()[1])
assert.Equal(t, md, p1.AllMetrics()[0])
assert.Equal(t, md, p1.AllMetrics()[1])
assert.EqualValues(t, md, p1.AllMetrics()[0])
assert.EqualValues(t, md, p1.AllMetrics()[1])

assert.True(t, md == p2.AllMetrics()[0])
assert.True(t, md == p2.AllMetrics()[1])
assert.Equal(t, md, p2.AllMetrics()[0])
assert.Equal(t, md, p2.AllMetrics()[1])
assert.EqualValues(t, md, p2.AllMetrics()[0])
assert.EqualValues(t, md, p2.AllMetrics()[1])

assert.True(t, md == p3.AllMetrics()[0])
assert.True(t, md == p3.AllMetrics()[1])
assert.Equal(t, md, p3.AllMetrics()[0])
assert.Equal(t, md, p3.AllMetrics()[1])
assert.EqualValues(t, md, p3.AllMetrics()[0])
assert.EqualValues(t, md, p3.AllMetrics()[1])

Expand All @@ -80,19 +80,19 @@ func TestMetricsMultiplexingMutating(t *testing.T) {
}
}

assert.True(t, md != p1.AllMetrics()[0])
assert.True(t, md != p1.AllMetrics()[1])
assert.NotSame(t, md, p1.AllMetrics()[0])
assert.NotSame(t, md, p1.AllMetrics()[1])
assert.EqualValues(t, md, p1.AllMetrics()[0])
assert.EqualValues(t, md, p1.AllMetrics()[1])

assert.True(t, md != p2.AllMetrics()[0])
assert.True(t, md != p2.AllMetrics()[1])
assert.NotSame(t, md, p2.AllMetrics()[0])
assert.NotSame(t, md, p2.AllMetrics()[1])
assert.EqualValues(t, md, p2.AllMetrics()[0])
assert.EqualValues(t, md, p2.AllMetrics()[1])

// For this consumer, will receive the initial data.
assert.True(t, md == p3.AllMetrics()[0])
assert.True(t, md == p3.AllMetrics()[1])
assert.Equal(t, md, p3.AllMetrics()[0])
assert.Equal(t, md, p3.AllMetrics()[1])
assert.EqualValues(t, md, p3.AllMetrics()[0])
assert.EqualValues(t, md, p3.AllMetrics()[1])

Expand Down Expand Up @@ -121,18 +121,18 @@ func TestReadOnlyMetricsMultiplexingMixFirstMutating(t *testing.T) {

// All consumers should receive the cloned data.

assert.True(t, md != p1.AllMetrics()[0])
assert.True(t, md != p1.AllMetrics()[1])
assert.NotEqual(t, md, p1.AllMetrics()[0])
assert.NotEqual(t, md, p1.AllMetrics()[1])
assert.EqualValues(t, mdOrig, p1.AllMetrics()[0])
assert.EqualValues(t, mdOrig, p1.AllMetrics()[1])

assert.True(t, md != p2.AllMetrics()[0])
assert.True(t, md != p2.AllMetrics()[1])
assert.NotEqual(t, md, p2.AllMetrics()[0])
assert.NotEqual(t, md, p2.AllMetrics()[1])
assert.EqualValues(t, mdOrig, p2.AllMetrics()[0])
assert.EqualValues(t, mdOrig, p2.AllMetrics()[1])

assert.True(t, md != p3.AllMetrics()[0])
assert.True(t, md != p3.AllMetrics()[1])
assert.NotEqual(t, md, p3.AllMetrics()[0])
assert.NotEqual(t, md, p3.AllMetrics()[1])
assert.EqualValues(t, mdOrig, p3.AllMetrics()[0])
assert.EqualValues(t, mdOrig, p3.AllMetrics()[1])
}
Expand All @@ -154,20 +154,20 @@ func TestMetricsMultiplexingMixLastMutating(t *testing.T) {
}
}

assert.True(t, md != p1.AllMetrics()[0])
assert.True(t, md != p1.AllMetrics()[1])
assert.NotSame(t, md, p1.AllMetrics()[0])
assert.NotSame(t, md, p1.AllMetrics()[1])
assert.EqualValues(t, md, p1.AllMetrics()[0])
assert.EqualValues(t, md, p1.AllMetrics()[1])

// For this consumer, will receive the initial data.
assert.True(t, md == p2.AllMetrics()[0])
assert.True(t, md == p2.AllMetrics()[1])
assert.Equal(t, md, p2.AllMetrics()[0])
assert.Equal(t, md, p2.AllMetrics()[1])
assert.EqualValues(t, md, p2.AllMetrics()[0])
assert.EqualValues(t, md, p2.AllMetrics()[1])

// For this consumer, will clone the initial data.
assert.True(t, md != p3.AllMetrics()[0])
assert.True(t, md != p3.AllMetrics()[1])
assert.NotSame(t, md, p3.AllMetrics()[0])
assert.NotSame(t, md, p3.AllMetrics()[1])
assert.EqualValues(t, md, p3.AllMetrics()[0])
assert.EqualValues(t, md, p3.AllMetrics()[1])

Expand All @@ -192,19 +192,19 @@ func TestMetricsMultiplexingMixLastNonMutating(t *testing.T) {
}
}

assert.True(t, md != p1.AllMetrics()[0])
assert.True(t, md != p1.AllMetrics()[1])
assert.NotSame(t, md, p1.AllMetrics()[0])
assert.NotSame(t, md, p1.AllMetrics()[1])
assert.EqualValues(t, md, p1.AllMetrics()[0])
assert.EqualValues(t, md, p1.AllMetrics()[1])

assert.True(t, md != p2.AllMetrics()[0])
assert.True(t, md != p2.AllMetrics()[1])
assert.NotSame(t, md, p2.AllMetrics()[0])
assert.NotSame(t, md, p2.AllMetrics()[1])
assert.EqualValues(t, md, p2.AllMetrics()[0])
assert.EqualValues(t, md, p2.AllMetrics()[1])

// For this consumer, will receive the initial data.
assert.True(t, md == p3.AllMetrics()[0])
assert.True(t, md == p3.AllMetrics()[1])
assert.Equal(t, md, p3.AllMetrics()[0])
assert.Equal(t, md, p3.AllMetrics()[1])
assert.EqualValues(t, md, p3.AllMetrics()[0])
assert.EqualValues(t, md, p3.AllMetrics()[1])

Expand All @@ -224,8 +224,8 @@ func TestMetricsWhenErrors(t *testing.T) {
assert.Error(t, mfc.ConsumeMetrics(context.Background(), md))
}

assert.True(t, md == p3.AllMetrics()[0])
assert.True(t, md == p3.AllMetrics()[1])
assert.Equal(t, md, p3.AllMetrics()[0])
assert.Equal(t, md, p3.AllMetrics()[1])
assert.EqualValues(t, md, p3.AllMetrics()[0])
assert.EqualValues(t, md, p3.AllMetrics()[1])
}
Expand Down
Loading
Loading