Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Sizov committed Nov 14, 2024
1 parent 0f27f96 commit 0aad3ad
Show file tree
Hide file tree
Showing 6 changed files with 247 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
import org.apache.ignite.table.Tuple;
import org.apache.ignite.tx.MismatchingTransactionOutcomeException;
import org.apache.ignite.tx.TransactionException;
import org.jetbrains.annotations.Nullable;
import org.junit.jupiter.api.Test;

/**
Expand Down Expand Up @@ -383,16 +382,6 @@ void testCleanupReplicatedMessage() throws ExecutionException, InterruptedExcept
);
}

private @Nullable Integer nodeIndex(String name) {
for (int i = 0; i < initialNodes(); i++) {
if (node(i).name().equals(name)) {
return i;
}
}

return null;
}

private static class Context {
private final IgniteImpl primaryNode;
private final IgniteImpl coordinatorNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,13 @@ public Ignite node(int index) {
return Objects.requireNonNull(nodes.get(index));
}

/**
* Returns an Ignite node (a member of the cluster) by its index.
*/
public @Nullable Ignite nullableNode(int index) {
return nodes.get(index);
}

/**
* Returns a node that is not stopped and not knocked out (so it can be used to interact with the cluster).
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.jetbrains.annotations.Nullable;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestInfo;
Expand Down Expand Up @@ -220,6 +221,14 @@ protected final Ignite node(int index) {
return cluster.node(index);
}

public @Nullable Ignite nullableNode(int index) {
return cluster.nullableNode(index);
}

protected int nodeIndex(String name) {
return cluster.nodeIndex(name);
}

protected final IgniteImpl igniteImpl(int index) {
return unwrapIgniteImpl(node(index));
}
Expand Down
Loading

0 comments on commit 0aad3ad

Please sign in to comment.