Pochatkin commented on code in PR #4614: URL: https://github.com/apache/ignite-3/pull/4614#discussion_r1832437912
########## modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/status/ItClusterStatusCommandInitializedTest.java: ########## @@ -17,37 +17,79 @@ package org.apache.ignite.internal.cli.commands.cluster.status; +import static java.util.function.Function.identity; import static java.util.stream.Collectors.joining; import static org.junit.jupiter.api.Assertions.assertAll; import java.util.Arrays; -import org.apache.ignite.Ignite; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; import org.apache.ignite.internal.cli.CliIntegrationTest; +import org.jetbrains.annotations.Nullable; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; /** * Tests for {@link ClusterStatusCommand} for the cluster that is initialized. */ class ItClusterStatusCommandInitializedTest extends CliIntegrationTest { + private Function<int[], String> mapper; + + @Override + protected @Nullable int[] metastoreNodes() { + return new int[] { 0 }; + } + + @Override + protected @Nullable int[] cmgNodes() { + return new int[] { 1 }; + } + @Test @DisplayName("Should print status when valid cluster url is given but cluster is initialized") - void printStatus() { - String cmgNodes = Arrays.stream(cmgMetastoreNodes()) - .mapToObj(CLUSTER::node) - .map(Ignite::name) + void printStatus() throws InterruptedException { + String node0Url = NODE_URL; + String node1Url = "http://localhost:" + CLUSTER.httpPort(1); + + Map<Integer, String> nodeNames = IntStream.range(0, initialNodes()) + .boxed() + .collect(Collectors.toMap(identity(), i -> CLUSTER.node(i).name())); + + mapper = nodes -> Arrays.stream(nodes) + .mapToObj(nodeNames::get) .collect(joining(", ", "[", "]")); - execute("cluster", "status", "--url", NODE_URL); + CLUSTER.stopNode(0); + execute("cluster", "status", "--url", node1Url); + assertOutput("cluster", 2, "Metastore majority lost", cmgNodes(), metastoreNodes()); + + CLUSTER.startNode(0); + Thread.sleep(10000); Review Comment: Removed ########## modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/sql/ItSqlCommandTest.java: ########## @@ -33,6 +33,8 @@ class ItSqlCommandTest extends CliSqlCommandTestBase { void nonExistingFile() { execute("sql", "--file", "nonexisting", "--jdbc-url", JDBC_URL); + CLUSTER.stopNode(0); Review Comment: Removed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org