use of org.junit.experimental.categories.Category in project geode by apache.
the class PersistentColocatedPartitionedRegionDUnitTest method testRebalanceWithOfflineChildRegionTwoDiskStores.
// GEODE-1380: time sensitive, async actions with 30 sec max
@Category(FlakyTest.class)
@Test
public void testRebalanceWithOfflineChildRegionTwoDiskStores() throws Throwable {
SerializableRunnable createParentPR = new SerializableRunnable() {
public void run() {
Cache cache = getCache();
DiskStore ds = cache.findDiskStore("disk");
if (ds == null) {
ds = cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create("disk");
}
AttributesFactory af = new AttributesFactory();
PartitionAttributesFactory paf = new PartitionAttributesFactory();
paf.setRedundantCopies(0);
paf.setRecoveryDelay(0);
af.setPartitionAttributes(paf.create());
af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
af.setDiskStoreName("disk");
cache.createRegion(PR_REGION_NAME, af.create());
}
};
SerializableRunnable createChildPR = new SerializableRunnable() {
public void run() {
Cache cache = getCache();
DiskStore ds2 = cache.findDiskStore("disk2");
if (ds2 == null) {
ds2 = cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create("disk2");
}
AttributesFactory af = new AttributesFactory();
PartitionAttributesFactory paf = new PartitionAttributesFactory();
paf.setRedundantCopies(0);
paf.setRecoveryDelay(0);
paf.setColocatedWith(PR_REGION_NAME);
af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
af.setDiskStoreName("disk2");
af.setPartitionAttributes(paf.create());
cache.createRegion("region2", af.create());
}
};
rebalanceWithOfflineChildRegion(createParentPR, createChildPR);
}
use of org.junit.experimental.categories.Category in project geode by apache.
the class PersistentRecoveryOrderDUnitTest method testCrashDuringPreparePersistentId.
// GEODE-1703: fails assertion: Region not created within30000
@Category(FlakyTest.class)
@Test
public void testCrashDuringPreparePersistentId() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
// Add a hook which will disconnect from the distributed
// system when the initial image message shows up.
vm0.invoke(new SerializableRunnable() {
public void run() {
DistributionMessageObserver.setInstance(new DistributionMessageObserver() {
@Override
public void beforeProcessMessage(DistributionManager dm, DistributionMessage message) {
if (message instanceof PrepareNewPersistentMemberMessage) {
DistributionMessageObserver.setInstance(null);
disconnectFromDS();
}
}
@Override
public void afterProcessMessage(DistributionManager dm, DistributionMessage message) {
}
});
}
});
createPersistentRegion(vm0);
putAnEntry(vm0);
updateTheEntry(vm0);
AsyncInvocation async1 = createPersistentRegionAsync(vm1);
// Wait for vm 1 to get stuck waiting for vm0, because vm0 has crashed
waitForBlockedInitialization(vm1);
// closeCache(vm0);
closeCache(vm1);
try {
async1.getResult();
fail("Should have seen a CacheClosedException");
} catch (AssertionError e) {
if (!CacheClosedException.class.isInstance(getRootCause(e))) {
throw e;
}
}
createPersistentRegion(vm0);
createPersistentRegion(vm1);
;
checkForEntry(vm0);
checkForEntry(vm1);
}
use of org.junit.experimental.categories.Category in project geode by apache.
the class DestroyEntryPropagationDUnitTest method testVerifyDestroyNotReceivedBySender.
/**
* This tests whether the destroy are received by the sender or not if there are situation of
* Interest List fail over
*/
// GEODE-897: random port, time sensitive, waitForCriterion, 2 minute
@Category(FlakyTest.class)
// timeouts, eats exception (1 fixed)
@Test
public void testVerifyDestroyNotReceivedBySender() {
final int maxWaitTime = Integer.getInteger(WAIT_PROPERTY, WAIT_DEFAULT).intValue();
// First create entries on both servers via the two client
vm2.invoke(() -> DestroyEntryPropagationDUnitTest.createEntriesK1andK2());
vm3.invoke(() -> DestroyEntryPropagationDUnitTest.createEntriesK1andK2());
vm2.invoke(() -> DestroyEntryPropagationDUnitTest.registerKey1());
vm3.invoke(() -> DestroyEntryPropagationDUnitTest.registerKey1());
// Induce fail over of InterestList Endpoint to Server 2 by killing server1
vm0.invoke(() -> DestroyEntryPropagationDUnitTest.killServer(new Integer(PORT1)));
// Wait for 10 seconds to allow fail over. This would mean that Interest
// has failed over to Server2.
vm2.invoke(new CacheSerializableRunnable("Wait for server on port1 to be dead") {
public void run2() throws CacheException {
Region r = cache.getRegion(REGION_NAME);
try {
// Used in the case where we don't have a LiveServerMonitorThread
r.put("ping", "pong1");
} catch (CacheWriterException itsOK) {
}
try {
// Used in the case where we don't have a LiveServerMonitorThread
r.put("ping", "pong1");
} catch (CacheWriterException itsOK) {
}
String poolName = r.getAttributes().getPoolName();
assertNotNull(poolName);
final PoolImpl pool = (PoolImpl) PoolManager.find(poolName);
assertNotNull(pool);
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return pool.getConnectedServerCount() != 2;
}
public String description() {
return null;
}
};
Wait.waitForCriterion(ev, maxWaitTime, 200, true);
}
});
// Start Server1 again so that both clients1 & Client 2 will establish
// connection to server1 too.
vm0.invoke(() -> DestroyEntryPropagationDUnitTest.startServer(new Integer(PORT1)));
vm2.invoke(new CacheSerializableRunnable("Wait for server on port1 to spring to life") {
public void run2() throws CacheException {
Region r = cache.getRegion(REGION_NAME);
String poolName = r.getAttributes().getPoolName();
assertNotNull(poolName);
final PoolImpl pool = (PoolImpl) PoolManager.find(poolName);
assertNotNull(pool);
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return pool.getConnectedServerCount() == 2;
}
public String description() {
return null;
}
};
Wait.waitForCriterion(ev, maxWaitTime, 200, true);
}
});
// Do a destroy on Server1 via Connection object from client1.
// Client1 should not receive updated value while client2 should receive
vm2.invoke(() -> acquireConnectionsAndDestroyEntriesK1andK2());
// pause(10000);
// Check if both the puts ( on key1 & key2 ) have reached the servers
vm0.invoke(() -> DestroyEntryPropagationDUnitTest.verifyEntriesAreDestroyed());
vm1.invoke(() -> DestroyEntryPropagationDUnitTest.verifyEntriesAreDestroyed());
vm2.invoke(() -> DestroyEntryPropagationDUnitTest.verifyNoDestroyEntryInSender());
}
use of org.junit.experimental.categories.Category in project geode by apache.
the class RegionManagementDUnitTest method testLruStats.
// GEODE-1930
@Category(FlakyTest.class)
@Test
public void testLruStats() throws Exception {
createMembersAndThenManagers_tmp();
for (VM memberVM : this.memberVMs) {
createDiskRegion(memberVM);
}
verifyEntrySize(this.managerVM, 3);
}
use of org.junit.experimental.categories.Category in project geode by apache.
the class GemfireDataCommandsDUnitTest method testRebalanceForEntireDS.
// GEODE-1487
@Category(FlakyTest.class)
@Test
public void testRebalanceForEntireDS() {
setupTestRebalanceForEntireDS();
// check if DistributedRegionMXBean is available so that command will not fail
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
getLogWriter().info("testRebalanceForEntireDS verified Mbean and executin command");
String command = "rebalance";
CommandResult cmdResult = executeCommand(command);
getLogWriter().info("testRebalanceForEntireDS just after executing " + cmdResult);
if (cmdResult != null) {
String stringResult = commandResultToString(cmdResult);
getLogWriter().info("testRebalanceForEntireDS stringResult : " + stringResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
} else {
fail("testRebalanceForIncludeRegionFunction failed as did not get CommandResult");
}
}
Aggregations