rpuch commented on code in PR #7188:
URL: https://github.com/apache/ignite-3/pull/7188#discussion_r2609556711


##########
modules/network/src/integrationTest/java/org/apache/ignite/internal/network/ItStaticNodeFinderTest.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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.internal.network;
+
+import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.assertThrowsWithCause;
+import static org.apache.ignite.internal.util.ExceptionUtils.unwrapRootCause;
+import static 
org.apache.ignite.lang.ErrorGroups.Network.ADDRESS_UNRESOLVED_ERR;
+
+import org.apache.ignite.internal.ClusterPerClassIntegrationTest;
+import org.apache.ignite.internal.lang.IgniteInternalException;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+
+/**
+ * Tests that node finder failure causes node shutdown.
+ */
+class ItStaticNodeFinderTest extends ClusterPerClassIntegrationTest {
+    @Override
+    protected int initialNodes() {
+        return 1;
+    }
+
+    @Override
+    protected String getNodeBootstrapConfigTemplate() {
+        return "ignite {\n"
+                + "  network: {\n"
+                + "    port: {},\n"
+                + "    nodeFinder.netClusterNodes: [ \"bad.host:1234\" ]\n"
+                + "  },\n"
+                + "}";
+    }
+
+    @Override
+    protected boolean needInitializeCluster() {
+        return false;
+    }
+
+    @Test
+    void testNodeShutdownOnNodeFinderFailure(TestInfo testInfo) {
+        Throwable throwable = assertThrowsWithCause(
+                () -> CLUSTER.startAndInit(testInfo, initialNodes(), 
cmgMetastoreNodes(), this::configureInitParameters),
+                IgniteInternalException.class);
+
+        IgniteInternalException actual = (IgniteInternalException) 
unwrapRootCause(throwable);
+        Assertions.assertEquals(ADDRESS_UNRESOLVED_ERR, actual.code());

Review Comment:
   Please import `assertEquals()` statically; this will improve readability at 
a zero cost



##########
modules/network/src/integrationTest/java/org/apache/ignite/internal/network/ItStaticNodeFinderTest.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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.internal.network;
+
+import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.assertThrowsWithCause;
+import static org.apache.ignite.internal.util.ExceptionUtils.unwrapRootCause;
+import static 
org.apache.ignite.lang.ErrorGroups.Network.ADDRESS_UNRESOLVED_ERR;
+
+import org.apache.ignite.internal.ClusterPerClassIntegrationTest;
+import org.apache.ignite.internal.lang.IgniteInternalException;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+
+/**
+ * Tests that node finder failure causes node shutdown.

Review Comment:
   1. Shutdown or not is defined by the failure handler. Should we say that we 
test that such failure causes a failure manager to be triggered?
   2. The test doesn't seem to check that failure manager is triggered. You 
could probably do it via `LogInspector`



##########
modules/api/src/main/java/org/apache/ignite/network/NetworkAddress.java:
##########
@@ -41,14 +41,6 @@ public class NetworkAddress {
      * @param port Port.
      */
     public NetworkAddress(String host, int port) {
-        if (host == null || host.isEmpty()) {

Review Comment:
   Why were all validations removed? I only express doubt in the one about 
`port < 1024` :)



##########
modules/network/src/main/java/org/apache/ignite/internal/network/StaticNodeFinder.java:
##########
@@ -45,6 +44,7 @@
  */
 public class StaticNodeFinder implements NodeFinder {
     private static final IgniteLogger LOG = 
Loggers.forClass(StaticNodeFinder.class);
+    private static final long RETRY_WAIT_FACTOR = 500;

Review Comment:
   ```suggestion
       private static final long RETRY_WAIT_BASE_MILLIS = 500;
   ```



-- 
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]

Reply via email to