This is an automated email from the ASF dual-hosted git repository.

mpetrov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 5d4f183aa36 IGNITE-28055 Removed unexpected usages of Multicast IP 
Finder in tests (#12849)
5d4f183aa36 is described below

commit 5d4f183aa36f5209312f9ed4e732d21e51eef776
Author: Mikhail Petrov <[email protected]>
AuthorDate: Fri Mar 6 12:56:59 2026 +0300

    IGNITE-28055 Removed unexpected usages of Multicast IP Finder in tests 
(#12849)
---
 .../internal/client/thin/ServiceAwarenessTest.java |   6 +-
 .../ignite/internal/metric/JmxExporterSpiTest.java | 245 ++++++++++-----------
 .../ignite/internal/metric/SystemViewSelfTest.java |   8 +-
 .../cache/CacheFutureExceptionSelfTest.java        |   3 +-
 .../cache/GridCacheLifecycleAwareSelfTest.java     |   3 -
 .../db/IgniteSequentialNodeCrashRecoveryTest.java  |   5 +-
 .../CustomCacheStorageConfigurationSelfTest.java   |  24 +-
 .../snapshot/IgniteClusterSnapshotCheckTest.java   |   2 -
 .../snapshot/dump/IgniteCacheDumpSelf2Test.java    |   8 +-
 .../ignite/services/ServiceThreadPoolSelfTest.java |   6 +-
 .../cache/BinaryTypeRegistrationTest.java          |   6 +-
 .../cache/metric/SqlViewExporterSpiTest.java       |   7 +-
 .../query/IgniteSqlCreateTableTemplateTest.java    |   4 +-
 .../processors/query/RunningQueriesTest.java       |  33 +--
 .../processors/query/SqlSystemViewsSelfTest.java   |  29 +--
 15 files changed, 191 insertions(+), 198 deletions(-)

diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ServiceAwarenessTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ServiceAwarenessTest.java
index 77ae572bd0e..5943b5e2c72 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ServiceAwarenessTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ServiceAwarenessTest.java
@@ -100,7 +100,11 @@ public class ServiceAwarenessTest extends 
AbstractThinClientTest {
     @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        cfg.setDiscoverySpi(new TestBlockingDiscoverySpi());
+        TestBlockingDiscoverySpi discoSpi = new TestBlockingDiscoverySpi();
+
+        
discoSpi.setIpFinder(((TcpDiscoverySpi)cfg.getDiscoverySpi()).getIpFinder());
+
+        cfg.setDiscoverySpi(discoSpi);
         cfg.setUserAttributes(Collections.singletonMap(ATTR_NODE_IDX, 
getTestIgniteInstanceIndex(igniteInstanceName)));
 
         return cfg;
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/metric/JmxExporterSpiTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/metric/JmxExporterSpiTest.java
index 44452ca3209..5f3c9207036 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/metric/JmxExporterSpiTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/metric/JmxExporterSpiTest.java
@@ -22,7 +22,6 @@ import java.sql.Connection;
 import java.text.DateFormat;
 import java.time.LocalTime;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
@@ -44,7 +43,6 @@ import javax.management.MBeanParameterInfo;
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.TabularDataSupport;
 import com.google.common.collect.Iterators;
-import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteJdbcThinDriver;
@@ -79,17 +77,13 @@ import 
org.apache.ignite.internal.processors.service.DummyService;
 import org.apache.ignite.internal.systemview.CachePagesListViewWalker;
 import org.apache.ignite.internal.thread.pool.IgniteStripedExecutor;
 import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.G;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.services.ServiceConfiguration;
-import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
-import 
org.apache.ignite.spi.communication.tcp.internal.TcpCommunicationConfigInitializer;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
 import org.apache.ignite.spi.metric.noop.NoopMetricExporterSpi;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.transactions.Transaction;
-import org.jetbrains.annotations.Nullable;
+import org.apache.ignite.transactions.TransactionState;
 import org.junit.Test;
 
 import static java.util.Arrays.stream;
@@ -130,13 +124,9 @@ import static 
org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
 import static 
org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
 import static 
org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
 import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
-import static org.apache.ignite.transactions.TransactionState.ACTIVE;
 
 /** */
 public class JmxExporterSpiTest extends AbstractExporterSpiTest {
-    /** */
-    private static IgniteEx ignite;
-
     /** */
     private static final String REGISTRY_NAME = "test_registry";
 
@@ -166,22 +156,10 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
         cleanPersistenceDir();
-
-        ignite = startGrid(0);
-
-        ignite.cluster().state(ClusterState.ACTIVE);
     }
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        Collection<String> caches = ignite.cacheNames();
-
-        for (String cache : caches)
-            ignite.destroyCache(cache);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
         stopAllGrids(true);
 
         cleanPersistenceDir();
@@ -192,16 +170,11 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     public void testJmxMetricsExporterIsEnabledByDefault() throws Exception {
         presetJmxMetricExporter = false;
 
-        IgniteConfiguration cfg = startDedicatedNode(null);
+        IgniteConfiguration cfg = startGrid(0).configuration();
 
-        try {
-            assertTrue(!F.isEmpty(cfg.getMetricExporterSpi()));
-            assertTrue(cfg.getMetricExporterSpi().length == 1);
-            assertTrue(cfg.getMetricExporterSpi()[0] instanceof 
JmxMetricExporterSpi);
-        }
-        finally {
-            stopGrid(cfg.getIgniteInstanceName());
-        }
+        assertTrue(!F.isEmpty(cfg.getMetricExporterSpi()));
+        assertTrue(cfg.getMetricExporterSpi().length == 1);
+        assertTrue(cfg.getMetricExporterSpi()[0] instanceof 
JmxMetricExporterSpi);
     }
 
     /** */
@@ -214,14 +187,9 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
 
             presetJmxMetricExporter = false;
 
-            IgniteConfiguration cfg = startDedicatedNode(null);
+            IgniteConfiguration cfg = startGrid(0).configuration();
 
-            try {
-                assertTrue(stream(cfg.getMetricExporterSpi()).noneMatch(spi -> 
spi instanceof JmxMetricExporterSpi));
-            }
-            finally {
-                stopGrid(cfg.getIgniteInstanceName());
-            }
+            assertTrue(stream(cfg.getMetricExporterSpi()).noneMatch(spi -> spi 
instanceof JmxMetricExporterSpi));
         }
         finally {
             U.IGNITE_MBEANS_DISABLED = beansDisabled;
@@ -231,21 +199,19 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testJmxMetricsExporterIsDisabled() throws Exception {
-        IgniteConfiguration cfg = 
startDedicatedNode(getConfiguration(getTestIgniteInstanceName(G.allGrids().size()))
-            .setMetricExporterSpi(new NoopMetricExporterSpi()));
+        IgniteConfiguration cfg = 
startGrid(getConfiguration(getTestIgniteInstanceName(0))
+            .setMetricExporterSpi(new NoopMetricExporterSpi())
+        ).configuration();
 
-        try {
-            assertTrue(F.isEmpty(cfg.getMetricExporterSpi()) ||
-                stream(cfg.getMetricExporterSpi()).noneMatch(spi -> spi 
instanceof JmxMetricExporterSpi));
-        }
-        finally {
-            stopGrid(cfg.getIgniteInstanceName());
-        }
+        assertTrue(F.isEmpty(cfg.getMetricExporterSpi()) ||
+            stream(cfg.getMetricExporterSpi()).noneMatch(spi -> spi instanceof 
JmxMetricExporterSpi));
     }
 
     /** */
     @Test
     public void testSysJmxMetrics() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+        
         DynamicMBean sysMBean = metricRegistry(ignite.name(), null, 
SYS_METRICS);
 
         Set<String> res = stream(sysMBean.getMBeanInfo().getAttributes())
@@ -277,6 +243,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testDataRegionJmxMetrics() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+        
         DynamicMBean dataRegionMBean = metricRegistry(ignite.name(), "io", 
"dataregion.default");
 
         Set<String> res = 
stream(dataRegionMBean.getMBeanInfo().getAttributes())
@@ -298,6 +266,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testUnregisterRemovedRegistry() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+        
         String n = "cache-for-remove";
 
         IgniteCache c = ignite.createCache(n);
@@ -314,6 +284,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testFilterAndExport() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+        
         createAdditionalMetrics(ignite);
 
         assertThrowsWithCause(new Runnable() {
@@ -334,7 +306,9 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
 
     /** */
     @Test
-    public void testRemoveFilteredRegistry() {
+    public void testRemoveFilteredRegistry() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+        
         String regName = MetricUtils.metricName(FILTERED_PREFIX, 
"registry-for-remove");
 
         GridMetricManager mmgr = ignite.context().metric();
@@ -355,6 +329,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testCachesView() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+        
         Set<String> cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
 
         for (String name : cacheNames)
@@ -376,6 +352,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testCacheGroupsView() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+        
         Set<String> grpNames = new HashSet<>(Arrays.asList("grp-1", "grp-2"));
 
         for (String grpName : grpNames)
@@ -397,6 +375,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testServices() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+        
         ServiceConfiguration srvcCfg = new ServiceConfiguration();
 
         srvcCfg.setName("service");
@@ -420,6 +400,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testComputeBroadcast() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+        
         CyclicBarrier barrier = new CyclicBarrier(6);
 
         for (int i = 0; i < 5; i++) {
@@ -456,6 +438,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testClientsConnections() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+        
         String host = 
ignite.configuration().getClientConnectorConfiguration().getHost();
 
         if (host == null)
@@ -503,31 +487,32 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testContinuousQuery() throws Exception {
-        try (IgniteEx remoteNode = startGrid(1)) {
-            IgniteCache<Integer, Integer> cache = 
ignite.createCache("cache-1");
-
-            assertEquals(0, systemView(CQ_SYS_VIEW).size());
-            assertEquals(0, systemView(remoteNode, CQ_SYS_VIEW).size());
-
-            try (QueryCursor qry = cache.query(new ContinuousQuery<>()
-                .setInitialQuery(new ScanQuery<>())
-                .setPageSize(100)
-                .setTimeInterval(1000)
-                .setLocalListener(evts -> {
-                    // No-op.
-                })
-                .setRemoteFilterFactory(() -> evt -> true)
-            )) {
-                for (int i = 0; i < 100; i++)
-                    cache.put(i, i);
-
-                checkContinuousQueryView(ignite, ignite);
-                checkContinuousQueryView(ignite, remoteNode);
-            }
-
-            assertEquals(0, systemView(CQ_SYS_VIEW).size());
-            assertTrue(waitForCondition(() -> systemView(remoteNode, 
CQ_SYS_VIEW).isEmpty(), getTestTimeout()));
+        IgniteEx ignite = prepareCluster(2);
+        IgniteEx remoteNode = grid(1);
+        
+        IgniteCache<Integer, Integer> cache = ignite.createCache("cache-1");
+
+        assertEquals(0, systemView(CQ_SYS_VIEW).size());
+        assertEquals(0, systemView(remoteNode, CQ_SYS_VIEW).size());
+
+        try (QueryCursor qry = cache.query(new ContinuousQuery<>()
+            .setInitialQuery(new ScanQuery<>())
+            .setPageSize(100)
+            .setTimeInterval(1000)
+            .setLocalListener(evts -> {
+                // No-op.
+            })
+            .setRemoteFilterFactory(() -> evt -> true)
+        )) {
+            for (int i = 0; i < 100; i++)
+                cache.put(i, i);
+
+            checkContinuousQueryView(ignite, ignite);
+            checkContinuousQueryView(ignite, remoteNode);
         }
+
+        assertEquals(0, systemView(CQ_SYS_VIEW).size());
+        assertTrue(waitForCondition(() -> systemView(remoteNode, 
CQ_SYS_VIEW).isEmpty(), getTestTimeout()));
     }
 
     /** */
@@ -557,7 +542,7 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
 
     /** */
     public TabularDataSupport systemView(String name) {
-        return systemView(ignite, name);
+        return systemView(grid(0), name);
     }
 
     /** */
@@ -607,6 +592,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testHistogramSearchByName() throws Exception {
+        prepareCluster(1);
+
         MetricRegistryImpl mreg = new MetricRegistryImpl("test", name -> null, 
name -> null, name -> null, null);
 
         createTestHistogram(mreg);
@@ -642,6 +629,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testHistogramExport() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+
         MetricRegistryImpl mreg = 
ignite.context().metric().registry("histogramTest");
 
         createTestHistogram(mreg);
@@ -664,6 +653,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testJmxHistogramNamesExport() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+
         MetricRegistryImpl reg = 
ignite.context().metric().registry(REGISTRY_NAME);
 
         String simpleName = "testhist";
@@ -687,6 +678,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testTransactions() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+
         IgniteCache<Integer, Integer> cache = ignite.createCache(new 
CacheConfiguration<Integer, Integer>("c")
             .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));
 
@@ -718,7 +711,7 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
             assertEquals(ignite.localNode().id().toString(), 
txv.get("localNodeId"));
             assertEquals(REPEATABLE_READ.name(), txv.get("isolation"));
             assertEquals(PESSIMISTIC.name(), txv.get("concurrency"));
-            assertEquals(ACTIVE.name(), txv.get("state"));
+            assertEquals(TransactionState.ACTIVE.name(), txv.get("state"));
             assertNotNull(txv.get("xid"));
             assertFalse((boolean)txv.get("system"));
             assertFalse((boolean)txv.get("implicit"));
@@ -758,7 +751,7 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
                 assertEquals(ignite.localNode().id().toString(), 
txv.get("localNodeId"));
                 assertEquals(SERIALIZABLE.name(), txv.get("isolation"));
                 assertEquals(OPTIMISTIC.name(), txv.get("concurrency"));
-                assertEquals(ACTIVE.name(), txv.get("state"));
+                assertEquals(TransactionState.ACTIVE.name(), txv.get("state"));
                 assertNotNull(txv.get("xid"));
                 assertFalse((boolean)txv.get("system"));
                 assertFalse((boolean)txv.get("implicit"));
@@ -786,6 +779,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testLocalScanQuery() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+
         IgniteCache<Integer, Integer> cache1 = ignite.createCache(
             new CacheConfiguration<Integer, Integer>("cache1")
                 .setGroupName("group1"));
@@ -847,6 +842,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testScanQuery() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+
         try (IgniteEx client1 = startClientGrid("client-1");
             IgniteEx client2 = startClientGrid("client-2")) {
 
@@ -895,6 +892,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** @throws Exception If failed. */
     @Test
     public void testIgniteKernal() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+
         DynamicMBean mbn = metricRegistry(ignite.name(), null, IGNITE_METRICS);
 
         assertNotNull(mbn);
@@ -1036,6 +1035,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testSysStripedExecutor() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+
         
checkStripeExecutorView(ignite.context().pools().getStripedExecutorService(),
             SYS_POOL_QUEUE_VIEW,
             "sys");
@@ -1044,36 +1045,13 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testStreamerStripedExecutor() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+
         
checkStripeExecutorView(ignite.context().pools().getDataStreamerExecutorService(),
             STREAM_POOL_QUEUE_VIEW,
             "data-streamer");
     }
 
-    /**
-     * Starts dedicated node.
-     *
-     * @param cfg Ignite Configuration.
-     * @return Actual configuration of the node started.
-     */
-    private IgniteConfiguration startDedicatedNode(@Nullable 
IgniteConfiguration cfg) throws Exception {
-        if (cfg == null)
-            cfg = 
getConfiguration(getTestIgniteInstanceName(G.allGrids().size()));
-
-        cfg.setDiscoverySpi(new TcpDiscoverySpi());
-
-        
((TcpCommunicationConfigInitializer)cfg.getCommunicationSpi()).setLocalPort(TcpCommunicationSpi.DFLT_PORT
 +
-            TcpCommunicationSpi.DFLT_PORT_RANGE + 1);
-
-        int clusterSize = ignite.cluster().nodes().size();
-
-        Ignite ig = startGrid(cfg);
-
-        assertEquals(1, ig.cluster().nodes().size());
-        assertEquals(clusterSize, ignite.cluster().nodes().size());
-
-        return ig.configuration();
-    }
-
     /**
      * Checks striped executor system view.
      *
@@ -1118,6 +1096,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testPagesList() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+
         String cacheName = "cacheFL";
 
         IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(new 
CacheConfiguration<Integer, Integer>()
@@ -1145,7 +1125,9 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
 
     /** */
     @Test
-    public void testBinaryMeta() {
+    public void testBinaryMeta() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+
         IgniteCache<Integer, TestObjectAllTypes> c1 = 
ignite.createCache("test-all-types-cache");
         IgniteCache<Integer, TestObjectEnum> c2 = 
ignite.createCache("test-enum-cache");
 
@@ -1181,6 +1163,8 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testMetastorage() throws Exception {
+        IgniteEx ignite = prepareCluster(1);
+
         IgniteCacheDatabaseSharedManager db = 
ignite.context().cache().context().database();
 
         String name = "test-key";
@@ -1218,42 +1202,44 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testDistributedMetastorage() throws Exception {
-        try (IgniteEx ignite1 = startGrid(1)) {
-            DistributedMetaStorage dms = 
ignite.context().distributedMetastorage();
+        IgniteEx ignite = prepareCluster(2);
 
-            String name = "test-distributed-key";
-            String val = "test-distributed-value";
+        IgniteEx ignite1 = grid(1);
 
-            dms.write(name, val);
+        DistributedMetaStorage dms = ignite.context().distributedMetastorage();
 
-            TabularDataSupport view = systemView(DISTRIBUTED_METASTORE_VIEW);
+        String name = "test-distributed-key";
+        String val = "test-distributed-value";
 
-            boolean found = false;
+        dms.write(name, val);
 
-            for (int i = 0; i < view.size(); i++) {
-                CompositeData row = view.get(new Object[] {i});
+        TabularDataSupport view = systemView(DISTRIBUTED_METASTORE_VIEW);
 
-                if (row.get("name").equals(name) && 
row.get("value").equals(val)) {
-                    found = true;
-                    break;
-                }
+        boolean found = false;
+
+        for (int i = 0; i < view.size(); i++) {
+            CompositeData row = view.get(new Object[] {i});
+
+            if (row.get("name").equals(name) && row.get("value").equals(val)) {
+                found = true;
+                break;
             }
+        }
 
-            assertTrue(found);
+        assertTrue(found);
 
-            assertTrue(waitForCondition(() -> {
-                TabularDataSupport view1 = systemView(ignite1, 
DISTRIBUTED_METASTORE_VIEW);
+        assertTrue(waitForCondition(() -> {
+            TabularDataSupport view1 = systemView(ignite1, 
DISTRIBUTED_METASTORE_VIEW);
 
-                for (int i = 0; i < view1.size(); i++) {
-                    CompositeData row = view1.get(new Object[] {i});
+            for (int i = 0; i < view1.size(); i++) {
+                CompositeData row = view1.get(new Object[] {i});
 
-                    if (row.get("name").equals(name) && 
row.get("value").equals(val))
-                        return true;
-                }
+                if (row.get("name").equals(name) && 
row.get("value").equals(val))
+                    return true;
+            }
 
-                return false;
-            }, getTestTimeout()));
-        }
+            return false;
+        }, getTestTimeout()));
     }
 
     /** */
@@ -1278,4 +1264,11 @@ public class JmxExporterSpiTest extends 
AbstractExporterSpiTest {
         histogram.value(600);
         histogram.value(600);
     }
+
+    /** */
+    private IgniteEx prepareCluster(int nodeCnt) throws Exception {
+        startGrids(nodeCnt).cluster().state(ClusterState.ACTIVE);
+        
+        return grid(0);
+    }
 }
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
index 399502533ce..b86ad16bf38 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
@@ -2572,17 +2572,15 @@ public class SystemViewSelfTest extends 
GridCommonAbstractTest {
     /** */
     @Test
     public void testConfigurationView() throws Exception {
-        IgniteConfiguration icfg = new IgniteConfiguration();
-
         long expMaxSize = 10 * MB;
 
         String expName = "my-instance";
 
         String expDrName = "my-dr";
 
-        icfg.setIgniteInstanceName(expName)
-            .setIncludeEventTypes(EVT_CONSISTENCY_VIOLATION);
-        icfg.setDataStorageConfiguration(new DataStorageConfiguration()
+        IgniteConfiguration icfg = getConfiguration(expName)
+            .setIncludeEventTypes(EVT_CONSISTENCY_VIOLATION)
+            .setDataStorageConfiguration(new DataStorageConfiguration()
             .setDefaultDataRegionConfiguration(
                 new DataRegionConfiguration()
                     .setLazyMemoryAllocation(false))
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
index 43f3aa3c529..e357fe32360 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
@@ -45,8 +45,7 @@ public class CacheFutureExceptionSelfTest extends 
GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
-        return new IgniteConfiguration()
-            .setIgniteInstanceName(igniteInstanceName)
+        return super.getConfiguration(igniteInstanceName)
             .setFailureHandler(new StopNodeFailureHandler());
     }
 
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
index be6510c0086..8c7d4f92966 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
@@ -42,7 +42,6 @@ import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lifecycle.LifecycleAware;
 import org.apache.ignite.resources.CacheNameResource;
 import org.apache.ignite.resources.IgniteInstanceResource;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import 
org.apache.ignite.testframework.junits.common.GridAbstractLifecycleAwareSelfTest;
 import org.jetbrains.annotations.Nullable;
 import org.junit.Test;
@@ -269,8 +268,6 @@ public class GridCacheLifecycleAwareSelfTest extends 
GridAbstractLifecycleAwareS
     @Override protected final IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        cfg.setDiscoverySpi(new TcpDiscoverySpi());
-
         CacheConfiguration ccfg = defaultCacheConfiguration();
 
         ccfg.setCacheMode(PARTITIONED);
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteSequentialNodeCrashRecoveryTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteSequentialNodeCrashRecoveryTest.java
index 8c3785768c5..cf36782a8ed 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteSequentialNodeCrashRecoveryTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteSequentialNodeCrashRecoveryTest.java
@@ -65,7 +65,6 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.spi.discovery.DiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import 
org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
 import 
org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCustomEventMessage;
@@ -88,7 +87,7 @@ public class IgniteSequentialNodeCrashRecoveryTest extends 
GridCommonAbstractTes
     private FailureHandler failureHnd;
 
     /** */
-    private DiscoverySpi discoverySpi;
+    private TcpDiscoverySpi discoverySpi;
 
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
@@ -106,7 +105,7 @@ public class IgniteSequentialNodeCrashRecoveryTest extends 
GridCommonAbstractTes
             dsCfg.setFileIOFactory(fileIoFactory);
 
         if (discoverySpi != null)
-            cfg.setDiscoverySpi(discoverySpi);
+            
cfg.setDiscoverySpi(discoverySpi.setIpFinder(((TcpDiscoverySpi)cfg.getDiscoverySpi()).getIpFinder()));
 
         cfg
             .setDataStorageConfiguration(dsCfg)
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/filename/CustomCacheStorageConfigurationSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/filename/CustomCacheStorageConfigurationSelfTest.java
index d908e83c925..4cd44bdce47 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/filename/CustomCacheStorageConfigurationSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/filename/CustomCacheStorageConfigurationSelfTest.java
@@ -86,7 +86,7 @@ public class CustomCacheStorageConfigurationSelfTest extends 
GridCommonAbstractT
     public void testDuplicatesStoragePathThrows() {
         assertThrows(
             log,
-            () -> startGrid(new 
IgniteConfiguration().setDataStorageConfiguration(new DataStorageConfiguration()
+            () -> startGrid(getConfiguration().setDataStorageConfiguration(new 
DataStorageConfiguration()
                 .setStoragePath(myPath.getAbsolutePath())
                 .setExtraStoragePaths(myPath.getAbsolutePath()))),
             IgniteCheckedException.class,
@@ -95,7 +95,7 @@ public class CustomCacheStorageConfigurationSelfTest extends 
GridCommonAbstractT
 
         assertThrows(
             log,
-            () -> startGrid(new 
IgniteConfiguration().setDataStorageConfiguration(new DataStorageConfiguration()
+            () -> startGrid(getConfiguration().setDataStorageConfiguration(new 
DataStorageConfiguration()
                 .setStoragePath(myPath.getAbsolutePath())
                 .setExtraStoragePaths(myPath2.getAbsolutePath(), 
myPath.getAbsolutePath()))),
             IgniteCheckedException.class,
@@ -104,7 +104,7 @@ public class CustomCacheStorageConfigurationSelfTest 
extends GridCommonAbstractT
 
         assertThrows(
             log,
-            () -> startGrid(new 
IgniteConfiguration().setDataStorageConfiguration(new DataStorageConfiguration()
+            () -> startGrid(getConfiguration().setDataStorageConfiguration(new 
DataStorageConfiguration()
                 .setStoragePath(myPath.getAbsolutePath())
                 .setExtraStoragePaths(myPath2.getAbsolutePath(), 
myPath2.getAbsolutePath()))),
             IgniteCheckedException.class,
@@ -117,7 +117,7 @@ public class CustomCacheStorageConfigurationSelfTest 
extends GridCommonAbstractT
     public void testIncorrectSnapshotPathsThrows() {
         assertThrows(
             log,
-            () -> startGrid(new 
IgniteConfiguration().setDataStorageConfiguration(new DataStorageConfiguration()
+            () -> startGrid(getConfiguration().setDataStorageConfiguration(new 
DataStorageConfiguration()
                 .setStoragePath(myPath.getAbsolutePath())
                 .setExtraStoragePaths(myPath2.getAbsolutePath())
                 .setExtraSnapshotPaths("snppath1", "snppath2"))),
@@ -127,7 +127,7 @@ public class CustomCacheStorageConfigurationSelfTest 
extends GridCommonAbstractT
 
         assertThrows(
             log,
-            () -> startGrid(new 
IgniteConfiguration().setDataStorageConfiguration(new DataStorageConfiguration()
+            () -> startGrid(getConfiguration().setDataStorageConfiguration(new 
DataStorageConfiguration()
                 .setStoragePath(myPath.getAbsolutePath())
                 .setExtraSnapshotPaths("snppath1"))),
             IgniteCheckedException.class,
@@ -136,7 +136,7 @@ public class CustomCacheStorageConfigurationSelfTest 
extends GridCommonAbstractT
 
         assertThrows(
             log,
-            () -> startGrid(new 
IgniteConfiguration().setDataStorageConfiguration(new DataStorageConfiguration()
+            () -> startGrid(getConfiguration().setDataStorageConfiguration(new 
DataStorageConfiguration()
                 .setStoragePath(myPath.getAbsolutePath())
                 .setExtraSnapshotPaths("snppath1", "snppath2"))),
             IgniteCheckedException.class,
@@ -145,7 +145,7 @@ public class CustomCacheStorageConfigurationSelfTest 
extends GridCommonAbstractT
 
         assertThrows(
             log,
-            () -> startGrid(new 
IgniteConfiguration().setDataStorageConfiguration(new DataStorageConfiguration()
+            () -> startGrid(getConfiguration().setDataStorageConfiguration(new 
DataStorageConfiguration()
                 .setStoragePath(myPath.getAbsolutePath())
                 .setExtraStoragePaths(myPath2.getAbsolutePath(), 
myPath3.getAbsolutePath())
                 .setExtraSnapshotPaths("snppath1", "snppath1"))),
@@ -169,7 +169,7 @@ public class CustomCacheStorageConfigurationSelfTest 
extends GridCommonAbstractT
             );
         };
 
-        try (IgniteEx srv = startGrid(new 
IgniteConfiguration().setDataStorageConfiguration(new DataStorageConfiguration()
+        try (IgniteEx srv = 
startGrid(getConfiguration().setDataStorageConfiguration(new 
DataStorageConfiguration()
                 .setStoragePath(myPath.getAbsolutePath())
                 .setExtraStoragePaths(myPath2.getAbsolutePath())
                 .setDefaultDataRegionConfiguration(new 
DataRegionConfiguration().setPersistenceEnabled(true))))) {
@@ -177,7 +177,7 @@ public class CustomCacheStorageConfigurationSelfTest 
extends GridCommonAbstractT
             check.accept(srv);
         }
 
-        try (IgniteEx srv = startGrid(new 
IgniteConfiguration().setDataStorageConfiguration(new DataStorageConfiguration()
+        try (IgniteEx srv = 
startGrid(getConfiguration().setDataStorageConfiguration(new 
DataStorageConfiguration()
             .setExtraStoragePaths(myPath.getAbsolutePath(), 
myPath2.getAbsolutePath())
             .setDefaultDataRegionConfiguration(new 
DataRegionConfiguration().setPersistenceEnabled(true))))) {
             srv.cluster().state(ClusterState.ACTIVE);
@@ -284,7 +284,7 @@ public class CustomCacheStorageConfigurationSelfTest 
extends GridCommonAbstractT
             );
         };
 
-        try (IgniteEx srv = startGrid(new 
IgniteConfiguration().setDataStorageConfiguration(new DataStorageConfiguration()
+        try (IgniteEx srv = 
startGrid(getConfiguration().setDataStorageConfiguration(new 
DataStorageConfiguration()
             .setStoragePath(myPath.getAbsolutePath())
             .setExtraStoragePaths(myPath2.getAbsolutePath(), 
myPath3.getAbsolutePath())
             .setDefaultDataRegionConfiguration(new 
DataRegionConfiguration().setPersistenceEnabled(true))))) {
@@ -293,7 +293,7 @@ public class CustomCacheStorageConfigurationSelfTest 
extends GridCommonAbstractT
             check.accept(srv);
         }
 
-        try (IgniteEx srv = startGrid(new 
IgniteConfiguration().setDataStorageConfiguration(new DataStorageConfiguration()
+        try (IgniteEx srv = 
startGrid(getConfiguration().setDataStorageConfiguration(new 
DataStorageConfiguration()
             .setExtraStoragePaths(myPath.getAbsolutePath(), 
myPath2.getAbsolutePath(), myPath3.getAbsolutePath())
             .setDefaultDataRegionConfiguration(new 
DataRegionConfiguration().setPersistenceEnabled(true))))) {
             srv.cluster().state(ClusterState.ACTIVE);
@@ -310,7 +310,7 @@ public class CustomCacheStorageConfigurationSelfTest 
extends GridCommonAbstractT
             .setExtraStoragePaths(myPath2.getAbsolutePath(), 
myPath3.getAbsolutePath())
             .setDefaultDataRegionConfiguration(new 
DataRegionConfiguration().setPersistenceEnabled(true));
 
-        try (IgniteEx srv = startGrid(new 
IgniteConfiguration().setDataStorageConfiguration(dsCfg))) {
+        try (IgniteEx srv = 
startGrid(getConfiguration().setDataStorageConfiguration(dsCfg))) {
             srv.cluster().state(ClusterState.ACTIVE);
 
             srv.createCache(new CacheConfiguration<>("my-cache")
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotCheckTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotCheckTest.java
index 311cf3a79c7..93f175a15a0 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotCheckTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotCheckTest.java
@@ -1061,8 +1061,6 @@ public class IgniteClusterSnapshotCheckTest extends 
AbstractSnapshotSelfTest {
         for (int i = 0; i < servers + clients; ++i) {
             IgniteConfiguration cfg = 
getConfiguration(getTestIgniteInstanceName(i));
 
-            cfg.setDiscoverySpi(new BlockingCustomMessageDiscoverySpi());
-
             if (i >= servers)
                 cfg.setClientMode(true);
 
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/IgniteCacheDumpSelf2Test.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/IgniteCacheDumpSelf2Test.java
index dfe11664e85..6d133ec4926 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/IgniteCacheDumpSelf2Test.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/IgniteCacheDumpSelf2Test.java
@@ -532,7 +532,7 @@ public class IgniteCacheDumpSelf2Test extends 
GridCommonAbstractTest {
     /** */
     @Test
     public void testSnapshotDirectoryCreatedLazily() throws Exception {
-        try (IgniteEx ign = startGrid(new IgniteConfiguration())) {
+        try (IgniteEx ign = startGrid()) {
             NodeFileTree ft = ign.context().pdsFolderResolver().fileTree();
 
             assertFalse(ft.snapshotsRoot() + " must created lazily for 
in-memory node", ft.snapshotsRoot().exists());
@@ -545,7 +545,7 @@ public class IgniteCacheDumpSelf2Test extends 
GridCommonAbstractTest {
     /** */
     @Test
     public void testDumpFailIfNoCaches() throws Exception {
-        try (IgniteEx ign = startGrid(new IgniteConfiguration())) {
+        try (IgniteEx ign = startGrid()) {
             ign.cluster().state(ClusterState.ACTIVE);
 
             assertThrows(
@@ -596,7 +596,7 @@ public class IgniteCacheDumpSelf2Test extends 
GridCommonAbstractTest {
     /** */
     @Test
     public void testDumpIteratorFaileOnWrongCrc() throws Exception {
-        try (IgniteEx ign = startGrid(new IgniteConfiguration())) {
+        try (IgniteEx ign = startGrid()) {
             ign.cluster().state(ClusterState.ACTIVE);
 
             IgniteCache<Integer, Integer> cache = 
ign.createCache(DEFAULT_CACHE_NAME);
@@ -1104,7 +1104,7 @@ public class IgniteCacheDumpSelf2Test extends 
GridCommonAbstractTest {
     public void testReadEncrypted() throws Exception {
         File dumpDir;
 
-        try (IgniteEx srv = startGrid(new 
IgniteConfiguration().setEncryptionSpi(encryptionSpi()))) {
+        try (IgniteEx srv = 
startGrid(getConfiguration().setEncryptionSpi(encryptionSpi()))) {
             IgniteCache<Integer, byte[]> cache = 
srv.createCache(DEFAULT_CACHE_NAME);
             IntStream.range(0, KEYS_CNT).forEach(i -> {
                 byte[] data = new byte[Math.max(Integer.BYTES, 
ThreadLocalRandom.current().nextInt((int)U.KB))];
diff --git 
a/modules/core/src/test/java/org/apache/ignite/services/ServiceThreadPoolSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/services/ServiceThreadPoolSelfTest.java
index 41ff4bfb353..2aeace0f511 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/services/ServiceThreadPoolSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/services/ServiceThreadPoolSelfTest.java
@@ -36,7 +36,7 @@ public class ServiceThreadPoolSelfTest extends 
GridCommonAbstractTest {
      */
     @Test
     public void testDefaultPoolSize() throws Exception {
-        Ignite ignite = startGrid("grid", new IgniteConfiguration());
+        Ignite ignite = startGrid("grid");
 
         IgniteConfiguration cfg = ignite.configuration();
 
@@ -49,7 +49,7 @@ public class ServiceThreadPoolSelfTest extends 
GridCommonAbstractTest {
      */
     @Test
     public void testInheritedPoolSize() throws Exception {
-        Ignite ignite = startGrid("grid", new 
IgniteConfiguration().setPublicThreadPoolSize(42));
+        Ignite ignite = 
startGrid(getConfiguration("grid").setPublicThreadPoolSize(42));
 
         IgniteConfiguration cfg = ignite.configuration();
 
@@ -62,7 +62,7 @@ public class ServiceThreadPoolSelfTest extends 
GridCommonAbstractTest {
      */
     @Test
     public void testCustomPoolSize() throws Exception {
-        Ignite ignite = startGrid("grid", new 
IgniteConfiguration().setServiceThreadPoolSize(42));
+        Ignite ignite = 
startGrid(getConfiguration("grid").setServiceThreadPoolSize(42));
 
         IgniteConfiguration cfg = ignite.configuration();
 
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryTypeRegistrationTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryTypeRegistrationTest.java
index b8ff43e48a9..34e27cecb70 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryTypeRegistrationTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryTypeRegistrationTest.java
@@ -47,14 +47,16 @@ public class BinaryTypeRegistrationTest extends 
GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        cfg.setDiscoverySpi(new TcpDiscoverySpi() {
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi() {
             @Override public void sendCustomEvent(DiscoveryCustomMessage msg) 
throws IgniteException {
                 if (U.unwrapCustomMessage(msg) instanceof 
MetadataUpdateProposedMessage)
                     
metadataUpdateProposedMessages.add(U.unwrapCustomMessage(msg));
 
                 super.sendCustomEvent(msg);
             }
-        });
+        };
+
+        
cfg.setDiscoverySpi(discoSpi.setIpFinder(((TcpDiscoverySpi)cfg.getDiscoverySpi()).getIpFinder()));
 
         return cfg;
     }
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/metric/SqlViewExporterSpiTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/metric/SqlViewExporterSpiTest.java
index d0dfb220030..a6a2ef70686 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/metric/SqlViewExporterSpiTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/metric/SqlViewExporterSpiTest.java
@@ -387,8 +387,11 @@ public class SqlViewExporterSpiTest extends 
AbstractExporterSpiTest {
     /** */
     @Test
     public void testSchemas() throws Exception {
-        try (IgniteEx g = startGrid(new 
IgniteConfiguration().setSqlConfiguration(new SqlConfiguration()
-                .setSqlSchemas("MY_SCHEMA", "ANOTHER_SCHEMA")))) {
+        try (
+            IgniteEx g = startGrid(getConfiguration()
+                .setSqlConfiguration(new SqlConfiguration()
+                    .setSqlSchemas("MY_SCHEMA", "ANOTHER_SCHEMA")))
+        ) {
             SystemView<SqlSchemaView> schemasSysView = 
g.context().systemView().view(SQL_SCHEMA_VIEW);
 
             Set<String> schemaFromSysView = new HashSet<>();
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlCreateTableTemplateTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlCreateTableTemplateTest.java
index 6f8ef9920d5..fc70732a1b2 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlCreateTableTemplateTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlCreateTableTemplateTest.java
@@ -33,8 +33,7 @@ import org.junit.Test;
 public class IgniteSqlCreateTableTemplateTest extends 
AbstractIndexingCommonTest {
     /** {@inheritDoc} */
     @Override public IgniteConfiguration getConfiguration(String name) throws 
Exception {
-        IgniteConfiguration configuration = new IgniteConfiguration();
-        configuration.setIgniteInstanceName(name);
+        IgniteConfiguration configuration = super.getConfiguration(name);
 
         CacheConfiguration dfltCacheConfiguration = new CacheConfiguration();
 
@@ -54,7 +53,6 @@ public class IgniteSqlCreateTableTemplateTest extends 
AbstractIndexingCommonTest
     }
 
     /** {@inheritDoc} */
-    @SuppressWarnings("deprecation")
     @Override protected void beforeTestsStarted() throws Exception {
         startGrid();
     }
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/RunningQueriesTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/RunningQueriesTest.java
index cd32445ca76..3a4165eb466 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/RunningQueriesTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/RunningQueriesTest.java
@@ -165,8 +165,7 @@ public class RunningQueriesTest extends 
AbstractIndexingCommonTest {
     @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        cfg.setDiscoverySpi(new TcpDiscoverySpi() {
-
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi() {
             @Override public void sendCustomEvent(DiscoveryCustomMessage msg) 
throws IgniteException {
                 DiscoveryCustomMessage delegate = U.unwrapCustomMessage(msg);
 
@@ -194,7 +193,9 @@ public class RunningQueriesTest extends 
AbstractIndexingCommonTest {
 
                 super.sendCustomEvent(msg);
             }
-        });
+        };
+
+        
cfg.setDiscoverySpi(discoSpi.setIpFinder(((TcpDiscoverySpi)cfg.getDiscoverySpi()).getIpFinder()));
 
         cfg.setCommunicationSpi(new TcpCommunicationSpi() {
             /** {@inheritDoc} */
@@ -227,23 +228,23 @@ public class RunningQueriesTest extends 
AbstractIndexingCommonTest {
      */
     @Test
     public void testCloseRunningQueriesOnNodeStop() throws Exception {
-        IgniteEx ign = startGrid(super.getConfiguration("TST"));
-
-        IgniteCache<Integer, Integer> cache = ign.getOrCreateCache(new 
CacheConfiguration<Integer, Integer>()
-            .setName("TST")
-            .setQueryEntities(Collections.singletonList(new 
QueryEntity(Integer.class, Integer.class)))
-        );
+        IgniteEx ign = startGrid(getConfiguration("TST"));
 
-        for (int i = 0; i < 10000; i++)
-            cache.put(i, i);
+        try (ign) {
+            IgniteCache<Integer, Integer> cache = ign.getOrCreateCache(new 
CacheConfiguration<Integer, Integer>()
+                .setName("TST")
+                .setQueryEntities(Collections.singletonList(new 
QueryEntity(Integer.class, Integer.class)))
+            );
 
-        cache.query(new SqlFieldsQuery("SELECT * FROM Integer order by _key"));
+            for (int i = 0; i < 10000; i++)
+                cache.put(i, i);
 
-        Assert.assertEquals("Should be one running query",
-            1,
-            ign.context().query().runningQueries(-1).size());
+            cache.query(new SqlFieldsQuery("SELECT * FROM Integer order by 
_key"));
 
-        ign.close();
+            Assert.assertEquals("Should be one running query",
+                1,
+                ign.context().query().runningQueries(-1).size());
+        }
 
         Assert.assertEquals(0, 
ign.context().query().runningQueries(-1).size());
     }
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
index b4c852c5ec7..593e6b4a2ee 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
@@ -1157,9 +1157,14 @@ public class SqlSystemViewsSelfTest extends 
AbstractIndexingCommonTest {
 
         assertEquals(testSnapname0, res.get(0).get(0));
 
-        String expCacheGrps = F.concat(asList(DEFAULT_CACHE_NAME, testCache, 
METASTORAGE_CACHE_NAME), ",");
+        Set<String> expCacheGrps = Set.of(DEFAULT_CACHE_NAME, testCache, 
METASTORAGE_CACHE_NAME);
 
-        assertEquals(expCacheGrps, res.get(0).get(1));
+        String cacheGrpRes = (String)res.get(0).get(1);
+
+        Set<String> cacheGrps = 
Arrays.stream(cacheGrpRes.split(",")).map(String::trim).collect(toSet());
+
+        assertEquals(expCacheGrps.size(), cacheGrps.size());
+        assertTrue(expCacheGrps.containsAll(cacheGrps));
     }
 
     /** {@inheritDoc} */
@@ -1753,24 +1758,20 @@ public class SqlSystemViewsSelfTest extends 
AbstractIndexingCommonTest {
     /** */
     @Test
     public void testConfigurationView() throws Exception {
-        IgniteConfiguration icfg = new IgniteConfiguration();
-
         long expMaxSize = 10 * MB;
 
         String expName = "my-instance";
 
         String expDrName = "my-dr";
 
-        icfg.setIgniteInstanceName(expName)
-            .setIncludeEventTypes(EVT_CONSISTENCY_VIOLATION);
-        icfg.setDataStorageConfiguration(new DataStorageConfiguration()
-            .setDefaultDataRegionConfiguration(
-                new DataRegionConfiguration()
-                    .setLazyMemoryAllocation(false))
-            .setDataRegionConfigurations(
-                new DataRegionConfiguration()
-                    .setName(expDrName)
-                    .setMaxSize(expMaxSize)));
+        IgniteConfiguration icfg = getConfiguration(expName)
+            .setIncludeEventTypes(EVT_CONSISTENCY_VIOLATION)
+            .setDataStorageConfiguration(new DataStorageConfiguration()
+            .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+                .setLazyMemoryAllocation(false))
+            .setDataRegionConfigurations(new DataRegionConfiguration()
+                .setName(expDrName)
+                .setMaxSize(expMaxSize)));
 
         try (IgniteEx srv = startGrid(icfg)) {
             srv.createCache(DEFAULT_CACHE_NAME);

Reply via email to