nabarunnag commented on code in PR #7744: URL: https://github.com/apache/geode/pull/7744#discussion_r887220026
########## geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionStatsDistributedTest.java: ########## @@ -51,55 +51,67 @@ public class PartitionedRegionStatsDUnitTest extends CacheTestCase { public static final String STAT_CONFIGURED_REDUNDANT_COPIES = "configuredRedundantCopies"; public static final String STAT_ACTUAL_REDUNDANT_COPIES = "actualRedundantCopies"; - private VM vm0; - private VM vm1; - private VM vm2; - private VM vm3; - - private String regionName; + @Rule + public ClusterStartupRule clusterStartupRule = new ClusterStartupRule(); - @Before - public void setUp() throws Exception { - vm0 = getHost(0).getVM(0); - vm1 = getHost(0).getVM(1); - vm2 = getHost(0).getVM(2); - vm3 = getHost(0).getVM(3); - - regionName = "region"; - } + private final String regionName = "region"; @Test - public void testClose() throws Exception { + public void whenOperationsAreDoneOnEntriesThenStatsMustBeCorrect() { + MemberVM locator1 = clusterStartupRule.startLocatorVM(0); + int locator1Port = locator1.getPort(); + MemberVM locator2 = + clusterStartupRule.startLocatorVM(1, l -> l.withConnectionToLocator(locator1Port)); + int locator2Port = locator2.getPort(); Review Comment: Reduced the number of locators ########## geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionStatsDistributedTest.java: ########## @@ -51,55 +51,67 @@ public class PartitionedRegionStatsDUnitTest extends CacheTestCase { public static final String STAT_CONFIGURED_REDUNDANT_COPIES = "configuredRedundantCopies"; public static final String STAT_ACTUAL_REDUNDANT_COPIES = "actualRedundantCopies"; - private VM vm0; - private VM vm1; - private VM vm2; - private VM vm3; - - private String regionName; + @Rule + public ClusterStartupRule clusterStartupRule = new ClusterStartupRule(); - @Before - public void setUp() throws Exception { - vm0 = getHost(0).getVM(0); - vm1 = getHost(0).getVM(1); - vm2 = getHost(0).getVM(2); - vm3 = getHost(0).getVM(3); - - regionName = "region"; - } + private final String regionName = "region"; @Test - public void testClose() throws Exception { + public void whenOperationsAreDoneOnEntriesThenStatsMustBeCorrect() { + MemberVM locator1 = clusterStartupRule.startLocatorVM(0); + int locator1Port = locator1.getPort(); + MemberVM locator2 = + clusterStartupRule.startLocatorVM(1, l -> l.withConnectionToLocator(locator1Port)); + int locator2Port = locator2.getPort(); + + MemberVM server1 = + clusterStartupRule.startServerVM(2, + s -> s.withConnectionToLocator(locator1Port, locator2Port)); + MemberVM server2 = + clusterStartupRule.startServerVM(3, + s -> s.withConnectionToLocator(locator1Port, locator2Port)); + MemberVM server3 = + clusterStartupRule.startServerVM(4, + s -> s.withConnectionToLocator(locator1Port, locator2Port)); + MemberVM server4 = + clusterStartupRule.startServerVM(5, + s -> s.withConnectionToLocator(locator1Port, locator2Port)); + // Create PRs on 3 VMs and accessors on 1 VM - vm0.invoke(() -> createPartitionedRegion(regionName, 200, 1, 5)); - vm1.invoke(() -> createPartitionedRegion(regionName, 200, 1, 5)); - vm2.invoke(() -> createPartitionedRegion(regionName, 200, 1, 5)); - vm3.invoke(() -> createPartitionedRegion(regionName, 0, 1, 5)); + server1.invoke(() -> createPartitionedRegion(regionName, 200, 1, 5)); + server2.invoke(() -> createPartitionedRegion(regionName, 200, 1, 5)); + server3.invoke(() -> createPartitionedRegion(regionName, 200, 1, 5)); + server4.invoke(() -> createPartitionedRegion(regionName, 0, 1, 5)); // Do Region operations. - vm0.invoke(() -> doOpsOnRegion(regionName, PUT)); - vm0.invoke(() -> doOpsOnRegion(regionName, GET)); - vm0.invoke(() -> doOpsOnRegion(regionName, GET_ENTRY)); - vm0.invoke(() -> doOpsOnRegion(regionName, CONTAINS_KEY)); - vm0.invoke(() -> doOpsOnRegion(regionName, CONTAINS_VALUE_FOR_KEY)); - vm0.invoke(() -> doOpsOnRegion(regionName, INVALIDATE)); - vm0.invoke(() -> doOpsOnRegion(regionName, DESTROY)); + server1.invoke(() -> doOpsOnRegion(regionName, PUT)); + server1.invoke(() -> doOpsOnRegion(regionName, GET)); + server1.invoke(() -> doOpsOnRegion(regionName, GET_ENTRY)); + server1.invoke(() -> doOpsOnRegion(regionName, CONTAINS_KEY)); + server1.invoke(() -> doOpsOnRegion(regionName, CONTAINS_VALUE_FOR_KEY)); + server1.invoke(() -> doOpsOnRegion(regionName, INVALIDATE)); + server1.invoke(() -> doOpsOnRegion(regionName, DESTROY)); - vm0.invoke(() -> validatePartitionedRegionOpsStats(regionName)); + server1.invoke(() -> validatePartitionedRegionOpsStats(regionName)); - vm0.invoke(() -> validateRedundantCopiesStats(regionName)); + server1.invoke(() -> validateRedundantCopiesStats(regionName)); } /** - * Ok, first problem, GC'd tombstone is counted as an entry To test - modifying a tombstone - - * modifying and doing tombstone GC? + * Test to ensure that tombstone entries are not counted as a part of region entries */ @Test - public void testDataStoreEntryCountWithRebalance() throws Exception { - vm0.invoke(() -> createPartitionedRegionWithRebalance(regionName, 0)); - - vm0.invoke(() -> { - Cache cache = getCache(); + public void whenEntryIsDestroyedThenTombstoneShouldNotPartOfEntries() { Review Comment: missing word added -- 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: notifications-unsubscr...@geode.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org