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 c2f30010c6a1701f331eac783bde4ee1dc56df41 Author: Serge Huber <[email protected]> AuthorDate: Sat May 23 10:32:18 2026 +0200 UNOMI-937: Add waitForProfileProperty helper for async rule updates Poll profile properties after events in PropertiesUpdateActionIT. --- itests/src/test/java/org/apache/unomi/itests/BaseIT.java | 8 ++++++++ .../org/apache/unomi/itests/PropertiesUpdateActionIT.java | 14 +++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/itests/src/test/java/org/apache/unomi/itests/BaseIT.java b/itests/src/test/java/org/apache/unomi/itests/BaseIT.java index 1c1bd6f8c..676639b0d 100644 --- a/itests/src/test/java/org/apache/unomi/itests/BaseIT.java +++ b/itests/src/test/java/org/apache/unomi/itests/BaseIT.java @@ -467,6 +467,14 @@ public abstract class BaseIT extends KarafTestSupport { return value; } + protected void waitForProfileProperty(String profileId, String propertyName, Object expected) + throws InterruptedException { + keepTrying("Profile " + profileId + " property " + propertyName + " not updated", + () -> profileService.load(profileId), + profile -> profile != null && java.util.Objects.equals(expected, profile.getProperty(propertyName)), + DEFAULT_TRYING_TIMEOUT, DEFAULT_TRYING_TRIES); + } + protected <T> void waitForNullValue(String failMessage, Supplier<T> call, int timeout, int retries) throws InterruptedException { int count = 0; while (call.get() != null) { diff --git a/itests/src/test/java/org/apache/unomi/itests/PropertiesUpdateActionIT.java b/itests/src/test/java/org/apache/unomi/itests/PropertiesUpdateActionIT.java index a1e340680..e07d2bd5c 100644 --- a/itests/src/test/java/org/apache/unomi/itests/PropertiesUpdateActionIT.java +++ b/itests/src/test/java/org/apache/unomi/itests/PropertiesUpdateActionIT.java @@ -78,7 +78,7 @@ public class PropertiesUpdateActionIT extends BaseIT { } @Test - public void testUpdateProperties_CurrentProfile() { + public void testUpdateProperties_CurrentProfile() throws InterruptedException { Profile profile = profileService.load(PROFILE_TARGET_TEST_ID); Assert.assertNull(profile.getProperty("firstName")); @@ -92,16 +92,13 @@ public class PropertiesUpdateActionIT extends BaseIT { updateProperties.setProperty(UpdatePropertiesAction.TARGET_ID_KEY, PROFILE_TARGET_TEST_ID); updateProperties.setProperty(UpdatePropertiesAction.TARGET_TYPE_KEY, "profile"); - int changes = eventService.send(updateProperties); - - LOGGER.info("Changes of the event : {}", changes); + eventService.send(updateProperties); - Assert.assertTrue(changes > 0); - Assert.assertEquals("UPDATED FIRST NAME CURRENT PROFILE", profile.getProperty("firstName")); + waitForProfileProperty(PROFILE_TARGET_TEST_ID, "firstName", "UPDATED FIRST NAME CURRENT PROFILE"); } @Test - public void testUpdateProperties_NotCurrentProfile() { + public void testUpdateProperties_NotCurrentProfile() throws InterruptedException { Profile profile = profileService.load(PROFILE_TARGET_TEST_ID); Profile profileToUpdate = profileService.load(PROFILE_TEST_ID); Assert.assertNull(profileToUpdate.getProperty("firstName")); @@ -117,8 +114,7 @@ public class PropertiesUpdateActionIT extends BaseIT { updateProperties.setProperty(UpdatePropertiesAction.TARGET_TYPE_KEY, "profile"); eventService.send(updateProperties); - profileToUpdate = profileService.load(PROFILE_TEST_ID); - Assert.assertEquals("UPDATED FIRST NAME", profileToUpdate.getProperty("firstName")); + waitForProfileProperty(PROFILE_TEST_ID, "firstName", "UPDATED FIRST NAME"); } @Test
