ygerzhedovich commented on code in PR #3005:
URL: https://github.com/apache/ignite-3/pull/3005#discussion_r1440427417


##########
modules/runner/src/testFixtures/java/org/apache/ignite/internal/ClusterPerClassIntegrationTest.java:
##########
@@ -386,38 +384,37 @@ private static List<List<Object>> 
executeAwaitingIndexes(IgniteImpl node, Functi
         CatalogManager catalogManager = node.catalogManager();
 
         // Get existing indexes
-        Set<Integer> existing = 
catalogManager.indexes(catalogManager.latestCatalogVersion())
-                .stream().map(CatalogObjectDescriptor::id)
+        Set<Integer> existing = 
catalogManager.indexes(catalogManager.latestCatalogVersion()).stream()
+                .map(CatalogObjectDescriptor::id)
                 .collect(Collectors.toSet());
 
         List<List<Object>> result = statement.apply(node);
 
         // Get indexes after a statement and compute the difference
-        Set<Integer> difference = 
catalogManager.indexes(catalogManager.latestCatalogVersion()).stream()
+        List<Integer> difference = 
catalogManager.indexes(catalogManager.latestCatalogVersion()).stream()
                 .map(CatalogObjectDescriptor::id)
-                .collect(Collectors.toSet());
-
-        difference.removeAll(existing);
+                .filter(id -> !existing.contains(id))
+                .collect(Collectors.toList());
 
         if (difference.isEmpty()) {
             return result;
         }
 
         // If there are new indexes, wait for them to become available.
+        HybridClock clock = node.clock();
 
         try {
-            assertTrue(waitForCondition(() -> {
-                int latestVersion = catalogManager.latestCatalogVersion();
-                int notAvailable = 0;
-
-                for (CatalogIndexDescriptor index : 
catalogManager.indexes(latestVersion)) {
-                    if (!index.available() && difference.contains(index.id())) 
{
-                        notAvailable++;
-                    }
-                }
-
-                return notAvailable == 0;
-            }, 10_000));
+            assertTrue(waitForCondition(
+                    () -> {
+                        long now = clock.nowLong();
+
+                        return difference.stream()
+                                .map(id -> catalogManager.index(id, now))
+                                .allMatch(indexDescriptor -> indexDescriptor 
!= null && indexDescriptor.available());
+                    },
+                    10,

Review Comment:
   Could you imaging real situatio when index will became available for so long 
time for our tests? Why we don't use 10 hours here in case it's not a problem?
   My point is the following: in case our code have bugs all tests will waiting 
long time and significantly increasing time of whole build. We should use 
values that make sense.



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

Reply via email to