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 #6997

Merged
merged 1 commit into from
Feb 22, 2021

Conversation

lzx404243
Copy link

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).

This fixes #6996 .

@codecov-io
Copy link

codecov-io commented Dec 7, 2020

Codecov Report

Merging #6997 (6d5ce0a) into master (3fc2d10) will decrease coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #6997      +/-   ##
============================================
- Coverage     59.44%   59.38%   -0.07%     
+ Complexity      511      508       -3     
============================================
  Files          1028     1028              
  Lines         41519    41519              
  Branches       6037     6037              
============================================
- Hits          24681    24656      -25     
- Misses        14102    14123      +21     
- Partials       2736     2740       +4     
Impacted Files Coverage Δ Complexity Δ
...ng/transport/dispatcher/all/AllChannelHandler.java 82.75% <0.00%> (-13.80%) 0.00% <0.00%> (ø%)
...che/dubbo/remoting/transport/mina/MinaChannel.java 39.47% <0.00%> (-11.85%) 15.00% <0.00%> (-2.00%)
...pache/dubbo/remoting/transport/AbstractServer.java 53.75% <0.00%> (-3.75%) 0.00% <0.00%> (ø%)
...mmon/serialize/kryo/utils/AbstractKryoFactory.java 75.43% <0.00%> (-3.51%) 0.00% <0.00%> (ø%)
...g/apache/dubbo/rpc/protocol/rest/RestProtocol.java 68.21% <0.00%> (-3.11%) 0.00% <0.00%> (ø%)
...g/apache/dubbo/config/AbstractInterfaceConfig.java 85.18% <0.00%> (-2.47%) 0.00% <0.00%> (ø%)
...he/dubbo/rpc/protocol/hessian/HessianProtocol.java 67.46% <0.00%> (-2.41%) 9.00% <0.00%> (ø%)
...ache/dubbo/cache/support/expiring/ExpiringMap.java 40.35% <0.00%> (-1.76%) 0.00% <0.00%> (ø%)
...a/org/apache/dubbo/monitor/dubbo/DubboMonitor.java 88.57% <0.00%> (-0.96%) 16.00% <0.00%> (-1.00%)
...ava/org/apache/dubbo/config/ServiceConfigBase.java 58.95% <0.00%> (-0.58%) 0.00% <0.00%> (ø%)
... and 7 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.

@chickenlj chickenlj merged commit bcc721d into apache:master Feb 22, 2021
AlbumenJ added a commit to AlbumenJ/dubbo that referenced this pull request May 27, 2021
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.

Non-idempotent test in RpcContextTest(发现有单元测试是非幂等的)
3 participants