Skip to content

test: Improve unit test coverage + fix Dubbo global state contamination#1549

Open
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-error-in-sofa-rpc-1548
Open

test: Improve unit test coverage + fix Dubbo global state contamination#1549
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-error-in-sofa-rpc-1548

Conversation

Copy link
Contributor

Copilot AI commented Mar 19, 2026

Adds comprehensive unit test coverage across multiple SOFA-RPC modules and fixes a test isolation bug in the Dubbo bootstrap tests where FrameworkModel global state leaked between test classes when Surefire ran them in the same JVM.

New test coverage

  • core-impl: RegistryRouter, DirectUrlRouter, Cluster, Filter
  • core/api: Exception handling, utility classes
  • remoting-bolt: Transport, connection management
  • remoting-http: HTTP/2 transport and handlers
  • remoting-resteasy: REST adapter, client builder
  • codec: Jackson and Fury serializers
  • registry: Consul, Mesh, Polaris implementations
  • bootstrap: REST, Triple, Dubbo
  • tracer: OpenTracing REST and Triple
  • fault-hystrix: Circuit breaker integration
  • doc-swagger: Swagger generator
  • compiler: Triple protocol code generator

Dubbo global state fix

DubboConsumerBootstrapTest and DubboProviderBootstrapTest were initializing Dubbo's FrameworkModel in STRICT mode (the default), leaving ApplicationConfig registrations behind that caused DubboServerTest to fail when run in the same JVM.

Added @BeforeClass/@AfterClass lifecycle hooks to both classes:

@BeforeClass
public static void setUpClass() {
    System.setProperty(ConfigKeys.DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE, "true");
    System.setProperty(ConfigKeys.DUBBO_CONFIG_MODE, ConfigMode.IGNORE.name());
}

@AfterClass
public static void tearDownClass() {
    FrameworkModel.defaultModel().destroy(); // releases ports + ApplicationConfig registrations
    System.clearProperty(ConfigKeys.DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE);
    System.clearProperty(ConfigKeys.DUBBO_CONFIG_MODE);
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

sunhailin-Leo and others added 2 commits March 19, 2026 07:07
This commit consolidates all unit test improvements made across the SOFA-RPC project.

Modules with new or expanded tests:
- core-impl: Router tests (RegistryRouter, DirectUrlRouter), Cluster tests, Filter tests
- core/api: Exception handling and utility class tests
- remoting-bolt: Transport and connection management tests
- remoting-http: HTTP/2 transport and handler tests
- remoting-resteasy: REST adapter and client builder tests
- codec: Jackson and Fury serializer tests
- registry: Consul, Mesh, Polaris registry implementation tests
- bootstrap: REST, Triple, Dubbo bootstrap tests
- tracer: OpenTracing REST and Triple tracer tests
- fault-hystrix: Circuit breaker integration tests
- doc-swagger: Swagger generator tests
- compiler: Triple protocol code generator tests

Test infrastructure improvements:
- Added JUnit dependency to bootstrap-rest module
- Fixed package declarations in ConsulConstantsTest
- Removed duplicate and redundant test classes

Final coverage: 393 test files / 578 source files = 0.68:1 ratio

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: sunhailin-Leo <17564655+sunhailin-Leo@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error in https://github.com/sofastack/sofa-rpc/pull/1548 Fix Dubbo global state contamination breaking DubooServerTest (PR #1548) Mar 19, 2026
Copilot AI requested a review from sunhailin-Leo March 19, 2026 07:18
@sunhailin-Leo sunhailin-Leo marked this pull request as ready for review March 19, 2026 07:38
Copilot stopped work on behalf of sunhailin-Leo due to an error March 19, 2026 07:40
Copilot AI changed the title Fix Dubbo global state contamination breaking DubooServerTest (PR #1548) Fix Dubbo global state contamination breaking DubooServerTest Mar 19, 2026
Copilot AI changed the title Fix Dubbo global state contamination breaking DubooServerTest Combine PR #1548 test improvements with Dubbo global state isolation fix Mar 19, 2026
Copilot AI changed the title Combine PR #1548 test improvements with Dubbo global state isolation fix test: Improve unit test coverage + fix Dubbo global state contamination Mar 19, 2026
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.

2 participants