Skip to content

Commit

Permalink
[chore]: enable go-require rule from testifylint
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
  • Loading branch information
mmorel-35 committed Sep 14, 2024
1 parent c52a9a7 commit bf6aedd
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 103 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ linters-settings:
disable:
- float-compare
- formatter
- go-require
- require-error
- suite-subtest-run
- useless-assert
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,go-require,require-error,suite-subtest-run,useless-assert
TESTIFYLINT_OPT?= --enable-all --disable=float-compare,formatter,require-error,suite-subtest-run,useless-assert

# BUILD_TYPE should be one of (dev, release).
BUILD_TYPE?=release
Expand Down
3 changes: 2 additions & 1 deletion receiver/apachereceiver/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenttest"
Expand Down Expand Up @@ -189,7 +190,7 @@ Load15: 0.3
Total Duration: 1501
Scoreboard: S_DD_L_GGG_____W__IIII_C________________W__________________________________.........................____WR______W____W________________________C______________________________________W_W____W______________R_________R________C_________WK_W________K_____W__C__________W___R______.............................................................................................................................
`))
require.NoError(t, err)
assert.NoError(t, err)
return
}
rw.WriteHeader(404)
Expand Down
51 changes: 26 additions & 25 deletions receiver/apachesparkreceiver/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"strings"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenttest"
Expand Down Expand Up @@ -82,7 +83,7 @@ func TestClusterStats(t *testing.T) {
w.WriteHeader(http.StatusUnauthorized)
} else {
_, err := w.Write(data)
require.NoError(t, err)
assert.NoError(t, err)
}
}))
defer ts.Close()
Expand All @@ -102,11 +103,11 @@ func TestClusterStats(t *testing.T) {
var err error
if strings.HasSuffix(r.RequestURI, "/metrics/json") {
_, err = w.Write([]byte("[{}]"))
require.NoError(t, err)
assert.NoError(t, err)
} else {
_, err = w.Write(data)
}
require.NoError(t, err)
assert.NoError(t, err)
}))
defer ts.Close()

Expand All @@ -125,9 +126,9 @@ func TestClusterStats(t *testing.T) {
var err error
if strings.HasSuffix(r.RequestURI, "/metrics/json") {
_, err = w.Write(data)
require.NoError(t, err)
assert.NoError(t, err)
}
require.NoError(t, err)
assert.NoError(t, err)
}))
defer ts.Close()

Expand Down Expand Up @@ -165,7 +166,7 @@ func TestApplications(t *testing.T) {
w.WriteHeader(http.StatusUnauthorized)
} else {
_, err := w.Write(data)
require.NoError(t, err)
assert.NoError(t, err)
}
}))
defer ts.Close()
Expand All @@ -185,11 +186,11 @@ func TestApplications(t *testing.T) {
var err error
if strings.HasSuffix(r.RequestURI, "applications") {
_, err = w.Write([]byte(""))
require.NoError(t, err)
assert.NoError(t, err)
} else {
_, err = w.Write(data)
}
require.NoError(t, err)
assert.NoError(t, err)
}))
defer ts.Close()

Expand All @@ -208,9 +209,9 @@ func TestApplications(t *testing.T) {
var err error
if strings.HasSuffix(r.RequestURI, "applications") {
_, err = w.Write(data)
require.NoError(t, err)
assert.NoError(t, err)
}
require.NoError(t, err)
assert.NoError(t, err)
}))
defer ts.Close()

Expand Down Expand Up @@ -248,7 +249,7 @@ func TestStageStats(t *testing.T) {
w.WriteHeader(http.StatusUnauthorized)
} else {
_, err := w.Write(data)
require.NoError(t, err)
assert.NoError(t, err)
}
}))
defer ts.Close()
Expand All @@ -268,11 +269,11 @@ func TestStageStats(t *testing.T) {
var err error
if strings.HasSuffix(r.RequestURI, "stages") {
_, err = w.Write([]byte(""))
require.NoError(t, err)
assert.NoError(t, err)
} else {
_, err = w.Write(data)
}
require.NoError(t, err)
assert.NoError(t, err)
}))
defer ts.Close()

Expand All @@ -291,9 +292,9 @@ func TestStageStats(t *testing.T) {
var err error
if strings.HasSuffix(r.RequestURI, "stages") {
_, err = w.Write(data)
require.NoError(t, err)
assert.NoError(t, err)
}
require.NoError(t, err)
assert.NoError(t, err)
}))
defer ts.Close()

Expand Down Expand Up @@ -331,7 +332,7 @@ func TestExecutorStats(t *testing.T) {
w.WriteHeader(http.StatusUnauthorized)
} else {
_, err := w.Write(data)
require.NoError(t, err)
assert.NoError(t, err)
}
}))
defer ts.Close()
Expand All @@ -351,11 +352,11 @@ func TestExecutorStats(t *testing.T) {
var err error
if strings.HasSuffix(r.RequestURI, "executors") {
_, err = w.Write([]byte(""))
require.NoError(t, err)
assert.NoError(t, err)
} else {
_, err = w.Write(data)
}
require.NoError(t, err)
assert.NoError(t, err)
}))
defer ts.Close()

Expand All @@ -374,9 +375,9 @@ func TestExecutorStats(t *testing.T) {
var err error
if strings.HasSuffix(r.RequestURI, "executors") {
_, err = w.Write(data)
require.NoError(t, err)
assert.NoError(t, err)
}
require.NoError(t, err)
assert.NoError(t, err)
}))
defer ts.Close()

Expand Down Expand Up @@ -414,7 +415,7 @@ func TestJobStats(t *testing.T) {
w.WriteHeader(http.StatusUnauthorized)
} else {
_, err := w.Write(data)
require.NoError(t, err)
assert.NoError(t, err)
}
}))
defer ts.Close()
Expand All @@ -434,11 +435,11 @@ func TestJobStats(t *testing.T) {
var err error
if strings.HasSuffix(r.RequestURI, "jobs") {
_, err = w.Write([]byte(""))
require.NoError(t, err)
assert.NoError(t, err)
} else {
_, err = w.Write(data)
}
require.NoError(t, err)
assert.NoError(t, err)
}))
defer ts.Close()

Expand All @@ -457,9 +458,9 @@ func TestJobStats(t *testing.T) {
var err error
if strings.HasSuffix(r.RequestURI, "jobs") {
_, err = w.Write(data)
require.NoError(t, err)
assert.NoError(t, err)
}
require.NoError(t, err)
assert.NoError(t, err)
}))
defer ts.Close()

Expand Down
Loading

0 comments on commit bf6aedd

Please sign in to comment.