Skip to content

Commit

Permalink
GEODE-1148: Refactored the test case
Browse files Browse the repository at this point in the history
	* Fixed the order of creation of cache, region, and receivers/senders
	* StopAckThread function was fixed as a part of GEODE-1588
	* WANTestBase.preTearDown has been running for a lot of other tests without failures.
	* Removing the flaky tag till failures reoccur.
	* Pause was replaced with validate receiver region sizes to make sure no send operation was running when the test was shutdown.
  • Loading branch information
nabarunnag committed Aug 1, 2016
1 parent d9bec31 commit 80ac995
Showing 1 changed file with 27 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ public void testReplicatedSerialPropagationLoopBack() throws Exception {
assertEquals(1, createList1.size());
assertEquals(1, createList2.size());
}

@Category(FlakyTest.class) // GEODE-1148: random ports, eats exceptions (fixed 1), time sensitive, thread sleeps, waitForCriterion

@Test
public void testReplicatedSerialPropagationLoopBack3SitesLoop() throws Exception {
Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
Expand All @@ -145,76 +144,78 @@ public void testReplicatedSerialPropagationLoopBack3SitesLoop() throws Exception
createCacheInVMs(nyPort, vm4, vm7);
createCacheInVMs(tkPort, vm5);

vm3.invoke(() -> WANTestBase.createReplicatedRegion(
getTestMethodName() + "_RR", "ln", isOffHeap()));
vm4.invoke(() -> WANTestBase.createReplicatedRegion(
getTestMethodName() + "_RR", "ny", isOffHeap()));
vm5.invoke(() -> WANTestBase.createReplicatedRegion(
getTestMethodName() + "_RR", "tk", isOffHeap()));

vm6.invoke(() -> WANTestBase.createReplicatedRegion(
getTestMethodName() + "_RR", "ln", isOffHeap() ));
vm7.invoke(() -> WANTestBase.createReplicatedRegion(
getTestMethodName() + "_RR", "ny", isOffHeap() ));

vm3.invoke(() -> WANTestBase.createReceiver());
vm4.invoke(() -> WANTestBase.createReceiver());
vm5.invoke(() -> WANTestBase.createReceiver());

// using vm5 for sender in ds 3. cache is already created.

vm6.invoke(() -> WANTestBase.createSender( "ln", 2,
false, 100, 10, false, false, null, true ));
vm7.invoke(() -> WANTestBase.createSender( "ny", 3,
false, 100, 10, false, false, null, true ));
vm5.invoke(() -> WANTestBase.createSender( "tk", 1,
false, 100, 10, false, false, null, true ));


vm3.invoke(() -> WANTestBase.createReplicatedRegion(
getTestMethodName() + "_RR", "ln", isOffHeap()));
vm4.invoke(() -> WANTestBase.createReplicatedRegion(
getTestMethodName() + "_RR", "ny", isOffHeap()));
vm5.invoke(() -> WANTestBase.createReplicatedRegion(
getTestMethodName() + "_RR", "tk", isOffHeap()));

vm6.invoke(() -> WANTestBase.startSender( "ln" ));
vm7.invoke(() -> WANTestBase.startSender( "ny" ));
vm5.invoke(() -> WANTestBase.startSender( "tk" ));


// using vm5 for sender in ds 3. cache is already created.
vm6.invoke(() -> WANTestBase.addQueueListener( "ln",
false ));
vm7.invoke(() -> WANTestBase.addQueueListener( "ny",
false ));
vm5.invoke(() -> WANTestBase.addQueueListener( "tk",
false ));


vm6.invoke(() -> WANTestBase.createReplicatedRegion(
getTestMethodName() + "_RR", "ln", isOffHeap() ));
vm7.invoke(() -> WANTestBase.createReplicatedRegion(
getTestMethodName() + "_RR", "ny", isOffHeap() ));

int totalSize = 3;
int increament = 1;

final Map keyValues = new HashMap();
for(int i=0; i< 1; i++) {
for(int i=0; i< increament; i++) {
keyValues.put(i, i);
}
vm3.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
keyValues ));

keyValues.clear();
for(int i=1; i< 2; i++) {
for(int i = increament; i< 2*increament; i++) {
keyValues.put(i, i);
}
vm4.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
keyValues ));

keyValues.clear();
for(int i=2; i< 3; i++) {
for(int i=2*increament; i< totalSize; i++) {
keyValues.put(i, i);
}
vm5.invoke(() -> WANTestBase.putGivenKeyValue( getTestMethodName() + "_RR",
keyValues ));


vm5.invoke(() -> WANTestBase.validateRegionSize(
getTestMethodName() + "_RR", 3 ));
getTestMethodName() + "_RR", totalSize ));
vm6.invoke(() -> WANTestBase.validateRegionSize(
getTestMethodName() + "_RR", 3 ));
getTestMethodName() + "_RR", totalSize ));
vm7.invoke(() -> WANTestBase.validateRegionSize(
getTestMethodName() + "_RR", 3 ));
getTestMethodName() + "_RR", totalSize ));
vm4.invoke(() -> WANTestBase.validateRegionSize(
getTestMethodName() + "_RR", totalSize ));
vm3.invoke(() -> WANTestBase.validateRegionSize(
getTestMethodName() + "_RR", totalSize ));


Wait.pause(5000);
vm6.invoke(() -> WANTestBase.verifyQueueSize( "ln", 0 ));
vm7.invoke(() -> WANTestBase.verifyQueueSize( "ny", 0 ));
vm5.invoke(() -> WANTestBase.verifyQueueSize( "tk", 0 ));
Expand Down

0 comments on commit 80ac995

Please sign in to comment.