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

Rename test package to parser_test #149

Closed
wants to merge 1 commit into from

Conversation

elezar
Copy link
Contributor

@elezar elezar commented Aug 4, 2023

This change renames the package for parser tests to parser_test to further limit the dependencies that are required by downstream consumers.

See the discussion here: kubernetes-sigs/kind#3290 (comment)

@elezar elezar requested review from klihub and bart0sh August 4, 2023 13:53
This change renames the package for parser tests to
parser_test to further limit the dependencies that are
required by downstream consumers.

Signed-off-by: Evan Lezar <[email protected]>
@bart0sh
Copy link
Contributor

bart0sh commented Aug 6, 2023

@elezar Did you test if it actually works? I thought that go get doesn't add test dependencies by default. It has optional -t command line switch to download test dependencies, but it's optional.

@elezar
Copy link
Contributor Author

elezar commented Aug 8, 2023

I didn't have a chance to test this yet. I will do so and report back.

@klihub
Copy link
Contributor

klihub commented Aug 8, 2023

LGTM. I think whenever possible/reasonable (IOW, unless there is a lot of complex unexported code that warrants dedicated unit testing), it is a good idea to put tests into it's own package namespace. This happens automatically if/when ginkgo/gomega is used.

@pohly
Copy link
Contributor

pohly commented Aug 8, 2023

it is a good idea to put tests into it's own package namespace. This happens automatically if/when ginkgo/gomega is used.

Is that so? Nothing prevents someone from writing a foo_test.go with package foo where ginkgo/gomega are used to test unexported symbols.

@klihub
Copy link
Contributor

klihub commented Aug 15, 2023

it is a good idea to put tests into it's own package namespace. This happens automatically if/when ginkgo/gomega is used.

Is that so? Nothing prevents someone from writing a foo_test.go with package foo where ginkgo/gomega are used to test unexported symbols.

I've always ginkgo bootstrapped test suites (without extra options) and then you end up with ${pkg}_test as the package for the test suite. Now that I checked the docs indeed state, that "Ginkgo defaults to setting up the suite as a *_test package to encourage you to only test the external behavior of your package, not its internal implementation details.". So you are right that the default behavior is not mandatory and can be overridden.

@klihub
Copy link
Contributor

klihub commented Aug 15, 2023

LGTM.

Copy link
Contributor

@marquiz marquiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elezar elezar marked this pull request as draft September 27, 2023 09:15
@elezar elezar closed this Mar 1, 2024
@elezar elezar deleted the improve-test-dependencies branch March 1, 2024 16:14
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

Successfully merging this pull request may close these issues.

5 participants