From 826bfa6fae46c379d62d0eaa10ff797d3c05fa1d Mon Sep 17 00:00:00 2001 From: Nikolay Date: Mon, 16 Dec 2024 12:51:01 +0300 Subject: [PATCH] IGNITE-23993 Remove setForceServerMode from GridCacheAbstractRemoveFailureTest (#11742) --- .../GridCacheAbstractRemoveFailureTest.java | 20 +++++++++++-------- ...nedClientOnlyNoPrimaryFullApiSelfTest.java | 2 -- ...ngBaselineDownCacheRemoveFailoverTest.java | 2 +- ...gingBaselineUpCacheRemoveFailoverTest.java | 2 ++ ...StableBaselineCacheRemoveFailoverTest.java | 5 ++++- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java index 03d77a537c968..d19b3c742794a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java @@ -47,7 +47,6 @@ import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; -import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; @@ -70,6 +69,9 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstr /** */ private static final int GRID_CNT = 3; + /** */ + public static final int CLI_IDX = 42; + /** Keys count. */ private static final int KEYS_CNT = 10_000; @@ -92,10 +94,7 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstr @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true); - - if (testClientNode() && getTestIgniteInstanceName(0).equals(igniteInstanceName)) - cfg.setClientMode(true); + cfg.setClientMode(testClientNode() && getTestIgniteInstanceName(CLI_IDX).equals(igniteInstanceName)); ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1); @@ -110,6 +109,11 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstr System.setProperty(IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE, "100000"); startGrids(GRID_CNT); + + if (testClientNode()) + startClientGrid(CLI_IDX); + else + startGrid(CLI_IDX); } /** {@inheritDoc} */ @@ -188,9 +192,9 @@ protected long duration() { private void putAndRemove(long duration, final TransactionConcurrency txConcurrency, final TransactionIsolation txIsolation) throws Exception { - assertEquals(testClientNode(), (boolean)grid(0).configuration().isClientMode()); + assertEquals(testClientNode(), (boolean)grid(CLI_IDX).configuration().isClientMode()); - grid(0).destroyCache(DEFAULT_CACHE_NAME); + grid(CLI_IDX).destroyCache(DEFAULT_CACHE_NAME); CacheConfiguration ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); @@ -204,7 +208,7 @@ private void putAndRemove(long duration, ccfg.setAtomicityMode(atomicityMode()); ccfg.setNearConfiguration(nearCache()); - final IgniteCache sndCache0 = grid(0).createCache(ccfg); + final IgniteCache sndCache0 = grid(CLI_IDX).createCache(ccfg); final AtomicBoolean stop = new AtomicBoolean(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedClientOnlyNoPrimaryFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedClientOnlyNoPrimaryFullApiSelfTest.java index ca6a64f3c0e0c..9cd11846d6948 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedClientOnlyNoPrimaryFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedClientOnlyNoPrimaryFullApiSelfTest.java @@ -25,7 +25,6 @@ import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException; import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.lang.IgniteClosure; -import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.junit.Test; /** @@ -41,7 +40,6 @@ public class GridCachePartitionedClientOnlyNoPrimaryFullApiSelfTest extends Grid @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true); cfg.setClientMode(true); return cfg; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/IgniteChangingBaselineDownCacheRemoveFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/IgniteChangingBaselineDownCacheRemoveFailoverTest.java index 90053e831f4d3..325e9d2a1cec5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/IgniteChangingBaselineDownCacheRemoveFailoverTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/IgniteChangingBaselineDownCacheRemoveFailoverTest.java @@ -92,7 +92,7 @@ public class IgniteChangingBaselineDownCacheRemoveFailoverTest extends GridCache startGrids(GRIDS_COUNT); - startGrid(GRIDS_COUNT); + startGrid(CLI_IDX); grid(0).cluster().baselineAutoAdjustEnabled(false); grid(0).cluster().state(ClusterState.ACTIVE); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/IgniteChangingBaselineUpCacheRemoveFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/IgniteChangingBaselineUpCacheRemoveFailoverTest.java index 2b7833d9c75f2..9e0f4aa46f185 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/IgniteChangingBaselineUpCacheRemoveFailoverTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/IgniteChangingBaselineUpCacheRemoveFailoverTest.java @@ -92,6 +92,8 @@ public class IgniteChangingBaselineUpCacheRemoveFailoverTest extends GridCacheAb startGrids(GRIDS_COUNT); + startGrid(CLI_IDX); + grid(0).cluster().state(ClusterState.ACTIVE); awaitPartitionMapExchange(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/IgniteStableBaselineCacheRemoveFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/IgniteStableBaselineCacheRemoveFailoverTest.java index f55c0b6a1a652..79b2b939b155c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/IgniteStableBaselineCacheRemoveFailoverTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/IgniteStableBaselineCacheRemoveFailoverTest.java @@ -88,7 +88,10 @@ public class IgniteStableBaselineCacheRemoveFailoverTest extends GridCacheAbstra startGrids(GRIDS_COUNT); - grid(0).cluster().state(ClusterState.ACTIVE); + if (testClientNode()) + startClientGrid(CLI_IDX); + + grid(CLI_IDX).cluster().state(ClusterState.ACTIVE); startGrid(OUT_OF_BASELINE_GRID_ID);