Added customization of GrpcTransport to JUnit4 & JUnit5 support#636
Added customization of GrpcTransport to JUnit4 & JUnit5 support#636alex268 merged 1 commit intoydb-platform:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a GrpcTransport customization hook across the test helper stack so JUnit4 rules and JUnit5 extensions can create transports with caller-provided GrpcTransportBuilder tweaks (e.g., application name), and updates integration tests/mocks accordingly.
Changes:
- Introduces
YdbHelper.TransportCustomizerand a newcreateTransport(TransportCustomizer)path used by helper factories. - Adds
withGrpcTransportCustomizer(...)to JUnit4GrpcTransportRuleand JUnit5GrpcTransportExtension. - Updates integration tests and
GrpcTransportMockto cover/customize transport builder options.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/junit5-support/src/main/java/tech/ydb/test/junit5/GrpcTransportExtension.java | Adds extension-level transport customizer plumbing into helper transport creation. |
| tests/junit4-support/src/main/java/tech/ydb/test/junit4/GrpcTransportRule.java | Adds rule-level transport customizer plumbing into helper transport creation. |
| tests/common/src/main/java/tech/ydb/test/integration/YdbHelper.java | Defines TransportCustomizer and adds a customizable createTransport(...) API surface. |
| tests/common/src/main/java/tech/ydb/test/integration/docker/DockerHelperFactory.java | Applies the customizer to the GrpcTransportBuilder when creating transports. |
| tests/common/src/main/java/tech/ydb/test/integration/docker/ProxedDockerHelperFactory.java | Applies the customizer to the GrpcTransportBuilder in proxied docker setup. |
| tests/common/src/main/java/tech/ydb/test/integration/external/ExternalHelperFactory.java | Applies the customizer after auth/TLS builder configuration. |
| tests/common/src/main/java/tech/ydb/test/integration/utils/ProxyYdbHelper.java | Proxies the new createTransport(TransportCustomizer) method. |
| tests/common/src/test/java/tech/ydb/test/integration/YdbHelperFactoryTest.java | Adds test coverage for transport customization via helper factory. |
| tests/common/src/test/java/tech/ydb/test/integration/ProxyDockerTest.java | Adds test coverage for customization in proxied docker scenario. |
| tests/common/src/test/java/tech/ydb/test/integration/GrpcTransportMock.java | Extends builder mocking to support new builder calls used by customizers. |
| tests/common/src/test/java/tech/ydb/test/integration/DockerHelperFactoryTest.java | Updates one test to exercise the customizable transport creation. |
Comments suppressed due to low confidence (1)
tests/junit4-support/src/main/java/tech/ydb/test/junit4/GrpcTransportRule.java:74
proxy.set(null)is only executed ifbase.evaluate()completes normally. If the test throws, the rule will leave the proxy pointing at a (soon-to-be closed) transport, which can leak into later assertions or error handling. Move the proxy cleanup into afinally(set before evaluate, clear in finally) so it always resets even on failures.
try (YdbHelper helper = factory.createHelper()) {
try (GrpcTransport transport = helper.createTransport(customizer)) {
proxy.set(transport);
base.evaluate();
proxy.set(null);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #636 +/- ##
============================================
+ Coverage 70.58% 70.62% +0.04%
- Complexity 3291 3292 +1
============================================
Files 371 372 +1
Lines 15628 15640 +12
Branches 1635 1638 +3
============================================
+ Hits 11031 11046 +15
+ Misses 3944 3943 -1
+ Partials 653 651 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.