From 3f89676d399fd427293c13d73980526af6d3b8d6 Mon Sep 17 00:00:00 2001 From: Mikhail Petrov Date: Wed, 4 Mar 2026 11:19:57 +0300 Subject: [PATCH 1/3] IGNITE-28055 Removed unexpected usages of Multicast IP Finder in tests. --- .../client/thin/ServiceAwarenessTest.java | 6 +- .../internal/metric/JmxExporterSpiTest.java | 245 +++++++++--------- .../internal/metric/SystemViewSelfTest.java | 8 +- .../GridCacheLifecycleAwareSelfTest.java | 3 - ...IgniteSequentialNodeCrashRecoveryTest.java | 5 +- .../IgniteClusterSnapshotCheckTest.java | 2 - .../dump/IgniteCacheDumpSelf2Test.java | 8 +- .../services/ServiceThreadPoolSelfTest.java | 6 +- .../cache/BinaryTypeRegistrationTest.java | 6 +- .../cache/metric/SqlViewExporterSpiTest.java | 7 +- .../processors/query/RunningQueriesTest.java | 7 +- 11 files changed, 149 insertions(+), 154 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 77ae572bd0e1c..5943b5e2c7210 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 44452ca3209d5..5f3c920703601 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.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.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.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.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 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 void testJmxMetricsExporterIsNotEnabledByDefault() throws Exception { 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 void testJmxMetricsExporterIsNotEnabledByDefault() throws Exception { /** */ @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 res = stream(sysMBean.getMBeanInfo().getAttributes()) @@ -277,6 +243,8 @@ public void testSysJmxMetrics() throws Exception { /** */ @Test public void testDataRegionJmxMetrics() throws Exception { + IgniteEx ignite = prepareCluster(1); + DynamicMBean dataRegionMBean = metricRegistry(ignite.name(), "io", "dataregion.default"); Set res = stream(dataRegionMBean.getMBeanInfo().getAttributes()) @@ -298,6 +266,8 @@ public void testDataRegionJmxMetrics() throws Exception { /** */ @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 void testUnregisterRemovedRegistry() throws Exception { /** */ @Test public void testFilterAndExport() throws Exception { + IgniteEx ignite = prepareCluster(1); + createAdditionalMetrics(ignite); assertThrowsWithCause(new Runnable() { @@ -334,7 +306,9 @@ public void testFilterAndExport() throws Exception { /** */ @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 void testRemoveFilteredRegistry() { /** */ @Test public void testCachesView() throws Exception { + IgniteEx ignite = prepareCluster(1); + Set cacheNames = new HashSet<>(Arrays.asList("cache-1", "cache-2")); for (String name : cacheNames) @@ -376,6 +352,8 @@ public void testCachesView() throws Exception { /** */ @Test public void testCacheGroupsView() throws Exception { + IgniteEx ignite = prepareCluster(1); + Set grpNames = new HashSet<>(Arrays.asList("grp-1", "grp-2")); for (String grpName : grpNames) @@ -397,6 +375,8 @@ public void testCacheGroupsView() throws Exception { /** */ @Test public void testServices() throws Exception { + IgniteEx ignite = prepareCluster(1); + ServiceConfiguration srvcCfg = new ServiceConfiguration(); srvcCfg.setName("service"); @@ -420,6 +400,8 @@ public void testServices() throws Exception { /** */ @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 void testComputeBroadcast() throws Exception { /** */ @Test public void testClientsConnections() throws Exception { + IgniteEx ignite = prepareCluster(1); + String host = ignite.configuration().getClientConnectorConfiguration().getHost(); if (host == null) @@ -503,31 +487,32 @@ public void testClientsConnections() throws Exception { /** */ @Test public void testContinuousQuery() throws Exception { - try (IgniteEx remoteNode = startGrid(1)) { - IgniteCache 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 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 @@ private void checkContinuousQueryView(IgniteEx origNode, IgniteEx checkNode) { /** */ public TabularDataSupport systemView(String name) { - return systemView(ignite, name); + return systemView(grid(0), name); } /** */ @@ -607,6 +592,8 @@ public TabularDataSupport filteredSystemView(IgniteEx g, String name, Map null, name -> null, name -> null, null); createTestHistogram(mreg); @@ -642,6 +629,8 @@ public void testHistogramSearchByName() throws Exception { /** */ @Test public void testHistogramExport() throws Exception { + IgniteEx ignite = prepareCluster(1); + MetricRegistryImpl mreg = ignite.context().metric().registry("histogramTest"); createTestHistogram(mreg); @@ -664,6 +653,8 @@ public void testHistogramExport() throws Exception { /** */ @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 void testJmxHistogramNamesExport() throws Exception { /** */ @Test public void testTransactions() throws Exception { + IgniteEx ignite = prepareCluster(1); + IgniteCache cache = ignite.createCache(new CacheConfiguration("c") .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)); @@ -718,7 +711,7 @@ public void testTransactions() throws Exception { 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 void testTransactions() throws Exception { 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 void testTransactions() throws Exception { /** */ @Test public void testLocalScanQuery() throws Exception { + IgniteEx ignite = prepareCluster(1); + IgniteCache cache1 = ignite.createCache( new CacheConfiguration("cache1") .setGroupName("group1")); @@ -847,6 +842,8 @@ public void testLocalScanQuery() throws Exception { /** */ @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 void testScanQuery() throws Exception { /** @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 @@ private void checkScanQueryView(IgniteEx client1, IgniteEx client2, IgniteEx ser /** */ @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 void testSysStripedExecutor() throws Exception { /** */ @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 @@ private void checkStripeExecutorView(IgniteStripedExecutor execSvc, String viewN /** */ @Test public void testPagesList() throws Exception { + IgniteEx ignite = prepareCluster(1); + String cacheName = "cacheFL"; IgniteCache cache = ignite.getOrCreateCache(new CacheConfiguration() @@ -1145,7 +1125,9 @@ CachePagesListViewWalker.CACHE_GROUP_ID_FILTER, cacheId(cacheName), /** */ @Test - public void testBinaryMeta() { + public void testBinaryMeta() throws Exception { + IgniteEx ignite = prepareCluster(1); + IgniteCache c1 = ignite.createCache("test-all-types-cache"); IgniteCache c2 = ignite.createCache("test-enum-cache"); @@ -1181,6 +1163,8 @@ public void testBinaryMeta() { /** */ @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 @@ else if (row.get("name").equals(unmarshalledName) && row.get("value").equals(unm /** */ @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 @@ private void createTestHistogram(MetricRegistryImpl mreg) { 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 399502533ce0f..b86ad16bf38e2 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 void testPagesTimestampHistogramAfterPartitionEviction() throws Exception /** */ @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/GridCacheLifecycleAwareSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java index be6510c00861d..8c7d4f92966b2 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.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 TestTopologyValidator() { @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 8c3785768c5cf..cf36782a8ed90 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.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/snapshot/IgniteClusterSnapshotCheckTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotCheckTest.java index 311cf3a79c7a3..93f175a15a060 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 @@ private void prepareGridsAndSnapshot(int servers, int baseLineCnt, int clients, 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 dfe11664e853b..6d133ec4926d1 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 @@ private void doTestDumpAfterRestart(boolean useDataStreamer, boolean dataCustomL /** */ @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 void testSnapshotDirectoryCreatedLazily() throws Exception { /** */ @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 void testUnreadyDumpCleared() throws Exception { /** */ @Test public void testDumpIteratorFaileOnWrongCrc() throws Exception { - try (IgniteEx ign = startGrid(new IgniteConfiguration())) { + try (IgniteEx ign = startGrid()) { ign.cluster().state(ClusterState.ACTIVE); IgniteCache cache = ign.createCache(DEFAULT_CACHE_NAME); @@ -1104,7 +1104,7 @@ public void testCreateEncryptedFail() throws Exception { public void testReadEncrypted() throws Exception { File dumpDir; - try (IgniteEx srv = startGrid(new IgniteConfiguration().setEncryptionSpi(encryptionSpi()))) { + try (IgniteEx srv = startGrid(getConfiguration().setEncryptionSpi(encryptionSpi()))) { IgniteCache 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 41ff4bfb353e4..2aeace0f511e8 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 void testDefaultPoolSize() throws Exception { */ @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 void testInheritedPoolSize() throws Exception { */ @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 b8ff43e48a99c..34e27cecb7066 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 d0dfb2200309e..a6a2ef70686ec 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 void testTransactions() throws Exception { /** */ @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 schemasSysView = g.context().systemView().view(SQL_SCHEMA_VIEW); Set schemaFromSysView = new HashSet<>(); 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 cd32445ca7602..35dc93a27e462 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 @@ else if (SchemaProposeDiscoveryMessage.class.isAssignableFrom(delegate.getClass( super.sendCustomEvent(msg); } - }); + }; + + cfg.setDiscoverySpi(discoSpi.setIpFinder(((TcpDiscoverySpi)cfg.getDiscoverySpi()).getIpFinder())); cfg.setCommunicationSpi(new TcpCommunicationSpi() { /** {@inheritDoc} */ From 736e952e49ecb87eb155b864c094ba7a0a3b60fe Mon Sep 17 00:00:00 2001 From: Mikhail Petrov Date: Tue, 3 Mar 2026 00:11:49 +0300 Subject: [PATCH 2/3] IGNITE-28055 Removed unexpected usages of Multicast IP Finder in tests. --- .../cache/CacheFutureExceptionSelfTest.java | 3 +- ...stomCacheStorageConfigurationSelfTest.java | 24 +++++++-------- .../IgniteSqlCreateTableTemplateTest.java | 4 +-- .../query/SqlSystemViewsSelfTest.java | 29 ++++++++++--------- 4 files changed, 29 insertions(+), 31 deletions(-) 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 43f3aa3c52985..e357fe32360a4 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/persistence/filename/CustomCacheStorageConfigurationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/filename/CustomCacheStorageConfigurationSelfTest.java index d908e83c925a7..4cd44bdce479f 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 void testDuplicatesStoragePathThrows() { 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 void testDuplicatesStoragePathThrows() { 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 void testDuplicatesStoragePathThrows() { 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 void testIncorrectSnapshotPathsThrows() { 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 void testIncorrectSnapshotPathsThrows() { 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 void testIncorrectSnapshotPathsThrows() { 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 void testCacheUnknownStoragePathThrows() throws Exception { ); }; - 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 void testCacheUnknownStoragePathThrows() throws Exception { 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 void testDifferentStoragePathForGroupThrows() throws Exception { ); }; - 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 void testDifferentStoragePathForGroupThrows() throws Exception { 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 void testCreateCaches() throws Exception { .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/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 6f8ef9920d588..fc70732a1b228 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 @@ 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/SqlSystemViewsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java index b4c852c5ec74d..593e6b4a2ee85 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 void testSnapshotViews() throws Exception { assertEquals(testSnapname0, res.get(0).get(0)); - String expCacheGrps = F.concat(asList(DEFAULT_CACHE_NAME, testCache, METASTORAGE_CACHE_NAME), ","); + Set 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 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 void testDurationMetricsCanBeLonger24Hours() throws Exception { /** */ @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); From b670fe8a8a3e4666f8a2f799ae00afb8b072eba0 Mon Sep 17 00:00:00 2001 From: Mikhail Petrov Date: Fri, 6 Mar 2026 11:41:59 +0300 Subject: [PATCH 3/3] IGNITE-28055 Fixed RunningQueriesTest --- .../processors/query/RunningQueriesTest.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) 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 35dc93a27e462..3a4165eb46622 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 @@ -228,23 +228,23 @@ else if (SchemaProposeDiscoveryMessage.class.isAssignableFrom(delegate.getClass( */ @Test public void testCloseRunningQueriesOnNodeStop() throws Exception { - IgniteEx ign = startGrid(super.getConfiguration("TST")); + IgniteEx ign = startGrid(getConfiguration("TST")); - IgniteCache cache = ign.getOrCreateCache(new CacheConfiguration() - .setName("TST") - .setQueryEntities(Collections.singletonList(new QueryEntity(Integer.class, Integer.class))) - ); - - for (int i = 0; i < 10000; i++) - cache.put(i, i); + try (ign) { + IgniteCache cache = ign.getOrCreateCache(new CacheConfiguration() + .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()); }