You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2021/04/16 11:21:54 UTC

[GitHub] [cassandra] adelapena commented on a change in pull request #966: CASSANDRA-16601 Flaky CassandraIndexTest

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



##########
File path: test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
##########
@@ -561,6 +562,20 @@ public void indexCorrectlyMarkedAsBuildAndRemoved() throws Throwable
         String selectBuiltIndexesQuery = String.format("SELECT * FROM %s.\"%s\"",
                                                        SchemaConstants.SYSTEM_KEYSPACE_NAME,
                                                        SystemKeyspace.BUILT_INDEXES);
+
+        // Wait for any background index clearing tasks to complete

Review comment:
       Maybe we could add a note about parallel runners, in case they come back in the future?
   ```suggestion
           // Wait for any background index clearing tasks to complete,
           // knowing that there aren't any other tests running parallely
   ```

##########
File path: test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java
##########
@@ -561,6 +562,20 @@ public void indexCorrectlyMarkedAsBuildAndRemoved() throws Throwable
         String selectBuiltIndexesQuery = String.format("SELECT * FROM %s.\"%s\"",
                                                        SchemaConstants.SYSTEM_KEYSPACE_NAME,
                                                        SystemKeyspace.BUILT_INDEXES);
+
+        // Wait for any background index clearing tasks to complete
+        Util.spinAssertEquals(0, () -> {
+            try
+            {
+                return execute(selectBuiltIndexesQuery).size();
+            }
+            catch(Throwable e)
+            {
+                fail(e.getMessage());
+            }
+            return -1;
+        }, 60);

Review comment:
       We can use the briefer and more flexible `Awaitility.await()` method, that doesn't require the try-catch block and allows us to specify a poll delay:
   ```suggestion
           await().atMost(1, MINUTES)
                  .pollDelay(1, SECONDS)
                  .untilAsserted(() -> assertRows(execute(selectBuiltIndexesQuery)));
   ```




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



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