This is an automated email from the ASF dual-hosted git repository.

sergehuber pushed a commit to branch UNOMI-937-itests-hardening-ci
in repository https://gitbox.apache.org/repos/asf/unomi.git

commit eb294da69a3e5b28cd31cc75c2f6a260350b4ba0
Author: Serge Huber <[email protected]>
AuthorDate: Sat May 23 10:32:18 2026 +0200

    UNOMI-937: Harden flaky integration tests with keepTrying polling
    
    Replace fixed sleeps in GraphQLListIT and poll after patch refresh in 
PatchIT.
---
 .../test/java/org/apache/unomi/itests/PatchIT.java | 24 +++++++++++++++-----
 .../apache/unomi/itests/graphql/GraphQLListIT.java | 26 ++++++++++++++--------
 2 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/itests/src/test/java/org/apache/unomi/itests/PatchIT.java 
b/itests/src/test/java/org/apache/unomi/itests/PatchIT.java
index 098a03ad2..1c9cd5a43 100644
--- a/itests/src/test/java/org/apache/unomi/itests/PatchIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/PatchIT.java
@@ -49,7 +49,10 @@ public class PatchIT extends BaseIT {
 
             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());
         } finally {
             profileService.setPropertyType(company);
@@ -68,7 +71,10 @@ public class PatchIT extends BaseIT {
 
             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());
         } finally {
             profileService.setPropertyType(gender);
@@ -86,8 +92,8 @@ public class PatchIT extends BaseIT {
 
             profileService.refresh();
 
-            PropertyType newIncome = profileService.getPropertyType("income");
-            Assert.assertNull(newIncome);
+            waitForNullValue("Failed waiting for property type removal",
+                    () -> profileService.getPropertyType("income"), 
DEFAULT_TRYING_TIMEOUT, DEFAULT_TRYING_TRIES);
         } finally {
             profileService.setPropertyType(income);
         }
@@ -105,7 +111,10 @@ public class PatchIT extends BaseIT {
 
             definitionsService.refresh();
 
-            ConditionType newFormCondition = 
definitionsService.getConditionType("formEventCondition");
+            ConditionType newFormCondition = keepTrying("Failed waiting for 
patched condition type",
+                    () -> 
definitionsService.getConditionType("formEventCondition"),
+                    ct -> ct != null && 
!ct.getMetadata().getSystemTags().contains("profileTags"),
+                    DEFAULT_TRYING_TIMEOUT, DEFAULT_TRYING_TRIES);
             
Assert.assertFalse(newFormCondition.getMetadata().getSystemTags().contains("profileTags"));
         } finally {
             definitionsService.setConditionType(formCondition);
@@ -124,7 +133,10 @@ public class PatchIT extends BaseIT {
 
             definitionsService.refresh();
 
-            ActionType newMailAction = 
definitionsService.getActionType("sendMailAction");
+            ActionType newMailAction = keepTrying("Failed waiting for patched 
action type",
+                    () -> definitionsService.getActionType("sendMailAction"),
+                    at -> at != null && 
!at.getMetadata().getSystemTags().contains("availableToEndUser"),
+                    DEFAULT_TRYING_TIMEOUT, DEFAULT_TRYING_TRIES);
             
Assert.assertFalse(newMailAction.getMetadata().getSystemTags().contains("availableToEndUser"));
         } finally {
             definitionsService.setActionType(mailAction);
diff --git 
a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java 
b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java
index 96a6eb986..757904b72 100644
--- a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java
@@ -77,15 +77,23 @@ public class GraphQLListIT extends BaseGraphQLIT {
 
             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());
+                        }
+                    },
+                    context -> {
+                        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);
+
+            Assert.assertEquals("testListId", 
findListsContext.getValue("data.cdp.findLists.edges[0].node.id"));
 
             try (CloseableHttpResponse response = 
post("graphql/list/delete-list.json")) {
                 final ResponseContext context = 
ResponseContext.parse(response.getEntity());

Reply via email to