Skip to content

[Dubbo-6954] Reset ExtensionLoader in ExtensionLoaderTest#6953

Merged
AlbumenJ merged 1 commit intoapache:masterfrom
lzx404243:zli89-ExtensionLoaderTest-fix
Apr 12, 2021
Merged

[Dubbo-6954] Reset ExtensionLoader in ExtensionLoaderTest#6953
AlbumenJ merged 1 commit intoapache:masterfrom
lzx404243:zli89-ExtensionLoaderTest-fix

Conversation

@lzx404243
Copy link
Copy Markdown

@lzx404243 lzx404243 commented Nov 29, 2020

What is the purpose of the change

The tests are not idempotent and fails if run twice in the same JVM, because each of the tests pollutes state shared among tests:

  • dubbo-common,org.apache.dubbo.common.extension.ExtensionLoaderTest.test_replaceExtension_Adaptive
  • dubbo-common,org.apache.dubbo.common.extension.ExtensionLoaderTest.test_AddExtension
  • dubbo-common,org.apache.dubbo.common.extension.ExtensionLoaderTest.test_replaceExtension

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 these tests.

Brief changelog

Call ExtensionLoader.resetExtensionLoader() to reset the ExtensionLoader for the certain extension types used in each tests in test_replaceExtension_Adaptive, test_AddExtension, and test_replaceExtension.

Verifying this change

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

Link to issue: #6954

@lzx404243 lzx404243 changed the title Reset ExtensionLoader in ExtensionLoaderTest [Dubbo-6954] Reset ExtensionLoader in ExtensionLoaderTest Nov 29, 2020
@codecov-io
Copy link
Copy Markdown

codecov-io commented Nov 29, 2020

Codecov Report

Merging #6953 (8a8c851) into master (a2a14dc) will increase coverage by 0.21%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #6953      +/-   ##
============================================
+ Coverage     59.13%   59.35%   +0.21%     
+ Complexity      509      507       -2     
============================================
  Files          1028     1028              
  Lines         41519    41519              
  Branches       6037     6037              
============================================
+ Hits          24554    24642      +88     
+ Misses        14197    14128      -69     
+ Partials       2768     2749      -19     
Impacted Files Coverage Δ Complexity Δ
...e/dubbo/remoting/transport/netty/NettyChannel.java 52.27% <0.00%> (-7.96%) 19.00% <0.00%> (-2.00%)
...he/dubbo/remoting/transport/netty/NettyServer.java 70.17% <0.00%> (-3.51%) 8.00% <0.00%> (-1.00%)
...g/apache/dubbo/registry/consul/ConsulRegistry.java 60.00% <0.00%> (-0.59%) 31.00% <0.00%> (ø%)
...n/java/org/apache/dubbo/common/utils/NetUtils.java 66.55% <0.00%> (ø) 0.00% <0.00%> (ø%)
...rg/apache/dubbo/common/timer/HashedWheelTimer.java 63.57% <0.00%> (ø) 0.00% <0.00%> (ø%)
...a/org/apache/dubbo/monitor/dubbo/DubboMonitor.java 89.52% <0.00%> (+0.95%) 17.00% <0.00%> (+1.00%)
.../dubbo/remoting/transport/netty4/NettyChannel.java 67.32% <0.00%> (+0.99%) 0.00% <0.00%> (ø%)
...a/org/apache/dubbo/rpc/filter/AccessLogFilter.java 81.33% <0.00%> (+1.33%) 0.00% <0.00%> (ø%)
...pache/dubbo/remoting/transport/AbstractClient.java 64.38% <0.00%> (+1.36%) 0.00% <0.00%> (ø%)
...pache/dubbo/registry/support/AbstractRegistry.java 79.25% <0.00%> (+1.48%) 0.00% <0.00%> (ø%)
... and 17 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 a2a14dc...8a8c851. Read the comment docs.

@AlbumenJ
Copy link
Copy Markdown
Member

AlbumenJ commented Dec 4, 2020

lgtm, thanks for your contribution to make unit test more strength.

@lzx404243
Copy link
Copy Markdown
Author

@AlbumenJ Thanks for the review! Is there anything I can do on my end for this to be merged?

@AlbumenJ AlbumenJ merged commit 0171947 into apache:master Apr 12, 2021
AlbumenJ added a commit to AlbumenJ/dubbo that referenced this pull request May 28, 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.

4 participants