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 tests caused by SharedMetricRegistries in SharedMetricRegistriesTest.java #856

Merged
merged 3 commits into from
Dec 9, 2020

Conversation

KellyShao
Copy link
Contributor

@KellyShao KellyShao commented Dec 8, 2020

Fixed flaky test that caused by io.dropwizard.metrics.SharedMetricRegistries in class SharedMetricRegistriesTest.java.

  • Issue 1

        java.lang.AssertionError: 
        Expecting:
          <["one", "borg", "foobah"]>
        to contain only:
          <["one"]>
        but the following elements were unexpected:
          <["borg", "foobah"]>
    
  • Issue 2

       java.lang.AssertionError: 
       Expecting:
         <["one", "foobah"]>
       to contain only:
         <["one"]>
       but the following elements were unexpected:
         <["foobah"]>
    
  • root cause

    • The SharedMetricRegistries variable is not cleared after each tests.
  • solution:
    Added setUp() and tearDown() methods right before and after each tests to clear SharedMetricRegistries.

The flaky tests are found by running iDFlakies, after fixing the issue, there's no flaky tests in SharedMetricRegistriesTest.java

@stevehu stevehu merged commit d816fd1 into networknt:master Dec 9, 2020
@stevehu
Copy link
Contributor

stevehu commented Dec 9, 2020

@KellyShao This is a fantastic tool to detect problematic tests. Thanks a lot for your help.

younggwon1 pushed a commit to younggwon1/light-4j that referenced this pull request Feb 10, 2024
…istriesTest.java (networknt#856)

* Fixed flaky tests caused by SharedMetricRegistries in SharedMetricRegistriesTest.java

* format code

* format code
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.

None yet

2 participants