Skip to content

TestClientSupportedCompressors fails if other tests register compressors #7960

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

Open
arjan-bal opened this issue Dec 23, 2024 · 1 comment
Open
Assignees
Labels
Area: Testing Includes tests and testing utilities that we have for unit and e2e tests within our repo. P2 Type: Testing

Comments

@arjan-bal
Copy link
Contributor

arjan-bal commented Dec 23, 2024

While adding a new compressor test in #7938, it was seen that registering a new compressor during one test causes TestClientSupportedCompressors to fail. TestClientSupportedCompressors verifies the list of compressors supported by clients. If a test compressor is registered in the same test file, it shows up in the list of supported compressors, failing the test, example failure logs.

There is a deprecated WithCompressor, dial option that can be used without registering a compressor. We should find a way to ensure that tests don't influence each other in such a way.

@arjan-bal arjan-bal added Type: Bug Area: Testing Includes tests and testing utilities that we have for unit and e2e tests within our repo. labels Dec 23, 2024
@arjan-bal
Copy link
Contributor Author

arjan-bal commented Jan 15, 2025

@easwars I wanted to make the expected changes more concrete for someone else to pick up. One approach I could think of is:

  1. Add a function named something like RegisterCompressorForTest(c Codec) func() in the internal package which returns a cleanup function that can be called to unregister/revert to the original codec after the test.
  2. Make the codec package set the above function in an init() method.
  3. Use the RegisterCompressorForTest in tests.

Does this sound good to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Testing Includes tests and testing utilities that we have for unit and e2e tests within our repo. P2 Type: Testing
Projects
None yet
Development

No branches or pull requests

2 participants