Skip to content

Commit

Permalink
[chore]: enable useless-assert rule from testifylint
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <[email protected]>
  • Loading branch information
mmorel-35 committed Sep 16, 2024
1 parent 66f6f06 commit f04926e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ linters-settings:
- formatter
- require-error
- suite-subtest-run
- useless-assert
enable-all: true

linters:
Expand Down
2 changes: 1 addition & 1 deletion Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ GOTESTSUM := $(TOOLS_BIN_DIR)/gotestsum
TESTIFYLINT := $(TOOLS_BIN_DIR)/testifylint

GOTESTSUM_OPT?= --rerun-fails=1
TESTIFYLINT_OPT?= --enable-all --disable=float-compare,formatter,require-error,suite-subtest-run,useless-assert
TESTIFYLINT_OPT?= --enable-all --disable=float-compare,formatter,require-error,suite-subtest-run

# BUILD_TYPE should be one of (dev, release).
BUILD_TYPE?=release
Expand Down
3 changes: 2 additions & 1 deletion exporter/dorisexporter/exporter_logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/plog"
Expand Down Expand Up @@ -52,7 +53,7 @@ func TestPushLogData(t *testing.T) {
_, _ = w.Write([]byte(`{"Status":"Success"}`))
})
err = server.ListenAndServe()
require.Equal(t, http.ErrServerClosed, err)
assert.Equal(t, http.ErrServerClosed, err)
}()

err0 := fmt.Errorf("Not Started")
Expand Down
3 changes: 2 additions & 1 deletion exporter/dorisexporter/exporter_traces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"
Expand Down Expand Up @@ -52,7 +53,7 @@ func TestPushTraceData(t *testing.T) {
_, _ = w.Write([]byte(`{"Status":"Success"}`))
})
err = server.ListenAndServe()
require.Equal(t, http.ErrServerClosed, err)
assert.Equal(t, http.ErrServerClosed, err)
}()

err0 := fmt.Errorf("Not Started")
Expand Down
2 changes: 1 addition & 1 deletion exporter/dorisexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func createLogsExporter(ctx context.Context, set exporter.Settings, cfg componen
exporterhelper.WithStart(exporter.start),
exporterhelper.WithShutdown(exporter.shutdown),
// we config the timeout option in http client, so we don't need to set timeout here
exporterhelper.WithTimeout(exporterhelper.TimeoutSettings{Timeout: 0}),
exporterhelper.WithTimeout(exporterhelper.TimeoutConfig{Timeout: 0}),
exporterhelper.WithQueue(c.QueueSettings),
exporterhelper.WithRetry(c.BackOffConfig),
)
Expand Down
2 changes: 0 additions & 2 deletions exporter/kineticaexporter/exporter_metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ func TestExporter_pushMetricsData(t *testing.T) {
t.Run("push success", func(t *testing.T) {
exporter := newTestMetricsExporter(t)
mustPushMetricsData(t, exporter, simpleMetrics(3))

require.Equal(t, 15, 15)
})
}

Expand Down
2 changes: 1 addition & 1 deletion extension/storage/filestorage/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestClientBatchOperations(t *testing.T) {
// Make sure nothing is there
err = client.Batch(ctx, testGetEntries...)
require.NoError(t, err)
require.Equal(t, testGetEntries, testGetEntries)
require.Equal(t, testSetEntries, testGetEntries)

// Set it
err = client.Batch(ctx, testSetEntries...)
Expand Down
6 changes: 4 additions & 2 deletions pkg/translator/opencensus/resource_to_oc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,10 @@ func TestResourceToOCAndBack(t *testing.T) {
} else {
assert.Equal(t, strconv.FormatInt(v.Int(), 10), a.Str())
}
case pcommon.ValueTypeMap, pcommon.ValueTypeSlice:
assert.Equal(t, a, a)
case pcommon.ValueTypeMap:
assert.Equal(t, v, a)
case pcommon.ValueTypeSlice:
assert.ElementsMatch(t, v, a)
default:
assert.Equal(t, v, a)
}
Expand Down

0 comments on commit f04926e

Please sign in to comment.