ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] AMashenkov commented on a change in pull request #6839: IGNITE-11815: replace GridTestUtils.retryAssert with GridTestUtils.waitForCondition
Date Thu, 05 Sep 2019 15:33:54 GMT
AMashenkov commented on a change in pull request #6839: IGNITE-11815: replace GridTestUtils.retryAssert
with GridTestUtils.waitForCondition
URL: https://github.com/apache/ignite/pull/6839#discussion_r321337457
 
 

 ##########
 File path: modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java
 ##########
 @@ -293,20 +292,15 @@ public void testGetServicesByName() throws Exception {
 
         g.services().deployMultiple(name, new DummyService(), nodeCount() * 2, 3);
 
-        GridTestUtils.retryAssert(log, 50, 200, new CA() {
-            @Override public void apply() {
-                int cnt = 0;
+        AtomicInteger cnt = new AtomicInteger(0);
 
-                for (int i = 0; i < nodeCount(); i++) {
-                    Collection<DummyService> svcs = grid(i).services().services(name);
+        for (int i = 0; i < nodeCount(); i++) {
+            Collection<DummyService> svcs = grid(i).services().services(name);
 
-                    if (svcs != null)
-                        cnt += svcs.size();
-                }
-
-                assertEquals(nodeCount() * 2, cnt);
-            }
-        });
+            if (svcs != null)
+                cnt.addAndGet(svcs.size());
+        }
+        assertTrue(GridTestUtils.waitForCondition(() -> cnt.get() == nodeCount() * 2,
10000));
 
 Review comment:
   Semantic is broken here. 'cnt' is calculated only once and will never be changed. 
   So, if condition doesn't met there is no sense to wait neither 10 sec nor more nor less.

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

Mime
View raw message