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


##########
itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java:
##########
@@ -77,15 +77,23 @@ 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());

Review Comment:
   The supplier lambda passed to keepTrying() calls post(...), which declares 
`throws Exception` in BaseGraphQLIT. Since keepTrying expects a plain 
`Supplier<T>`, this code won't compile unless the checked exception is caught 
and wrapped (or keepTrying is changed to accept a throwing supplier). Consider 
catching the exception inside the lambda and rethrowing as a RuntimeException, 
or introducing a `ThrowingSupplier` overload for keepTrying that handles 
retries on transient HTTP failures.
   



##########
itests/src/test/java/org/apache/unomi/itests/PatchIT.java:
##########
@@ -49,7 +49,10 @@ public void testPatch() throws IOException {
 
             profileService.refresh();
 
-            newCompany = profileService.getPropertyType("company");
+            newCompany = keepTrying("Failed waiting for patched property type",
+                    () -> profileService.getPropertyType("company"),
+                    pt -> pt != null && "foo".equals(pt.getDefaultValue()),
+                    DEFAULT_TRYING_TIMEOUT, DEFAULT_TRYING_TRIES);
             Assert.assertEquals("foo", newCompany.getDefaultValue());

Review Comment:
   testPatch() now calls keepTrying(...), but keepTrying is declared `throws 
InterruptedException` in BaseIT. This test method currently only declares 
`throws IOException`, so the code will not compile unless InterruptedException 
is caught or added to the method signature.



##########
itests/src/test/java/org/apache/unomi/itests/PatchIT.java:
##########
@@ -68,7 +71,10 @@ public void testOverride() throws IOException {
 
             profileService.refresh();
 
-            newGender = profileService.getPropertyType("gender");
+            newGender = keepTrying("Failed waiting for patched property type",
+                    () -> profileService.getPropertyType("gender"),
+                    pt -> pt != null && "foo".equals(pt.getDefaultValue()),
+                    DEFAULT_TRYING_TIMEOUT, DEFAULT_TRYING_TRIES);
             Assert.assertEquals("foo", newGender.getDefaultValue());

Review Comment:
   testOverride() now calls keepTrying(...), but keepTrying is declared `throws 
InterruptedException` in BaseIT. This test method currently only declares 
`throws IOException`, so the code will not compile unless InterruptedException 
is caught or added to the method signature.



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