This is an automated email from the ASF dual-hosted git repository. ericpai pushed a commit to branch bugfix/iotdb-5297 in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 4f5f9879e4c2fde5441a8c73cf6185f17ce1fc1f Author: ericpai <[email protected]> AuthorDate: Tue Dec 27 17:49:08 2022 +0800 [IOTDB-5297] Add maxRetryTimes for IoTDBClusterNodeErrorStartUpIT to avoid infinite loop --- .../it/cluster/IoTDBClusterNodeErrorStartUpIT.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/integration-test/src/test/java/org/apache/iotdb/confignode/it/cluster/IoTDBClusterNodeErrorStartUpIT.java b/integration-test/src/test/java/org/apache/iotdb/confignode/it/cluster/IoTDBClusterNodeErrorStartUpIT.java index 65b8bedad1..c0706eb2aa 100644 --- a/integration-test/src/test/java/org/apache/iotdb/confignode/it/cluster/IoTDBClusterNodeErrorStartUpIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/confignode/it/cluster/IoTDBClusterNodeErrorStartUpIT.java @@ -70,6 +70,7 @@ public class IoTDBClusterNodeErrorStartUpIT { private static final String TEST_CLUSTER_NAME = "defaultCluster"; private static final String ERROR_CLUSTER_NAME = "errorCluster"; + private static final int maxRetryTimes = 60; @Before public void setUp() throws Exception { @@ -240,7 +241,8 @@ public class IoTDBClusterNodeErrorStartUpIT { // Shutdown and check EnvFactory.getEnv().shutdownConfigNode(1); EnvFactory.getEnv().shutdownDataNode(0); - while (true) { + int retryTimes; + for (retryTimes = 0; retryTimes < maxRetryTimes; retryTimes++) { AtomicInteger unknownCnt = new AtomicInteger(0); showClusterResp = client.showCluster(); showClusterResp @@ -257,6 +259,10 @@ public class IoTDBClusterNodeErrorStartUpIT { } TimeUnit.SECONDS.sleep(1); } + if (retryTimes >= maxRetryTimes) { + Assert.fail( + "The running nodes are still insufficient after retrying " + maxRetryTimes + " times"); + } /* Restart and updatePeer */ // TODO: @Itami-sho, enable this test and delete it @@ -286,7 +292,7 @@ public class IoTDBClusterNodeErrorStartUpIT { // Restart and check EnvFactory.getEnv().startConfigNode(1); EnvFactory.getEnv().startDataNode(0); - while (true) { + for (retryTimes = 0; retryTimes < maxRetryTimes; retryTimes++) { AtomicInteger runningCnt = new AtomicInteger(0); showClusterResp = client.showCluster(); showClusterResp @@ -303,6 +309,10 @@ public class IoTDBClusterNodeErrorStartUpIT { } TimeUnit.SECONDS.sleep(1); } + if (retryTimes >= maxRetryTimes) { + Assert.fail( + "The running nodes are still insufficient after retrying " + maxRetryTimes + " times"); + } } } }
