This is an automated email from the ASF dual-hosted git repository.
sergehuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/unomi.git
The following commit(s) were added to refs/heads/master by this push:
new 1729a66d7 UNOMI-1014: Assert _all against getAllItemsCount (#924)
1729a66d7 is described below
commit 1729a66d704048f365067ac26da6f9698416be58
Author: Serge Huber <[email protected]>
AuthorDate: Sat Oct 24 07:46:54 2026 +0200
UNOMI-1014: Assert _all against getAllItemsCount (#924)
---
.../apache/unomi/itests/PersistenceServiceIT.java | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git
a/itests/src/test/java/org/apache/unomi/itests/PersistenceServiceIT.java
b/itests/src/test/java/org/apache/unomi/itests/PersistenceServiceIT.java
index 66f7a6420..eb039b203 100644
--- a/itests/src/test/java/org/apache/unomi/itests/PersistenceServiceIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/PersistenceServiceIT.java
@@ -237,10 +237,11 @@ public class PersistenceServiceIT extends BaseIT {
DEFAULT_TRYING_TIMEOUT, DEFAULT_TRYING_TRIES);
Assert.assertEquals(Long.valueOf(2L), withCondition.get("Alice"));
Assert.assertEquals(Long.valueOf(1L), withCondition.get("Bob"));
- Assert.assertTrue("Non-optimized aggregate should report a
tenant-scoped _all count",
- withCondition.get("_all") != null && withCondition.get("_all")
>= 3L);
- Assert.assertTrue("Non-optimized aggregate with a condition should
report _filtered",
- withCondition.get("_filtered") != null &&
withCondition.get("_filtered") >= 3L);
+ long profileCount =
persistenceService.getAllItemsCount(Profile.ITEM_TYPE);
+ Assert.assertEquals("_all must match getAllItemsCount for the current
tenant",
+ Long.valueOf(profileCount), withCondition.get("_all"));
+ Assert.assertEquals("With match-all, _filtered must match
getAllItemsCount for the current tenant",
+ Long.valueOf(profileCount), withCondition.get("_filtered"));
Map<String, Long> optimized = keepTrying(
"Optimized aggregate with a condition should return first-name
buckets",
@@ -296,10 +297,11 @@ public class PersistenceServiceIT extends BaseIT {
DEFAULT_TRYING_TIMEOUT, DEFAULT_TRYING_TRIES);
Assert.assertEquals(Long.valueOf(1L),
termsWithCondition.get("Alice"));
Assert.assertNull(termsWithCondition.get("Bob"));
- Assert.assertNotNull("Non-optimized aggregate should report _all
for the current tenant",
- termsWithCondition.get("_all"));
- Assert.assertEquals("With match-all, _all and _filtered must match
for the current tenant",
- termsWithCondition.get("_all"),
termsWithCondition.get("_filtered"));
+ long profileCount =
persistenceService.getAllItemsCount(Profile.ITEM_TYPE);
+ Assert.assertEquals("_all must match getAllItemsCount for the
current tenant",
+ Long.valueOf(profileCount),
termsWithCondition.get("_all"));
+ Assert.assertEquals("With match-all, _filtered must match
getAllItemsCount for the current tenant",
+ Long.valueOf(profileCount),
termsWithCondition.get("_filtered"));
Map<String, Double> metrics = keepTrying(
"Sum metric should only include the current tenant",
@@ -318,8 +320,8 @@ public class PersistenceServiceIT extends BaseIT {
DEFAULT_TRYING_TIMEOUT, DEFAULT_TRYING_TRIES);
Assert.assertEquals(Long.valueOf(1L),
termsNonOptimizedNoCondition.get("Alice"));
Assert.assertNull(termsNonOptimizedNoCondition.get("Bob"));
- Assert.assertEquals("_all must be the current tenant's count",
- termsWithCondition.get("_all"),
termsNonOptimizedNoCondition.get("_all"));
+ Assert.assertEquals("_all without a condition must match
getAllItemsCount for the current tenant",
+ Long.valueOf(profileCount),
termsNonOptimizedNoCondition.get("_all"));
Assert.assertNull("No condition means no _filtered",
termsNonOptimizedNoCondition.get("_filtered"));
Map<String, Double> metricsNoCondition = keepTrying(