Search in sources :

Example 16 with WithSystemProperty

use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.

the class IgniteWalHistoryReservationsTest method testCheckpointsNotReserveWithWalModeNone.

/**
 * @throws Exception If failed.
 */
@Test
@WithSystemProperty(key = IGNITE_PDS_WAL_REBALANCE_THRESHOLD, value = "0")
public void testCheckpointsNotReserveWithWalModeNone() throws Exception {
    walMode = WALMode.NONE;
    IgniteEx grid = startGrids(2);
    grid.cluster().active(true);
    IgniteCache<Object, Object> cache = grid.createCache(new CacheConfiguration<>("cache").setBackups(1));
    for (int i = 0; i < 1000; i++) cache.put(i, i);
    stopGrid(1);
    for (int i = 1000; i < 2000; i++) cache.put(i, i);
    startGrid(1);
}
Also used : IgniteEx(org.apache.ignite.internal.IgniteEx) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test) WithSystemProperty(org.apache.ignite.testframework.junits.WithSystemProperty)

Example 17 with WithSystemProperty

use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.

the class PerformanceStatisticsPropertiesTest method testCachedStringsThreshold.

/**
 * @throws Exception If failed.
 */
@Test
@WithSystemProperty(key = IGNITE_PERF_STAT_CACHED_STRINGS_THRESHOLD, value = "" + TEST_CACHED_STRINGS_THRESHOLD)
public void testCachedStringsThreshold() throws Exception {
    int tasksCnt = TEST_CACHED_STRINGS_THRESHOLD * 2;
    int executions = 2;
    startCollectStatistics();
    int expLen = 0;
    for (int i = 0; i < tasksCnt; i++) {
        String taskName = "TestTask-" + i;
        if (i < TEST_CACHED_STRINGS_THRESHOLD - 1 - srv.context().cache().cacheDescriptors().values().size()) {
            expLen += taskRecordSize(taskName.getBytes().length, false) + jobRecordSize() + (taskRecordSize(0, true) + jobRecordSize()) * (executions - 1);
        } else
            expLen += (taskRecordSize(taskName.getBytes().length, false) + jobRecordSize()) * executions;
        expLen += /*typeOp*/
        2 * executions;
        for (int j = 0; j < executions; j++) {
            srv.compute().withName(taskName).run(new IgniteRunnable() {

                @Override
                public void run() {
                // No-op.
                }
            });
        }
    }
    AtomicInteger tasks = new AtomicInteger();
    stopCollectStatisticsAndRead(new TestHandler() {

        @Override
        public void task(UUID nodeId, IgniteUuid sesId, String taskName, long startTime, long duration, int affPartId) {
            tasks.incrementAndGet();
        }
    });
    assertEquals(tasksCnt * executions, tasks.get());
    // Started caches.
    expLen += srv.context().cache().cacheDescriptors().values().stream().mapToInt(desc -> 1 + cacheStartRecordSize(desc.cacheName().getBytes().length, false)).sum();
    List<File> files = statisticsFiles();
    assertEquals(1, files.size());
    assertEquals(expLen, files.get(0).length());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IgniteUuid(org.apache.ignite.lang.IgniteUuid) UUID(java.util.UUID) File(java.io.File) IgniteRunnable(org.apache.ignite.lang.IgniteRunnable) Test(org.junit.Test) WithSystemProperty(org.apache.ignite.testframework.junits.WithSystemProperty)

Example 18 with WithSystemProperty

use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.

the class DistributedMetaStoragePersistentTest method testJoinDirtyNodeFullData.

/**
 * @throws Exception If failed.
 */
@Test
@WithSystemProperty(key = IGNITE_GLOBAL_METASTORAGE_HISTORY_MAX_BYTES, value = "0")
public void testJoinDirtyNodeFullData() throws Exception {
    IgniteEx ignite = startGrid(0);
    startGrid(1);
    ignite.cluster().active(true);
    ignite.context().distributedMetastorage().write("key1", "value1");
    stopGrid(1);
    stopGrid(0);
    ignite = startGrid(0);
    ignite.cluster().active(true);
    ignite.context().distributedMetastorage().write("key2", "value2");
    ignite.context().distributedMetastorage().write("key3", "value3");
    IgniteEx newNode = startGrid(1);
    assertEquals("value1", newNode.context().distributedMetastorage().read("key1"));
    assertEquals("value2", newNode.context().distributedMetastorage().read("key2"));
    assertEquals("value3", newNode.context().distributedMetastorage().read("key3"));
    assertDistributedMetastoragesAreEqual(ignite, newNode);
}
Also used : IgniteEx(org.apache.ignite.internal.IgniteEx) Test(org.junit.Test) WithSystemProperty(org.apache.ignite.testframework.junits.WithSystemProperty)

Example 19 with WithSystemProperty

use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.

the class DistributedMetaStoragePersistentTest method testJoinNodeWithoutEnoughHistory.

/**
 * @throws Exception If failed.
 */
@Test
@Ignore
@WithSystemProperty(key = IGNITE_GLOBAL_METASTORAGE_HISTORY_MAX_BYTES, value = "0")
public void testJoinNodeWithoutEnoughHistory() throws Exception {
    IgniteEx ignite = startGrid(0);
    startGrid(1);
    ignite.cluster().active(true);
    ignite.context().distributedMetastorage().write("key1", "value1");
    stopGrid(1);
    ignite.context().distributedMetastorage().write("key2", "value2");
    ignite.context().distributedMetastorage().write("key3", "value3");
    stopGrid(0);
    ignite = startGrid(1);
    startGrid(0);
    awaitPartitionMapExchange();
    assertEquals("value1", ignite.context().distributedMetastorage().read("key1"));
    assertEquals("value2", ignite.context().distributedMetastorage().read("key2"));
    assertEquals("value3", ignite.context().distributedMetastorage().read("key3"));
    assertDistributedMetastoragesAreEqual(ignite, grid(0));
}
Also used : IgniteEx(org.apache.ignite.internal.IgniteEx) Ignore(org.junit.Ignore) Test(org.junit.Test) WithSystemProperty(org.apache.ignite.testframework.junits.WithSystemProperty)

Example 20 with WithSystemProperty

use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.

the class DistributedMetaStorageTest method testJoinCleanNodeFullData.

/**
 * @throws Exception If failed.
 */
@Test
@WithSystemProperty(key = IGNITE_GLOBAL_METASTORAGE_HISTORY_MAX_BYTES, value = "0")
public void testJoinCleanNodeFullData() throws Exception {
    IgniteEx ignite = startGrid(0);
    ignite.cluster().active(true);
    ignite.context().distributedMetastorage().write("key1", "value1");
    ignite.context().distributedMetastorage().write("key2", "value2");
    startGrid(1);
    assertEquals("value1", metastorage(1).read("key1"));
    assertEquals("value2", metastorage(1).read("key2"));
    assertDistributedMetastoragesAreEqual(ignite, grid(1));
}
Also used : IgniteEx(org.apache.ignite.internal.IgniteEx) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test) WithSystemProperty(org.apache.ignite.testframework.junits.WithSystemProperty)

Aggregations

WithSystemProperty (org.apache.ignite.testframework.junits.WithSystemProperty)71 Test (org.junit.Test)71 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)59 IgniteEx (org.apache.ignite.internal.IgniteEx)46 Ignite (org.apache.ignite.Ignite)20 LogListener (org.apache.ignite.testframework.LogListener)16 CountDownLatch (java.util.concurrent.CountDownLatch)15 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)12 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)11 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)10 File (java.io.File)9 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)9 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)8 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)8 ListeningTestLogger (org.apache.ignite.testframework.ListeningTestLogger)8 List (java.util.List)7 IgniteCache (org.apache.ignite.IgniteCache)7 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)7 ClusterNode (org.apache.ignite.cluster.ClusterNode)7 TestRecordingCommunicationSpi (org.apache.ignite.internal.TestRecordingCommunicationSpi)7