You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "KellyShao (Jira)" <ji...@apache.org> on 2020/12/04 04:33:00 UTC

[jira] [Created] (RATIS-1203) Fix flaky tests caused by retryCache in TestRetryCacheMetrics.java

KellyShao created RATIS-1203:
--------------------------------

             Summary: Fix flaky tests caused by retryCache in TestRetryCacheMetrics.java
                 Key: RATIS-1203
                 URL: https://issues.apache.org/jira/browse/RATIS-1203
             Project: Ratis
          Issue Type: Improvement
          Components: server
            Reporter: KellyShao
             Fix For: 1.1.0


* Issue:
 ** The method *testRetryCacheEntryCount* in *TestRetryCacheMetrics.java* class is flaky. Everytime when we trigger *testRetryCacheHitMissCount* method before *testRetryCacheEntryCount*, the *testRetryCacheEntryCount* will failed with error message: 

 * Root cause:
 ** The root cause is that the variable *retryCache* in this class is only initialized once in *@BeforeClass*, and cleared only at the end of the *testRetryCacheEntryCount* method. But, the *testRetryCacheHitMissCount* doesn't clear it.
 ** So, when *testRetryCacheHitMissCount* is triggered before *testRetryCacheEntryCount*, the line _checkEntryCount(0);_ within *testRetryCacheEntryCount* will failed.

 * Solution:
 ** Added an *@After* method in order to tear down *retryCache* after each test.
{code:java}
@After
public void tearDown() {
    retryCache.close();
    checkEntryCount(0);
}      {code}

 ** Deleted 2 lines of code in *testRetryCacheEntryCount* to avoid duplication.

{code:java}
retryCache.close();
checkEntryCount(0);
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)