[09/50] [abbrv] incubator-geode git commit: GEODE-933: Refactored test code to stabilize it
GEODE-933: Refactored test code to stabilize it * Made sure the senders are running before the puts are started. * Correct order of creation of cache, region and senders/receivers. * Code assumed to be stabilized from refactoring of WANTestBase * Removing the FlakyTest tag. * Test assumed to be stable until it fails again. Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/0620b059 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/0620b059 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/0620b059 Branch: refs/heads/feature/GEODE-420 Commit: 0620b059e99c15f0b472523992b0263bac81dbfa Parents: 59e4c44 Author: nabarunAuthored: Mon Aug 1 16:10:52 2016 -0700 Committer: nabarun Committed: Mon Aug 1 16:15:42 2016 -0700 -- ...arallelGatewaySenderOperationsDUnitTest.java | 59 +++- 1 file changed, 44 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0620b059/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java -- diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java index a1036f4..4981c97 100644 --- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java +++ b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java @@ -249,50 +249,79 @@ public class ParallelGatewaySenderOperationsDUnitTest extends WANTestBase { /** * Normal scenario in which a sender is stopped and then started again. */ - @Category(FlakyTest.class) // GEODE-933: thread sleeps, random ports, async actions, time sensitive @Test public void testParallelPropagationSenderStartAfterStop() throws Exception { IgnoredException.addIgnoredException("Broken pipe"); Integer[] locatorPorts = createLNAndNYLocators(); Integer lnPort = locatorPorts[0]; Integer nyPort = locatorPorts[1]; +String regionName = getTestMethodName() + "_PR"; -createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true); + +createCacheInVMs(nyPort, vm2, vm3); +createCacheInVMs(lnPort, vm4, vm5, vm6, vm7); + +vm2.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap())); +vm3.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap())); + +createReceiverInVMs(vm2, vm3); + +vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap())); +vm5.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap())); +vm6.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap())); +vm7.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap())); + +vm4.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true)); +vm5.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true)); +vm6.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true)); +vm7.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true)); + +startSenderInVMs("ln", vm4, vm5, vm6, vm7); //make sure all the senders are running before doing any puts -waitForSendersRunning(); +vm4.invoke(() -> waitForSenderRunningState("ln")); +vm5.invoke(() -> waitForSenderRunningState("ln")); +vm6.invoke(() -> waitForSenderRunningState("ln")); +vm7.invoke(() -> waitForSenderRunningState("ln")); //FIRST RUN: now, the senders are started. So, do some of the puts -vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 200 )); +vm4.invoke(() -> WANTestBase.doPuts( regionName, 200 )); //now, stop all of the senders -stopSenders(); - -Wait.pause(2000); - +vm4.invoke(() -> stopSender("ln")); +vm5.invoke(() -> stopSender("ln")); +vm6.invoke(() -> stopSender("ln")); +vm7.invoke(() -> stopSender("ln")); + +//Region size on remote site should remain same and below the number of puts done in the FIRST RUN +vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(regionName, 200 )); + //SECOND RUN: do some of the puts after the senders are stopped -vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 )); +vm4.invoke(() -> WANTestBase.doPuts( regionName, 1000 )); //Region size
incubator-geode git commit: GEODE-933: Refactored test code to stabilize it
Repository: incubator-geode Updated Branches: refs/heads/develop 59e4c447e -> 0620b059e GEODE-933: Refactored test code to stabilize it * Made sure the senders are running before the puts are started. * Correct order of creation of cache, region and senders/receivers. * Code assumed to be stabilized from refactoring of WANTestBase * Removing the FlakyTest tag. * Test assumed to be stable until it fails again. Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/0620b059 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/0620b059 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/0620b059 Branch: refs/heads/develop Commit: 0620b059e99c15f0b472523992b0263bac81dbfa Parents: 59e4c44 Author: nabarunAuthored: Mon Aug 1 16:10:52 2016 -0700 Committer: nabarun Committed: Mon Aug 1 16:15:42 2016 -0700 -- ...arallelGatewaySenderOperationsDUnitTest.java | 59 +++- 1 file changed, 44 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0620b059/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java -- diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java index a1036f4..4981c97 100644 --- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java +++ b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderOperationsDUnitTest.java @@ -249,50 +249,79 @@ public class ParallelGatewaySenderOperationsDUnitTest extends WANTestBase { /** * Normal scenario in which a sender is stopped and then started again. */ - @Category(FlakyTest.class) // GEODE-933: thread sleeps, random ports, async actions, time sensitive @Test public void testParallelPropagationSenderStartAfterStop() throws Exception { IgnoredException.addIgnoredException("Broken pipe"); Integer[] locatorPorts = createLNAndNYLocators(); Integer lnPort = locatorPorts[0]; Integer nyPort = locatorPorts[1]; +String regionName = getTestMethodName() + "_PR"; -createSendersReceiversAndPartitionedRegion(lnPort, nyPort, false, true); + +createCacheInVMs(nyPort, vm2, vm3); +createCacheInVMs(lnPort, vm4, vm5, vm6, vm7); + +vm2.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap())); +vm3.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap())); + +createReceiverInVMs(vm2, vm3); + +vm4.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap())); +vm5.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap())); +vm6.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap())); +vm7.invoke(() -> createPartitionedRegion(regionName, "ln", 1, 100, isOffHeap())); + +vm4.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true)); +vm5.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true)); +vm6.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true)); +vm7.invoke(() -> createSender("ln", 2, true, 100, 10, false, false, null, true)); + +startSenderInVMs("ln", vm4, vm5, vm6, vm7); //make sure all the senders are running before doing any puts -waitForSendersRunning(); +vm4.invoke(() -> waitForSenderRunningState("ln")); +vm5.invoke(() -> waitForSenderRunningState("ln")); +vm6.invoke(() -> waitForSenderRunningState("ln")); +vm7.invoke(() -> waitForSenderRunningState("ln")); //FIRST RUN: now, the senders are started. So, do some of the puts -vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 200 )); +vm4.invoke(() -> WANTestBase.doPuts( regionName, 200 )); //now, stop all of the senders -stopSenders(); - -Wait.pause(2000); - +vm4.invoke(() -> stopSender("ln")); +vm5.invoke(() -> stopSender("ln")); +vm6.invoke(() -> stopSender("ln")); +vm7.invoke(() -> stopSender("ln")); + +//Region size on remote site should remain same and below the number of puts done in the FIRST RUN +vm2.invoke(() -> WANTestBase.validateRegionSizeRemainsSame(regionName, 200 )); + //SECOND RUN: do some of the puts after the senders are stopped -vm4.invoke(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 1000 )); +