Skip to content
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

Remove RPC context in RpcContextTest.testObject #5

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lzx404243
Copy link
Owner

What is the purpose of the change

The test org.apache.dubbo.rpc.RpcContextTest.testObject is not idempotent and fails if run twice in the same JVM, because it pollutes state shared among tests. It may be good to clean this state pollution so that some other tests do not fail in the future due to the shared state polluted by this test. (See PR #6314 for an example of how this could cause issues)

Brief changelog

In RpcContextTest.testObject(), call RpcContext.removeContext() to clear remove the RPC context when the test finishes.

Verifying this change

With the proposed fix, the test does not pollute the shared state (and passes when run twice in the same JVM).

@codecov-io
Copy link

Codecov Report

Merging #5 (6d5ce0a) into master (3fc2d10) will increase coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master       #5      +/-   ##
============================================
+ Coverage     57.82%   57.90%   +0.07%     
- Complexity      423      424       +1     
============================================
  Files          1050     1050              
  Lines         43358    43358              
  Branches       6263     6263              
============================================
+ Hits          25073    25105      +32     
+ Misses        15467    15447      -20     
+ Partials       2818     2806      -12     
Impacted Files Coverage Δ Complexity Δ
...ava/org/apache/dubbo/config/DubboShutdownHook.java 63.82% <0.00%> (-6.39%) 0.00% <0.00%> (ø%)
...rg/apache/dubbo/common/timer/HashedWheelTimer.java 62.88% <0.00%> (-1.04%) 0.00% <0.00%> (ø%)
.../apache/dubbo/config/bootstrap/DubboBootstrap.java 41.70% <0.00%> (-0.33%) 0.00% <0.00%> (ø%)
...n/java/org/apache/dubbo/common/utils/UrlUtils.java 74.25% <0.00%> (+0.33%) 0.00% <0.00%> (ø%)
...figcenter/file/FileSystemDynamicConfiguration.java 61.90% <0.00%> (+0.47%) 0.00% <0.00%> (ø%)
...pache/dubbo/registry/support/FailbackRegistry.java 65.42% <0.00%> (+0.93%) 0.00% <0.00%> (ø%)
...e/dubbo/remoting/transport/netty/NettyChannel.java 52.27% <0.00%> (+1.13%) 19.00% <0.00%> (+1.00%)
.../src/main/java/org/apache/dubbo/rpc/RpcStatus.java 72.61% <0.00%> (+1.19%) 0.00% <0.00%> (ø%)
...pache/dubbo/registry/support/AbstractRegistry.java 80.00% <0.00%> (+1.48%) 0.00% <0.00%> (ø%)
...ava/org/apache/dubbo/config/ServiceConfigBase.java 58.95% <0.00%> (+1.73%) 0.00% <0.00%> (ø%)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3fc2d10...6d5ce0a. Read the comment docs.

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