Skip to content

Commit

Permalink
IGNITE-23922 Remove setForceServerMode from simple core tests (#11720)
Browse files Browse the repository at this point in the history
  • Loading branch information
nizhikov authored Dec 10, 2024
1 parent 7472af6 commit 7cde4f4
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 189 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.managers.GridManagerAdapter;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.ListeningTestLogger;
import org.apache.ignite.testframework.LogListener;
Expand Down Expand Up @@ -63,9 +62,6 @@ public class IgniteTopologyPrintFormatSelfTest extends GridCommonAbstractTest {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName)
.setGridLogger(testLog);

if (igniteInstanceName.endsWith("client_force_server"))
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);

return cfg;
}

Expand Down Expand Up @@ -291,9 +287,9 @@ private void doForceServerAndClientTest() throws Exception {
Ignite srv1 = startGrid("server1");
Ignite client1 = startClientGrid("first client");
Ignite client2 = startClientGrid("second client");
Ignite forceServClnt3 = startClientGrid("third client_force_server");
Ignite client3 = startClientGrid("third client");

waitForDiscovery(srv, srv1, client1, client2, forceServClnt3);
waitForDiscovery(srv, srv1, client1, client2, client3);
}
finally {
stopAllGrids();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;

Expand All @@ -52,8 +51,6 @@ public class CacheAtomicSingleMessageCountSelfTest extends GridCommonAbstractTes
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);

CacheConfiguration cCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

cCfg.setCacheMode(PARTITIONED);
Expand All @@ -75,8 +72,8 @@ public class CacheAtomicSingleMessageCountSelfTest extends GridCommonAbstractTes
*/
@Test
public void testSingleMessage() throws Exception {
startClientGrid(0);
startGrid(1);
startClientGrid(0);

awaitPartitionMapExchange();

Expand Down Expand Up @@ -104,8 +101,8 @@ public void testSingleMessage() throws Exception {
*/
@Test
public void testSingleTransformMessage() throws Exception {
startClientGrid(0);
startGrid(1);
startClientGrid(0);

int cacheId = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME).context().cacheId();

Expand Down Expand Up @@ -143,8 +140,8 @@ public void testSingleTransformMessage() throws Exception {
*/
@Test
public void testSingleFilterMessage() throws Exception {
startClientGrid(0);
startGrid(1);
startClientGrid(0);

awaitPartitionMapExchange();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.IgniteSpiException;
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.junit.Test;
Expand Down Expand Up @@ -95,8 +94,6 @@ protected int gridCount() {
iCfg.setDataStorageConfiguration(memCfg);
}

((TcpDiscoverySpi)iCfg.getDiscoverySpi()).setForceServerMode(true);

iCfg.setCacheConfiguration();

TcpCommunicationSpi commSpi = new CountingTxRequestsToClientNodeTcpCommunicationSpi();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.lang.IgniteCallable;
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 @@ -52,8 +51,6 @@ public class GridCacheMixedPartitionExchangeSelfTest extends GridCommonAbstractT
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);

if (cache)
cfg.setCacheConfiguration(cacheConfiguration());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ public void checkPutAllFailover(boolean near, int workerCnt, int shutdownCnt) th

Collection<Integer> testKeys = generateTestKeys();

final Ignite master = startClientGrid(MASTER);

List<Ignite> workers = new ArrayList<>(workerCnt);

for (int i = 1; i <= workerCnt; i++)
workers.add(startGrid("worker" + i));

final Ignite master = startClientGrid(MASTER);

info("Master: " + master.cluster().localNode().id());

List<Ignite> runningWorkers = new ArrayList<>(workerCnt);
Expand Down Expand Up @@ -430,13 +430,13 @@ public void checkPutAllFailoverColocated(boolean near, int workerCnt, int shutdo

Collection<Integer> testKeys = generateTestKeys();

final Ignite master = startClientGrid(MASTER);

List<Ignite> workers = new ArrayList<>(workerCnt);

for (int i = 1; i <= workerCnt; i++)
workers.add(startGrid("worker" + i));

final Ignite master = startClientGrid(MASTER);

info("Master: " + master.cluster().localNode().id());

List<Ignite> runningWorkers = new ArrayList<>(workerCnt);
Expand Down Expand Up @@ -667,7 +667,6 @@ protected CacheAtomicityMode atomicityMode() {
TcpDiscoverySpi discoverySpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();

discoverySpi.setAckTimeout(60000);
discoverySpi.setForceServerMode(true);

cfg.setDiscoverySpi(discoverySpi);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
Expand All @@ -57,8 +56,6 @@ public class IgniteCacheConfigurationTemplateTest extends GridCommonAbstractTest
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);

if (addTemplate) {
CacheConfiguration dfltCfg = new CacheConfiguration("*");

Expand Down Expand Up @@ -221,31 +218,6 @@ public void testGetOrCreateFromTemplate() throws Exception {
checkGetOrCreate(ignite3, "org.apache.ignite", 6);
}

/**
* @throws Exception If failed.
*/
@Test
public void testStartClientNodeFirst() throws Exception {
addTemplate = true;

Ignite ignite0 = startClientGrid(0);

checkNoTemplateCaches(0);

addTemplate = false;

Ignite ignite1 = startGrid(1);

checkGetOrCreate(ignite1, "org.apache.ignite.test.cache1", 4);
checkGetOrCreate(ignite1, "org.apache.ignite.test.cache1", 4);

checkGetOrCreate(ignite1, "org.apache.ignite1", 3);
checkGetOrCreate(ignite1, "org.apache.ignite1", 3);

checkGetOrCreate(ignite0, "org.apache.ignite1", 3);
checkGetOrCreate(ignite0, "org.apache.ignite1", 3);
}

/**
* @throws Exception If failed.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.junit.Test;
Expand All @@ -50,8 +49,6 @@ public class IgniteCacheNearLockValueSelfTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);

TestRecordingCommunicationSpi commSpi = new TestRecordingCommunicationSpi();

commSpi.record(GridNearLockRequest.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
Expand Down Expand Up @@ -102,9 +101,6 @@ public int nodeCount() {
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

if (cfg.isClientMode())
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);

cfg.setUserAttributes(F.asMap(TEST_ATTRIBUTE_NAME, testAttribute));

CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
Expand All @@ -54,8 +53,6 @@ public class GridCacheClientNodeBinaryObjectMetadataMultinodeTest extends GridCo

cfg.setPeerClassLoadingEnabled(false);

((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);

cfg.setMarshaller(new BinaryMarshaller());

CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
Expand Down Expand Up @@ -257,15 +254,15 @@ public void testFailoverOnStart() throws Exception {
* @throws Exception If failed.
*/
@Test
public void testClientStartsFirst() throws Exception {
final Ignite ignite0 = startClientGrid(0);

assertTrue(ignite0.configuration().isClientMode());

public void testClient() throws Exception {
Ignite ignite1 = startGrid(1);

assertFalse(ignite1.configuration().isClientMode());

final Ignite ignite0 = startClientGrid(0);

assertTrue(ignite0.configuration().isClientMode());

IgniteBinary binaries = ignite(1).binary();

IgniteCache<Object, Object> cache = ignite(1).cache(DEFAULT_CACHE_NAME).withKeepBinary();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.junit.Test;

import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
Expand Down Expand Up @@ -87,8 +86,6 @@ public class GridCacheClientNodeBinaryObjectMetadataTest extends GridCacheAbstra

cfg.setMarshaller(marsh);

((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);

return cfg;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;

Expand All @@ -35,8 +34,6 @@ public class GridCacheMixedModeSelfTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);

cfg.setCacheConfiguration(cacheConfiguration(igniteInstanceName));

return cfg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.CacheServerNotFoundException;
import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
Expand All @@ -52,7 +52,6 @@
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.resources.LoggerResource;
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.junit.Test;
Expand All @@ -67,8 +66,6 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);

CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

cfg.setCacheConfiguration(ccfg);
Expand Down Expand Up @@ -104,35 +101,23 @@ public void testServerNodeLeave() throws Exception {

ignite0.close();

waitForTopologyUpdate(2, 4);
waitForTopologyUpdate(2, 3);

GridTestUtils.assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
ignite1.cache(DEFAULT_CACHE_NAME).get(1);

return null;
}
}, CacheServerNotFoundException.class, null);

GridTestUtils.assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
ignite2.cache(DEFAULT_CACHE_NAME).get(1);

return null;
}
}, CacheServerNotFoundException.class, null);

ignite1.close();

waitForTopologyUpdate(1, 5);
}, IgniteClientDisconnectedException.class, null);

GridTestUtils.assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
ignite2.cache(DEFAULT_CACHE_NAME).get(1);

return null;
}
}, CacheServerNotFoundException.class, null);
}, IgniteClientDisconnectedException.class, null);
}

/**
Expand Down
Loading

0 comments on commit 7cde4f4

Please sign in to comment.