cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [cassandra] dcapwell commented on a change in pull request #470: CASSANDRA-15630 fix testSerializeError
Date Tue, 17 Mar 2020 21:03:31 GMT
dcapwell commented on a change in pull request #470: CASSANDRA-15630 fix testSerializeError
URL: https://github.com/apache/cassandra/pull/470#discussion_r393968395
 
 

 ##########
 File path: test/unit/org/apache/cassandra/net/ConnectionUtils.java
 ##########
 @@ -240,6 +247,31 @@ private void doCheck(FailCheck testAndFailCheck)
         }
     }
 
+    /**
+     * Perform the {@param assertion} within the specified duration repeatly until a success.
+     * Otherwise, it times out and re-throws the {@link AssertionError} from the {@param
assertion}.
+     */
+    private static void longCheck(Runnable assertion, long timeout, TimeUnit timeUnit)
+    {
+        long startNano = System.nanoTime();
+        for (;;)
+        {
+            try
+            {
+                assertion.run();
+                return;
+            }
+            catch (AssertionError e)
+            {
+                long elapsedNano = System.nanoTime() - startNano;
+                if (elapsedNano > timeUnit.toNanos(timeout))
 
 Review comment:
   sorry I didn't comment sooner, I left it in my example; it would be best to compute `timeUnit.toNanos(timeout)`
once outside the loop

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message