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

Fixed flaky test in DiscoveryFactoryTest.java #1194

Merged
merged 5 commits into from
Dec 16, 2020

Conversation

KellyShao
Copy link
Contributor

Fixed flaky tests with error msg related to org.mockito.exceptions.verification.TooManyActualInvocations that caused by
verify(runtimeContext).isDisablePeerDiscovery(); in class com.quorum.tessera.discovery.DiscoveryFactoryTest.

  • Error msg:

    org.mockito.exceptions.verification.TooManyActualInvocations: 
    runtimeContext.isDisablePeerDiscovery();
    Wanted 1 time:
    -> at com.quorum.tessera.discovery.DiscoveryFactoryTest.defaultConstructor(DiscoveryFactoryTest.java:80)
    But was 2 times:
    -> at com.quorum.tessera.discovery.DiscoveryFactory.provider(DiscoveryFactory.java:31)
    -> at com.quorum.tessera.discovery.DiscoveryFactory.provider(DiscoveryFactory.java:31)
    
  • Root cause:
    It because this class doesn't reset the mocked objects at the very beginning, though we did reset MockContextHolder after each test. If we called this class right after other classes that have mocked objects unrested, there will be flaky tests.

The org.mockito.exceptions.verification.TooManyActualInvocations is found by running iDFlakies. After fixing the issue, there's no flaky tests in DiscoveryFactoryTest.java

@codecov-io
Copy link

codecov-io commented Nov 30, 2020

Codecov Report

Merging #1194 (a6876fc) into master (5150289) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1194   +/-   ##
=========================================
  Coverage     99.50%   99.50%           
  Complexity     3081     3081           
=========================================
  Files           470      470           
  Lines          9054     9054           
  Branches        480      480           
=========================================
  Hits           9009     9009           
  Misses            5        5           
  Partials         40       40           
Flag Coverage Δ Complexity Δ
unittests 99.50% <ø> (ø) 0.00 <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out 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 5150289...a6876fc. Read the comment docs.

@Krish1979 Krish1979 merged commit 5dd2b98 into Consensys:master Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants