use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class FileWriteAheadLogManagerSelfTest method testGettingMinWalArchiveSizeFromConfiguration.
/**
* Testing of {@link FileWriteAheadLogManager#minWalArchiveSize(DataStorageConfiguration)}.
*/
@Test
@WithSystemProperty(key = IGNITE_THRESHOLD_WAL_ARCHIVE_SIZE_PERCENTAGE, value = "-1")
public void testGettingMinWalArchiveSizeFromConfiguration() {
DataStorageConfiguration cfg = new DataStorageConfiguration().setMaxWalArchiveSize(UNLIMITED_WAL_ARCHIVE);
for (long i : F.asList(10L, 20L, HALF_MAX_WAL_ARCHIVE_SIZE)) assertEquals(UNLIMITED_WAL_ARCHIVE, minWalArchiveSize(cfg.setMinWalArchiveSize(i)));
cfg.setMaxWalArchiveSize(100);
for (long i : F.asList(10L, 20L)) assertEquals(i, minWalArchiveSize(cfg.setMinWalArchiveSize(i)));
assertEquals(50, minWalArchiveSize(cfg.setMinWalArchiveSize(HALF_MAX_WAL_ARCHIVE_SIZE)));
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class FailureProcessorThreadDumpThrottlingTest method testDefaultThrottlingTimeout.
/**
* Tests that default thread dump trhottling timeout equals failure detection timeout.
*/
@Test
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE, value = "true")
public void testDefaultThrottlingTimeout() throws Exception {
IgniteEx ignite = ignite(0);
assertEquals(ignite.context().failure().dumpThreadsTrottlingTimeout(), ignite.configuration().getFailureDetectionTimeout().longValue());
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class FailureProcessorThreadDumpThrottlingTest method testThrottling.
/**
* Tests that thread dumps will be throttled and will be generated again after timeout exceeded.
*/
@Test
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE, value = "true")
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE_THROTTLING_TIMEOUT, value = "3000")
public void testThrottling() throws Exception {
LogListener dumpLsnr = LogListener.matches(THREAD_DUMP_MSG).times(2).build();
LogListener throttledLsnr = LogListener.matches("Thread dump is hidden").times(2).build();
testLog.registerListener(dumpLsnr);
testLog.registerListener(throttledLsnr);
IgniteEx ignite = ignite(0);
FailureContext failureCtx = new FailureContext(SYSTEM_WORKER_BLOCKED, new Throwable("Failure context error"));
for (int i = 0; i < 2; i++) ignite.context().failure().process(failureCtx);
U.sleep(3000);
for (int i = 0; i < 2; i++) ignite.context().failure().process(failureCtx);
assertTrue(dumpLsnr.check());
assertTrue(throttledLsnr.check());
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class FailureProcessorThreadDumpThrottlingTest method testNoThrottling.
/**
* Tests that thread dumps will get for every failure for disabled throttling.
*/
@Test
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE, value = "true")
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE_THROTTLING_TIMEOUT, value = "0")
public void testNoThrottling() throws Exception {
LogListener lsnr = LogListener.matches(THREAD_DUMP_MSG).times(2).build();
testLog.registerListener(lsnr);
IgniteEx ignite = ignite(0);
FailureContext failureCtx = new FailureContext(SYSTEM_WORKER_BLOCKED, new Throwable("Failure context error"));
for (int i = 0; i < 2; i++) ignite.context().failure().process(failureCtx);
assertTrue(lsnr.check());
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class H2TreeCorruptedTreeExceptionTest method testCorruptedTree.
/**
*/
@Test
@WithSystemProperty(key = IGNITE_TO_STRING_INCLUDE_SENSITIVE, value = "false")
public void testCorruptedTree() throws Exception {
IgniteEx srv = startGrid(0);
srv.cluster().active(true);
IgniteCache<Integer, Integer> cache = srv.getOrCreateCache(DEFAULT_CACHE_NAME);
cache.query(new SqlFieldsQuery("create table a (col1 varchar primary key, col2 varchar) with " + "\"CACHE_GROUP=" + GRP_NAME + "\""));
cache.query(new SqlFieldsQuery("create index " + IDX_NAME + " on a(col2)"));
failWithCorruptTree.set(true);
try {
cache.query(new SqlFieldsQuery("insert into a(col1, col2) values (1, ?1)").setArgs(VERY_SENS_STR_DATA));
fail("Cache operations are expected to fail");
} catch (Throwable e) {
assertTrue(X.hasCause(e, CorruptedTreeException.class));
}
assertTrue(logListener.check());
assertFalse(logSensListener.check());
System.setProperty(IGNITE_TO_STRING_INCLUDE_SENSITIVE, Boolean.TRUE.toString());
clearGridToStringClassCache();
logListener.reset();
logSensListener.reset();
try {
cache.query(new SqlFieldsQuery("insert into a(col1, col2) values (2, ?1)").setArgs(VERY_SENS_STR_DATA));
} catch (Throwable e) {
assertTrue(X.hasCause(e, CorruptedTreeException.class));
}
assertFalse(logListener.check());
assertTrue(logSensListener.check());
}
Aggregations