sergehuber commented on code in PR #764:
URL: https://github.com/apache/unomi/pull/764#discussion_r3315934653


##########
itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java:
##########
@@ -77,15 +77,28 @@ public void testCRUD() throws Exception {
 
             refreshPersistence(UserList.class);
 
-            Thread.sleep(6000);
-
-            try (CloseableHttpResponse response = 
post("graphql/list/find-lists.json")) {
-                final ResponseContext context = 
ResponseContext.parse(response.getEntity());
-
-                Assert.assertEquals(1, ((Integer) 
context.getValue("data.cdp.findLists.totalCount")).intValue());
-                Assert.assertEquals("testListId", 
context.getValue("data.cdp.findLists.edges[0].node.id"));
-                Assert.assertEquals(profile.getItemId(), 
context.getValue("data.cdp.findLists.edges[0].node.active.edges[0].node.cdp_profileIDs[0].id"));
-            }
+            final ResponseContext findListsContext = keepTrying("Failed 
waiting for profile in list query",
+                    () -> {
+                        try (CloseableHttpResponse response = 
post("graphql/list/find-lists.json")) {
+                            return ResponseContext.parse(response.getEntity());
+                        } catch (Exception e) {
+                            return null;
+                        }
+                    },
+                    context -> {
+                        if (context == null) {
+                            return false;
+                        }
+                        Integer totalCount = (Integer) 
context.getValue("data.cdp.findLists.totalCount");
+                        if (totalCount == null || totalCount != 1) {
+                            return false;
+                        }
+                        Object profileId = 
context.getValue("data.cdp.findLists.edges[0].node.active.edges[0].node.cdp_profileIDs[0].id");
+                        return profile.getItemId().equals(profileId);
+                    },
+                    DEFAULT_TRYING_TIMEOUT, DEFAULT_TRYING_TRIES);

Review Comment:
   Fixed in commit b41ef88. The broad catch is intentional so transient 
connection errors during Karaf startup still trigger a retry, but we now call 
`LOGGER.warn(e.getMessage())` on each failed attempt so CI logs show the actual 
failure reason rather than timing out silently.



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