Skip to content

Commit

Permalink
GEODE-1731: Reordered the creation of test elements
Browse files Browse the repository at this point in the history
	* The test now initiates the killing of second sender after it has received one batch.
	* Reordered the creation of cache, region and finally the receivers and senders.
  • Loading branch information
nabarunnag committed Oct 5, 2016
1 parent 0e2b53b commit c454d3a
Showing 1 changed file with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -586,18 +586,32 @@ public void testParallelColocatedPropagationOrderPolicyPartition() throws Except
getTestMethodName(), 1000 ));
}

@Category(FlakyTest.class) // GEODE-1731
@Test
public void testPartitionedParallelPropagationHA() throws Exception {
IgnoredException.addIgnoredException(SocketException.class.getName()); // for Connection reset
Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));

createCacheInVMs(nyPort, vm2, vm3);

vm2.invoke(() -> WANTestBase.createPartitionedRegion(
getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
vm3.invoke(() -> WANTestBase.createPartitionedRegion(
getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));

createReceiverInVMs(vm2, vm3);

createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);

vm4.invoke(() -> WANTestBase.createPartitionedRegion(
getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
vm5.invoke(() -> WANTestBase.createPartitionedRegion(
getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
vm6.invoke(() -> WANTestBase.createPartitionedRegion(
getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
vm7.invoke(() -> WANTestBase.createPartitionedRegion(
getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));

vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
Expand All @@ -606,33 +620,25 @@ public void testPartitionedParallelPropagationHA() throws Exception {
true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));
vm7.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
true, 100, 10, false, false, null, true, 6, OrderPolicy.KEY ));

vm4.invoke(() -> WANTestBase.createPartitionedRegion(
getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
vm5.invoke(() -> WANTestBase.createPartitionedRegion(
getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
vm6.invoke(() -> WANTestBase.createPartitionedRegion(
getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));
vm7.invoke(() -> WANTestBase.createPartitionedRegion(
getTestMethodName() + "_PR", "ln", 2, 100, isOffHeap() ));

startSenderInVMs("ln", vm4, vm5, vm6, vm7);

vm2.invoke(() -> WANTestBase.createPartitionedRegion(
getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));
vm3.invoke(() -> WANTestBase.createPartitionedRegion(
getTestMethodName() + "_PR", null, 1, 100, isOffHeap() ));

AsyncInvocation inv1 = vm7.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 5000 ));

vm2.invoke(() -> Awaitility.await().atMost(30000, TimeUnit.MILLISECONDS).until(() ->
assertEquals("Failure in waiting for at least 10 events to be received by the receiver",
true, (getRegionSize(getTestMethodName() + "_PR") > 10 ))));

AsyncInvocation inv2 = vm4.invokeAsync(() -> WANTestBase.killSender());

AsyncInvocation inv3 = vm6.invokeAsync(() -> WANTestBase.doPuts( getTestMethodName() + "_PR", 10000 ));

vm2.invoke(() -> Awaitility.await().atMost(30000, TimeUnit.MILLISECONDS).until(() ->
assertEquals("Failure in waiting for additional 2000 events to be received by the receiver ",
true,getRegionSize(getTestMethodName() + "_PR") > 7000 )));
assertEquals("Failure in waiting for additional 10 events to be received by the receiver ",
true,getRegionSize(getTestMethodName() + "_PR") > 5010 )));

AsyncInvocation inv4 = vm5.invokeAsync(() -> WANTestBase.killSender());

inv1.join();
inv2.join();
inv3.join();
Expand Down

0 comments on commit c454d3a

Please sign in to comment.