From 8d7e04d8d028fd6eb6067eb4a132d75352e4c805 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Thu, 12 Sep 2024 23:31:00 +0200 Subject: [PATCH] [chore]: enable suite-dont-use-pkg rule from testifylint (#35041) #### Description Testifylint is a linter that provides best practices with the use of testify. This PR enables [suite-dont-use-pkg](https://github.com/Antonboom/testifylint?tab=readme-ov-file#suite-dont-use-pkg) rule from [testifylint](https://github.com/Antonboom/testifylint) Signed-off-by: Matthieu MOREL --- .golangci.yml | 1 - Makefile.Common | 2 +- receiver/jmxreceiver/integration_test.go | 4 ++-- receiver/jmxreceiver/internal/subprocess/integration_test.go | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index af0eb1535b7d..ec43cda68833 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -138,7 +138,6 @@ linters-settings: - formatter - go-require - require-error - - suite-dont-use-pkg - suite-subtest-run - useless-assert enable-all: true diff --git a/Makefile.Common b/Makefile.Common index c3b7d830102c..2e9b53cfe422 100644 --- a/Makefile.Common +++ b/Makefile.Common @@ -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-dont-use-pkg,suite-subtest-run,useless-assert +TESTIFYLINT_OPT?= --enable-all --disable=float-compare,formatter,go-require,require-error,suite-subtest-run,useless-assert # BUILD_TYPE should be one of (dev, release). BUILD_TYPE?=release diff --git a/receiver/jmxreceiver/integration_test.go b/receiver/jmxreceiver/integration_test.go index fbb744692a24..5a2a90fb8d60 100644 --- a/receiver/jmxreceiver/integration_test.go +++ b/receiver/jmxreceiver/integration_test.go @@ -52,13 +52,13 @@ func (suite *JMXIntegrationSuite) SetupSuite() { for version, url := range jmxJarReleases { jarPath, err := downloadJMXMetricGathererJAR(url) suite.VersionToJar[version] = jarPath - require.NoError(suite.T(), err) + suite.Require().NoError(err) } } func (suite *JMXIntegrationSuite) TearDownSuite() { for _, path := range suite.VersionToJar { - require.NoError(suite.T(), os.Remove(path)) + suite.Require().NoError(os.Remove(path)) } } diff --git a/receiver/jmxreceiver/internal/subprocess/integration_test.go b/receiver/jmxreceiver/internal/subprocess/integration_test.go index 95c462f0a1e3..42d099eec4d4 100644 --- a/receiver/jmxreceiver/internal/subprocess/integration_test.go +++ b/receiver/jmxreceiver/internal/subprocess/integration_test.go @@ -53,7 +53,7 @@ func (suite *SubprocessIntegrationSuite) SetupSuite() { } func (suite *SubprocessIntegrationSuite) TearDownSuite() { - require.NoError(suite.T(), os.Remove(suite.scriptPath)) + suite.Require().NoError(os.Remove(suite.scriptPath)) } // prepareSubprocess will create a Subprocess based on a temporary script.