jujoramos commented on a change in pull request #5227:
URL: https://github.com/apache/geode/pull/5227#discussion_r440331734



##########
File path: 
geode-core/src/distributedTest/java/org/apache/geode/management/MemberMXBeanDistributedTest.java
##########
@@ -82,16 +82,19 @@ public void testBucketCount() {
     server3.invoke(() -> createBuckets(regionName));
     server4.invoke(() -> createBuckets(regionName));
 
-    await().untilAsserted(() -> {
-      final int sumOfBuckets = server1.invoke(() -> getBucketsInitialized()) +
-          server2.invoke(() -> getBucketsInitialized()) +
-          server3.invoke(() -> getBucketsInitialized()) +
-          server4.invoke(() -> getBucketsInitialized());
-      assertEquals("Expected bucket count is 1000, and actual count is " + 
sumOfBuckets,
-          sumOfBuckets, 1000);
-    });
-
     for (int i = 1; i < 4; i++) {
+
+      final int index = i;
+      await().untilAsserted(() -> {
+        final int sumOfBuckets = server1.invoke(() -> getBucketsInitialized()) 
+
+            server2.invoke(() -> getBucketsInitialized()) +
+            server3.invoke(() -> getBucketsInitialized()) +
+            server4.invoke(() -> getBucketsInitialized());
+        final int expectedBuckets = index * 1000;
+        assertThat(sumOfBuckets).isEqualTo(expectedBuckets);
+
+      });

Review comment:
       > Reason for this test was to prove previous fault, which was showing 
value arround 1000, when expected was 4000.
   
   Unless I'm missing something, I don't think this is accurate.
   The test itself (before the changes) creates a `PARTITION_PERSISTENT` with 
`1000` buckets, makes sure all buckets have been created 
(`PartitionRegionHelper.assignBucketsToPartitions`) on all members and asserts 
that the total bucket count is `1000`. After that, it creates 3 more 
`PARTITION_PERSISTENT` with `1000` buckets each, co-located with the original 
region (`testCreateRegion`), and asserts that the total bucket count at the 
very end is `4000` (`1000` per region).
   The flakiness, I believe, is caused by the fact that the test is not 
invoking `PartitionRegionHelper.assignBucketsToPartitions` on the 3 regions 
created within the loop, so when it asserts the results some buckets might have 
not been created yet.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to