use of org.apache.ignite.failure.TestFailureHandler in project ignite by apache.
the class IgniteClientRejoinTest method testClientsReconnectDisabled.
/**
* @throws Exception If failed.
*/
@Test
public void testClientsReconnectDisabled() throws Exception {
clientReconnectDisabled = true;
Ignite srv1 = startGrid("server1");
if (!tcpDiscovery())
return;
crd = ((IgniteKernal) srv1).localNode();
Ignite srv2 = startGrid("server2");
block = true;
List<IgniteInternalFuture<Ignite>> futs = new ArrayList<>();
final CountDownLatch latch = new CountDownLatch(1);
final int CLIENTS_NUM = 5;
final CountDownLatch failureHndLatch = new CountDownLatch(CLIENTS_NUM);
for (int i = 0; i < CLIENTS_NUM; i++) {
final int idx = i;
IgniteInternalFuture<Ignite> fut = GridTestUtils.runAsync(new Callable<Ignite>() {
@Override
public Ignite call() throws Exception {
latch.await();
String igniteInstanceName = "client" + idx;
return startClientGrid(igniteInstanceName, getConfiguration(igniteInstanceName).setFailureHandler(new TestFailureHandler(true, failureHndLatch)));
}
});
futs.add(fut);
}
latch.countDown();
for (final IgniteInternalFuture<Ignite> clientFut : futs) {
// noinspection ThrowableNotThrown
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override
public Object call() throws Exception {
clientFut.get();
return null;
}
}, IgniteCheckedException.class, null);
}
assertTrue(failureHndLatch.await(1000, TimeUnit.MILLISECONDS));
assertEquals(0, srv1.cluster().forClients().nodes().size());
assertEquals(0, srv2.cluster().forClients().nodes().size());
}
use of org.apache.ignite.failure.TestFailureHandler in project ignite by apache.
the class GridCacheContinuousQueryNodesFilteringTest method testNodeWithAttributeFailure.
/**
* Test that node matched by filter and having filter instantiation problems fails for sure.
*
* @throws Exception if failed.
*/
@Test
public void testNodeWithAttributeFailure() throws Exception {
try (Ignite node1 = startNodeWithCache()) {
CountDownLatch latch = new CountDownLatch(1);
FailureHandler failHnd = new TestFailureHandler(false, latch);
IgniteConfiguration node2Cfg = getConfiguration("node2", true, null).setFailureHandler(failHnd);
try (Ignite node2 = startGrid(node2Cfg)) {
assertTrue("Failure handler hasn't been invoked on the joined node.", latch.await(5, TimeUnit.SECONDS));
}
}
}
use of org.apache.ignite.failure.TestFailureHandler in project ignite by apache.
the class FailureProcessorLoggingTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TestFailureHandler hnd = new TestFailureHandler(false);
testLog = new CustomTestLogger(log);
hnd.setIgnoredFailureTypes(ImmutableSet.of(FailureType.SYSTEM_CRITICAL_OPERATION_TIMEOUT, FailureType.SYSTEM_WORKER_BLOCKED));
cfg.setFailureHandler(hnd);
cfg.setGridLogger(testLog);
return cfg;
}
use of org.apache.ignite.failure.TestFailureHandler in project ignite by apache.
the class IgniteWalFormatFileFailoverTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
cfg.setCacheConfiguration(new CacheConfiguration(TEST_CACHE).setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));
DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(2048L * 1024 * 1024).setPersistenceEnabled(true)).setWalMode(fsync ? WALMode.FSYNC : WALMode.BACKGROUND).setWalBufferSize(1024 * 1024).setWalSegmentSize(512 * 1024).setFileIOFactory(new FailingFileIOFactory(failMtdNameRef));
cfg.setDataStorageConfiguration(memCfg);
cfg.setFailureHandler(new TestFailureHandler(false));
return cfg;
}
use of org.apache.ignite.failure.TestFailureHandler in project ignite by apache.
the class FailureProcessorThreadDumpThrottlingTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TestFailureHandler hnd = new TestFailureHandler(false);
hnd.setIgnoredFailureTypes(ImmutableSet.of(FailureType.SYSTEM_CRITICAL_OPERATION_TIMEOUT, SYSTEM_WORKER_BLOCKED));
cfg.setFailureHandler(hnd);
cfg.setGridLogger(testLog);
return cfg;
}
Aggregations