adelapena commented on a change in pull request #1342:
URL: https://github.com/apache/cassandra/pull/1342#discussion_r759267582



##########
File path: test/unit/org/apache/cassandra/utils/RecomputingSupplierTest.java
##########
@@ -93,31 +91,41 @@ public void recomputingSupplierTest() throws Throwable
                             lastSeen.accumulateAndGet(v, Math::max);
                             Assert.assertTrue(String.format("Seen %d out of 
order. Last seen value %d", v, seenBeforeGet),
                                               v >= seenBeforeGet);
-
                         }
-
                     }
                     catch (Throwable e)
                     {
                         thrown.set(e);
-                        latch.countDown();
                     }
                 }
             });
         }
 
-        latch.await(10, TimeUnit.SECONDS);
-
+        Util.spinAssertEquals(true, () -> counter.get() > 1000, 10);
         testExecutor.shutdown();
-        testExecutor.awaitTermination(10, TimeUnit.SECONDS);
-        executor.shutdown();
-        executor.awaitTermination(10, TimeUnit.SECONDS);
+        Assert.assertTrue(testExecutor.awaitTermination(10, TimeUnit.SECONDS));
 
         if (thrown.get() != null)
             throw new AssertionError(supplier.toString(), thrown.get());
 
-        Assert.assertTrue(counter.get() > 1); // We actually did some work
-        Assert.assertEquals(supplier.get(1, TimeUnit.SECONDS).longValue(), 
counter.get());
+        Util.spinAssertEquals(true, () -> {
+            try
+            {
+                return supplier.get(1, TimeUnit.SECONDS) == counter.get();
+            }
+            catch (InterruptedException | ExecutionException | 
TimeoutException e)
+            {
+                e.printStackTrace();
+                return false;
+            }
+        }, 10);
+
+        executor.shutdown();
+        Assert.assertTrue(executor.awaitTermination(10, TimeUnit.SECONDS));
+        Assert.assertEquals((long) supplier.get(0, TimeUnit.MILLISECONDS), 
counter.get());

Review comment:
       Unfortunately this hits three timeouts in a CI round with 2000 
iterations, 
[here](https://app.circleci.com/pipelines/github/adelapena/cassandra/1180/workflows/1a64ccfc-1cb7-4b36-8e42-6489f1442af2/jobs/10603/tests).
 I guess the reason is that `executor` hasn't finished yet. Increasing that 
timeout from 0 to 10 sec doesn't fix the problem, as it's shown by [this other 
run](https://app.circleci.com/pipelines/github/adelapena/cassandra/1181/workflows/86e29e09-b523-40c8-b2ea-8df81be5910c/jobs/10606).
 Also, the latter run hits a different, earlier failure due to a timeout in the 
supplier reader task.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to