You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/08/11 11:21:40 UTC

[GitHub] [iotdb] Beyyes commented on a diff in pull request #6960: [IOTDB-3825] Reinforce Cluster IT framework's startup check

Beyyes commented on code in PR #6960:
URL: https://github.com/apache/iotdb/pull/6960#discussion_r943370887


##########
integration-test/src/main/java/org/apache/iotdb/it/env/AbstractEnv.java:
##########
@@ -185,12 +187,40 @@ public void testWorking() {
     try {
       long startTime = System.currentTimeMillis();
       testDelegate.requestAll();
+      if (!configNodeWrapperList.isEmpty()) {
+        checkNodeHeartbeat();
+      }
       logger.info("Start cluster costs: {}s", (System.currentTimeMillis() - startTime) / 1000.0);
     } catch (Exception e) {
       fail("After 30 times retry, the cluster can't work!");
     }
   }
 
+  private void checkNodeHeartbeat() {
+    TShowClusterResp showClusterResp;
+    try (SyncConfigNodeIServiceClient client =
+        (SyncConfigNodeIServiceClient) getConfigNodeConnection()) {
+      boolean flag;
+      for (int i = 0; i < 30; i++) {
+        flag = true;
+        showClusterResp = client.showCluster();
+        Map<Integer, String> nodeStatus = showClusterResp.getNodeStatus();
+        for (String status : nodeStatus.values()) {
+          if (!status.equals("Running")) {
+            flag = false;
+            break;
+          }
+        }
+        if (flag) {
+          return;
+        }
+        Thread.sleep(1000);
+      }
+    } catch (Exception e) {
+      fail("Not all nodes are in the Running states");

Review Comment:
   If we need sleeping some time to wait that all the status of nodes have been running?



-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org