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


##########
modules/network/src/integrationTest/java/org/apache/ignite/internal/network/node/ItNodeStalenessAndRestartTest.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * 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.node;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.apache.ignite.internal.TestWrappers.unwrapIgniteImpl;
+import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.waitForCondition;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.concurrent.CountDownLatch;
+import org.apache.ignite.internal.ClusterPerTestIntegrationTest;
+import org.apache.ignite.internal.app.IgniteImpl;
+import org.apache.ignite.internal.network.TopologyEventHandler;
+import org.apache.ignite.internal.network.message.ScaleCubeMessage;
+import org.apache.ignite.network.ClusterNode;
+import org.junit.jupiter.api.Test;
+
+class ItNodeStalenessAndRestartTest extends ClusterPerTestIntegrationTest {
+    @Override
+    protected int initialNodes() {
+        return 2;
+    }
+
+    @Override
+    protected String getNodeBootstrapConfigTemplate() {
+        return FAST_FAILURE_DETECTION_NODE_BOOTSTRAP_CFG_TEMPLATE;
+    }
+
+    @Test
+    void nodeStalenessStatusIsClearedOnRestart() throws Exception {
+        IgniteImpl ignite0 = unwrapIgniteImpl(cluster.node(0));
+
+        simulateNetworkPartition(ignite0);
+
+        IgniteImpl restartedIgnite0 = unwrapIgniteImpl(cluster.restartNode(0));
+
+        assertTrue(
+                waitForCondition(
+                        () -> 
restartedIgnite0.clusterService().topologyService().allMembers().size() == 2,
+                        SECONDS.toMillis(10)
+                ),
+                "Did not see node 1 in the topology of restarted node 0"
+        );
+    }
+
+    private void simulateNetworkPartition(IgniteImpl ignite0) throws 
InterruptedException {
+        CountDownLatch ignite1Left = new CountDownLatch(1);

Review Comment:
   `CountDownLatch`'es API for waiting (`latch.await(...)`) better matches the 
intention (as we actually want to wait till it gets switched) than 
`future.get(...)`, so I prefer the latch in this case



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

Reply via email to