Add a presubmit to restrict test only libraries from linking into prod binaries #115175
Labels
area/test-infra
help wanted
Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
priority/backlog
Higher priority than priority/awaiting-more-evidence.
sig/testing
Categorizes an issue or PR as relevant to SIG Testing.
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
We have many "test only" packages through out the project, containing fixtures, helpers, utilities, etc... These test libraries are not intended for use in production binaries. They often lack rigorous review and sufficient testing for use in production binaries. We should make sure they don't accidentally get pulled in.
Strawman proposal, test only packages must import "testing". Blank import is sufficient:
Then write a presubmit that fails if we find
testing.init
symbol in the release binary.This approach is trivial and fairly effective although a more sophisticated approach could print a dep chain.
The text was updated successfully, but these errors were encountered: