sashapolo commented on code in PR #794:
URL: https://github.com/apache/ignite-3/pull/794#discussion_r861750069
##########
modules/api/src/main/java/org/apache/ignite/Ignition.java:
##########
@@ -32,6 +32,9 @@ public interface Ignition {
/**
* Starts an Ignite node with an optional bootstrap configuration from a
HOCON file.
*
+ * <p>When this method returns, the node is partly started and ready to
accept init command (that is, its
Review Comment:
```suggestion
* <p>When this method returns, the node is partially started and ready
to accept the init command (that is, its
```
##########
modules/api/src/main/java/org/apache/ignite/Ignition.java:
##########
@@ -32,6 +32,9 @@ public interface Ignition {
/**
* Starts an Ignite node with an optional bootstrap configuration from a
HOCON file.
*
+ * <p>When this method returns, the node is partly started and ready to
accept init command (that is, its
Review Comment:
Same applies to all similar changes
##########
modules/cli/src/integrationTest/java/org/apache/ignite/cli/ItClusterCommandTest.java:
##########
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cli;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static java.util.stream.Collectors.joining;
+import static
org.apache.ignite.internal.testframework.IgniteTestUtils.runAsync;
+import static
org.apache.ignite.internal.testframework.IgniteTestUtils.testNodeName;
+import static
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import io.micronaut.context.ApplicationContext;
+import io.micronaut.context.env.Environment;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CountDownLatch;
+import java.util.logging.Handler;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+import org.apache.ignite.IgnitionManager;
+import org.apache.ignite.internal.testframework.WorkDirectory;
+import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+/**
+ * Integration test for {@code ignite cluster} commands.
+ */
+@ExtendWith(WorkDirectoryExtension.class)
+class ItClusterCommandTest extends AbstractCliIntegrationTest {
+ private static final Node FIRST_NODE = new Node(0, 10100, 10300);
+ private static final Node SECOND_NODE = new Node(1, 11100, 11300);
+ private static final Node THIRD_NODE = new Node(2, 12100, 12300);
+ private static final Node FOURTH_NODE = new Node(3, 13100, 13300);
+
+ private static final List<Node> NODES = List.of(FIRST_NODE, SECOND_NODE,
THIRD_NODE, FOURTH_NODE);
+
+ private static final String NL = System.lineSeparator();
+
+ private static final Logger topologyLogger =
Logger.getLogger("org.apache.ignite.network.scalecube.ScaleCubeTopologyService");
+
+ /** DI context. */
+ private ApplicationContext ctx;
+
+ @BeforeEach
+ void setup(@WorkDirectory Path workDir, TestInfo testInfo) throws
Exception {
+ CountDownLatch allNodesAreInPhysicalTopology = new CountDownLatch(1);
+
+ Handler physicalTopologyWaiter =
physicalTopologyWaiter(allNodesAreInPhysicalTopology);
+ topologyLogger.addHandler(physicalTopologyWaiter);
+
+ try {
+ startClusterWithoutInit(workDir, testInfo);
+
+
waitTillAllNodesJoinPhysicalTopology(allNodesAreInPhysicalTopology);
+ } finally {
+ topologyLogger.removeHandler(physicalTopologyWaiter);
+ }
+
+ ctx = ApplicationContext.run(Environment.TEST);
+ }
+
+ private Handler physicalTopologyWaiter(CountDownLatch
physicalTopologyIsFull) {
+ return new NoOpHandler() {
+ @Override
+ public void publish(LogRecord record) {
+ if (record.getMessage().contains("Topology snapshot [nodes=" +
NODES.size() + "]")) {
+ physicalTopologyIsFull.countDown();
+ }
+ }
+ };
+ }
+
+ private void startClusterWithoutInit(Path workDir, TestInfo testInfo) {
+ CompletableFuture<?>[] futures = NODES.stream()
+ .map(node -> runAsync(() -> startNodeWithoutInit(node,
workDir, testInfo)))
Review Comment:
What's the point of using `runAsync` here? I think you can simply start
nodes in a cycle
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]