use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class MetaStorageCompatibilityTest method testMigrationWithExceptionDuringTheProcess.
/**
*/
@Test
@WithSystemProperty(key = IGNITE_DISABLE_WAL_DURING_REBALANCING, value = "false")
public void testMigrationWithExceptionDuringTheProcess() throws Exception {
try {
U.delete(new File(U.defaultWorkDirectory()));
startGrid(1, IGNITE_VERSION, new ConfigurationClosure(CONSISTENT_ID_1), new ActivateAndStopClosure());
stopAllGrids();
try (Ignite ig0 = IgnitionEx.start(prepareConfig(getConfiguration(), CONSISTENT_ID_1, PART_FILE))) {
// trigger checkpoint on close()
ig0.getOrCreateCache("default-cache").put(1, 1);
}
assertTrue(metastorageFileExists(INDEX_BIN_FILE));
assertTrue(metastorageFileExists(PART_FILE));
try (Ignite ig0 = IgnitionEx.start(prepareConfig(getConfiguration(), CONSISTENT_ID_1, INDEX_BIN_FILE))) {
// trigger checkpoint on close()
ig0.getOrCreateCache("default-cache").put(1, 1);
}
assertTrue(metastorageFileExists(INDEX_BIN_FILE));
assertFalse(metastorageFileExists(PART_FILE));
try (Ignite ig0 = IgnitionEx.start(prepareConfig(getConfiguration(), CONSISTENT_ID_1))) {
try (Ignite ig1 = IgnitionEx.start(prepareConfig(getConfiguration(), CONSISTENT_ID_2))) {
ig0.cluster().setBaselineTopology(ig1.cluster().topologyVersion());
}
}
try (Ignite ig0 = IgnitionEx.start(prepareConfig(getConfiguration(), CONSISTENT_ID_1))) {
try (Ignite ig1 = IgnitionEx.start(prepareConfig(getConfiguration(), CONSISTENT_ID_2))) {
assertTrue(GridTestUtils.waitForCondition(() -> ig1.cluster().state() == ACTIVE, 10_000));
}
}
} finally {
stopAllGrids();
}
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class GridCommandHandlerTest method testDeactivateWithCheckClusterNameInConfirmationBySystemProperty.
/**
* Test the deactivation command on the active and no cluster with checking
* the cluster name(which is set through the system property) in
* confirmation.
*
* @throws Exception If failed.
*/
@Test
@WithSystemProperty(key = IGNITE_CLUSTER_NAME, value = "TEST_CLUSTER_NAME")
public void testDeactivateWithCheckClusterNameInConfirmationBySystemProperty() throws Exception {
IgniteEx igniteEx = startGrid(0);
assertFalse(igniteEx.cluster().active());
deactivateActiveOrNotClusterWithCheckClusterNameInConfirmation(igniteEx, "TEST_CLUSTER_NAME");
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class BinaryConfigurationConsistencySelfTest method testSkipCheckConsistencyFlagEnabled.
/**
* @throws Exception If failed.
*/
@Test
@WithSystemProperty(key = IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, value = "true")
public void testSkipCheckConsistencyFlagEnabled() throws Exception {
// Wrong usage of Ignite (done only in test purposes).
binaryCfg = null;
startGrid(0);
binaryCfg = new BinaryConfiguration();
startGrid(1);
binaryCfg = customConfig(true);
startClientGrid(2);
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class CheckpointReadLockFailureTest method testWriteLockedByCurrentThread.
/**
* @throws Exception If failed.
*/
@Test
@WithSystemProperty(key = IGNITE_PDS_LOG_CP_READ_LOCK_HOLDERS, value = "true")
public void testWriteLockedByCurrentThread() {
ReentrantReadWriteLockWithTracking wrapped = new ReentrantReadWriteLockWithTracking(log, 1_000);
wrapped.writeLock().lock();
try {
assertTrue(wrapped.isWriteLockedByCurrentThread());
} finally {
wrapped.writeLock().unlock();
}
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class CommonPoolStarvationCheckpointTest method testCommonPoolStarvation.
/**
* @throws Exception if failed.
*/
@Test
@WithSystemProperty(key = IgniteSystemProperties.CHECKPOINT_PARALLEL_SORT_THRESHOLD, value = "0")
public void testCommonPoolStarvation() throws Exception {
IgniteEx grid = startGrid(0);
grid.cluster().active(true);
IgniteCache<Integer, OnePageValue> cache = grid.cache(CACHE_NAME);
forceCheckpoint();
for (int i = 0; i < ENTRIES_COUNT; i++) cache.put(i, new OnePageValue());
CountDownLatch latch = new CountDownLatch(1);
ForkJoinPool commonPool = ForkJoinPool.commonPool();
for (int i = 0; i < Runtime.getRuntime().availableProcessors() * 10; i++) {
commonPool.submit(() -> {
try {
latch.await();
} catch (InterruptedException e) {
throw new IgniteInterruptedException(e);
}
});
}
forceCheckpoint();
latch.countDown();
}
Aggregations