You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2020/11/30 19:18:05 UTC

[GitHub] [accumulo] DomGarguilo commented on a change in pull request #1816: Fixes #1763 - Flaky test: SimpleTimerTest

DomGarguilo commented on a change in pull request #1816:
URL: https://github.com/apache/accumulo/pull/1816#discussion_r532838657



##########
File path: server/base/src/test/java/org/apache/accumulo/server/util/time/SimpleTimerTest.java
##########
@@ -98,11 +97,15 @@ public void testFailure() throws InterruptedException {
     assertTrue(r.wasRun);
   }
 
-  @Test
-  public void testSingleton() {
-    assertEquals(1, SimpleTimer.getInstanceThreadPoolSize());
-    SimpleTimer t2 = SimpleTimer.getInstance(2);
-    assertSame(t, t2);
+  @Test(timeout = 5000)
+  public void testSingleton() throws InterruptedException {
+    while (true) {
+      SimpleTimer t2 = SimpleTimer.getInstance(2);
+      if((SimpleTimer.getInstanceThreadPoolSize() == 1) && (t == t2)) {
+        break;
+      }
+      Thread.sleep(PAD);
+    }

Review comment:
       Oops, I see I was off-base with this one. Will do my best to correct these issues with your suggestions in mind :+1: 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org