Skip to content

Added customization of GrpcTransport to JUnit4 & JUnit5 support#636

Merged
alex268 merged 1 commit intoydb-platform:masterfrom
alex268:master
Apr 17, 2026
Merged

Added customization of GrpcTransport to JUnit4 & JUnit5 support#636
alex268 merged 1 commit intoydb-platform:masterfrom
alex268:master

Conversation

@alex268
Copy link
Copy Markdown
Member

@alex268 alex268 commented Apr 17, 2026

No description provided.

@alex268 alex268 requested a review from pnv1 April 17, 2026 13:17
@pnv1 pnv1 requested a review from Copilot April 17, 2026 13:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.TransportCustomizer and a new createTransport(TransportCustomizer) path used by helper factories.
  • Adds withGrpcTransportCustomizer(...) to JUnit4 GrpcTransportRule and JUnit5 GrpcTransportExtension.
  • Updates integration tests and GrpcTransportMock to 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 if base.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 a finally (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.

Comment thread tests/common/src/test/java/tech/ydb/test/integration/DockerHelperFactoryTest.java Outdated
Comment thread tests/common/src/main/java/tech/ydb/test/integration/YdbHelper.java
Comment thread tests/common/src/main/java/tech/ydb/test/integration/YdbHelper.java Outdated
Comment thread tests/common/src/main/java/tech/ydb/test/integration/YdbHelper.java Outdated
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 17, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.62%. Comparing base (545de5e) to head (50fedc4).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...main/java/tech/ydb/test/integration/YdbHelper.java 0.00% 1 Missing ⚠️
...ech/ydb/test/integration/utils/ProxyYdbHelper.java 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alex268 alex268 merged commit 41369f3 into ydb-platform:master Apr 17, 2026
10 checks passed
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.

4 participants