Skip to content

Commit

Permalink
IGNITE-20720 Move ClusterPerTestIntegrationTest and ClusterPerClassIn…
Browse files Browse the repository at this point in the history
…tegrationTest to Test Fixtures (#2744)
  • Loading branch information
sashapolo committed Oct 24, 2023
1 parent 286cd1b commit 0c5fda7
Show file tree
Hide file tree
Showing 46 changed files with 667 additions and 707 deletions.
6 changes: 3 additions & 3 deletions modules/runner/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ dependencies {
testImplementation libs.auto.service.annotations

integrationTestAnnotationProcessor project(':ignite-configuration-annotation-processor')
integrationTestAnnotationProcessor libs.auto.service
integrationTestAnnotationProcessor libs.jmh.annotation.processor
integrationTestImplementation project(':ignite-distribution-zones')
integrationTestImplementation project(':ignite-affinity')
Expand Down Expand Up @@ -178,10 +177,11 @@ dependencies {
exclude group: 'org.ow2.asm', module: 'asm'
}
integrationTestImplementation libs.typesafe.config
integrationTestImplementation libs.auto.service.annotations
integrationTestImplementation libs.netty.common
integrationTestImplementation libs.netty.handler

testFixturesAnnotationProcessor libs.auto.service

testFixturesImplementation project(':ignite-core')
testFixturesImplementation project(':ignite-api')
testFixturesImplementation project(':ignite-raft-api')
Expand All @@ -195,7 +195,7 @@ dependencies {
testFixturesImplementation testFixtures(project(':ignite-network'))
testFixturesImplementation libs.jetbrains.annotations
testFixturesImplementation libs.hamcrest.core
testFixturesImplementation libs.auto.service
testFixturesImplementation libs.auto.service.annotations
}

tasks.register("runnerPlatformTest", JavaExec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.stream.IntStream;
import org.apache.ignite.internal.ClusterPerClassIntegrationTest;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.lang.IgniteBiTuple;
import org.apache.ignite.internal.lang.IgniteStringFormatter;
Expand All @@ -44,7 +45,6 @@
import org.apache.ignite.internal.schema.marshaller.TupleMarshallerException;
import org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl;
import org.apache.ignite.internal.schema.row.Row;
import org.apache.ignite.internal.sql.engine.ClusterPerClassIntegrationTest;
import org.apache.ignite.internal.table.TableImpl;
import org.apache.ignite.internal.testframework.IgniteTestUtils;
import org.apache.ignite.internal.thread.NamedThreadFactory;
Expand Down Expand Up @@ -73,7 +73,7 @@ public class ItRaftCommandLeftInLogUntilRestartTest extends ClusterPerClassInteg
};

@Override
protected int nodes() {
protected int initialNodes() {
return 2;
}

Expand Down Expand Up @@ -116,7 +116,7 @@ public void testUpdateAllCommand() throws Exception {
public void testCommitCommandKeyValueView() throws Exception {
restartClusterWithNotAppliedCommands(
tx -> {
var kvView = CLUSTER_NODES.get(0).tables().table(DEFAULT_TABLE_NAME).keyValueView();
var kvView = CLUSTER.aliveNode().tables().table(DEFAULT_TABLE_NAME).keyValueView();

for (var row : dataSet) {
kvView.put(tx, Tuple.create().set("ID", row[0]), Tuple.create().set("NAME", row[1]).set("SALARY", row[2]));
Expand All @@ -139,7 +139,7 @@ public void testUpdateCommandKeyValueView() throws Exception {
tx -> {
},
tx -> {
var kvView = CLUSTER_NODES.get(0).tables().table(DEFAULT_TABLE_NAME).keyValueView();
var kvView = CLUSTER.aliveNode().tables().table(DEFAULT_TABLE_NAME).keyValueView();

for (var row : dataSet) {
kvView.put(tx, Tuple.create().set("ID", row[0]), Tuple.create().set("NAME", row[1]).set("SALARY", row[2]));
Expand All @@ -162,8 +162,8 @@ private void restartClusterWithNotAppliedCommands(
Consumer<Transaction> afterBlock,
Consumer<IgniteImpl> checkAction
) throws Exception {
var node0 = (IgniteImpl) CLUSTER_NODES.get(0);
var node1 = (IgniteImpl) CLUSTER_NODES.get(1);
var node0 = CLUSTER.node(0);
var node1 = CLUSTER.node(1);

AtomicReference<IgniteBiTuple<ClusterNode, String>> leaderAndGroupRef = new AtomicReference<>();

Expand Down Expand Up @@ -204,14 +204,13 @@ private void restartClusterWithNotAppliedCommands(
tx.rollback();
}

stopNodes();
CLUSTER.stopNode(0);
CLUSTER.stopNode(1);

log.info("Restart the cluster");

startCluster();

var node0Started = (IgniteImpl) CLUSTER_NODES.get(0);
var node1Started = (IgniteImpl) CLUSTER_NODES.get(1);
var node0Started = CLUSTER.startNode(0);
var node1Started = CLUSTER.startNode(1);

var ignite = isNode0Leader ? node1Started : node0Started;

Expand Down

0 comments on commit 0c5fda7

Please sign in to comment.