liyuheng55555 commented on code in PR #12134:
URL: https://github.com/apache/iotdb/pull/12134#discussion_r1519085270
##########
integration-test/src/test/java/org/apache/iotdb/confignode/it/procedure/IoTDBProcedureIT.java:
##########
@@ -134,4 +145,73 @@ private void recoverTest(int configNodeNum, boolean
needRestartLeader) throws Ex
};
Awaitility.await().atMost(1, TimeUnit.MINUTES).until(finalCheck);
}
+
+ /**
+ * Testing the sub-procedure functionality of the Procedure framework: the
parent procedure will
+ * not execute before the sub-procedure finishing.
+ */
+ @Test
+ public void subProcedureTest() throws Exception {
+ EnvFactory.getEnv().initClusterEnvironment(1, 1);
+
+ SyncConfigNodeIServiceClient leaderClient =
+ (SyncConfigNodeIServiceClient)
EnvFactory.getEnv().getLeaderConfigNodeConnection();
+ leaderClient.callSpecialProcedure(TTestOperation.TEST_SUB_PROCEDURE);
+
+ boolean checkBeforeConfigNodeRestart = false;
+ try {
+ Awaitility.await()
+ .pollDelay(1, TimeUnit.SECONDS)
+ .atMost(10, TimeUnit.SECONDS)
+ .until(
+ () -> {
+ TShowDatabaseResp resp =
leaderClient.showDatabase(showAllDatabasesReq);
+ return resp.getDatabaseInfoMap()
+
.containsKey(AddNeverFinishSubProcedureProcedure.FAIL_DATABASE_NAME);
+ });
+ } catch (ConditionTimeoutException e) {
+ checkBeforeConfigNodeRestart = true;
+ }
+ if (!checkBeforeConfigNodeRestart) {
+ throw new Exception("checkBeforeConfigNodeRestart fail");
+ }
+
+ // Restart the ConfigNode
+ EnvFactory.getEnv().getConfigNodeWrapperList().get(0).stop();
+ EnvFactory.getEnv().getConfigNodeWrapperList().get(0).start();
+ SyncConfigNodeIServiceClient newLeaderClient =
+ (SyncConfigNodeIServiceClient)
EnvFactory.getEnv().getLeaderConfigNodeConnection();
+ // Make sure ConfigNode is working
+ Awaitility.await()
+ .pollDelay(1, TimeUnit.SECONDS)
+ .atMost(10, TimeUnit.SECONDS)
+ .until(
+ () -> {
+ try {
+ newLeaderClient.showDatabase(showAllDatabasesReq);
+ } catch (Exception e) {
+ return false;
+ }
+ return true;
+ });
+
+ boolean checkAfterConfigNodeRestart = false;
+ try {
+ Awaitility.await()
+ .atMost(10, TimeUnit.SECONDS)
Review Comment:
indeed, pollDelay 1 second now
--
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]