Skip to content

Commit

Permalink
IGNITE-23993 Remove setForceServerMode from GridCacheAbstractRemoveFa…
Browse files Browse the repository at this point in the history
…ilureTest (#11742)
  • Loading branch information
nizhikov authored Dec 16, 2024
1 parent c1f6dc4 commit 826bfa6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -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);

Expand All @@ -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} */
Expand Down Expand Up @@ -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<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

Expand All @@ -204,7 +208,7 @@ private void putAndRemove(long duration,
ccfg.setAtomicityMode(atomicityMode());
ccfg.setNearConfiguration(nearCache());

final IgniteCache<Integer, Integer> sndCache0 = grid(0).createCache(ccfg);
final IgniteCache<Integer, Integer> sndCache0 = grid(CLI_IDX).createCache(ccfg);

final AtomicBoolean stop = new AtomicBoolean();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public class IgniteChangingBaselineUpCacheRemoveFailoverTest extends GridCacheAb

startGrids(GRIDS_COUNT);

startGrid(CLI_IDX);

grid(0).cluster().state(ClusterState.ACTIVE);

awaitPartitionMapExchange();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 826bfa6

Please sign in to comment.