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

Support Test Suites #23

Open
mvrahden opened this issue Aug 10, 2022 · 0 comments
Open

Support Test Suites #23

mvrahden opened this issue Aug 10, 2022 · 0 comments

Comments

@mvrahden
Copy link

mvrahden commented Aug 10, 2022

I believe the linter fails on detecting os.Setenv calls in more advanced scenarios. Here's one:

func TestModelSuite(t *testing.T) {
	suite.Run(t, &MySuite{})
}

func (s *MySuite) SetupTest() {
	// ... some setup code

	s.NoError(os.Setenv("AWS_XRAY_SDK_DISABLED", "true")) // want "some linting error to detect this"

	// ... more setup code
}

FIY: The test suite here is from stretchr/testify should that help you pinpoint the issue.

The solution should look like this:

	s.T().Setenv("AWS_XRAY_SDK_DISABLED", "true")

As you can see, T() will return the *testing.T instance. So your linter should be sensible to this case as well :)

And just for clarity: I have the configuration parameter all set to true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant