You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hugegraph.apache.org by "HJ-Young (via GitHub)" <gi...@apache.org> on 2024/08/04 12:49:27 UTC

[PR] feat(it): add basic miniCluster environment [incubator-hugegraph]

HJ-Young opened a new pull request, #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615

   <!-- 
     Thank you very much for contributing to Apache HugeGraph, we are happy that you want to help us improve it!
   
     Here are some tips for you:
       1. If this is your first time, please read the [contributing guidelines](https://github.com/apache/hugegraph/blob/master/CONTRIBUTING.md)
   
       2. If a PR fix/close an issue, type the message "close xxx" (xxx is the link of related 
   issue) in the content, GitHub will auto link it (Required)
   
       3. Name the PR title in "Google Commit Format", start with "feat | fix | perf | refactor | doc | chore", 
         such like: "feat(core): support the PageRank algorithm" or "fix: wrong break in the compute loop" (module is optional)
         skip it if you are unsure about which is the best component.
   
       4. One PR address one issue, better not to mix up multiple issues.
   
       5. Put an `x` in the `[ ]` to mark the item as CHECKED. `[x]` (or click it directly after 
   published)
   -->
   
   ## Purpose of the PR
   
   - close #xxx <!-- or use "fix #xxx", "xxx" is the ID-link of related issue, e.g: close #1024 -->
   
   <!--
   Please explain more context in this section, clarify why the changes are needed. 
   e.g:
   - If you propose a new API, clarify the use case for a new API.
   - If you fix a bug, you can clarify why it is a bug, and should be associated with an issue.
   -->
   
   ## Main Changes
   
   <!-- Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. These change logs are helpful for better and faster reviews.)
   
   For example:
   
   - If you introduce a new feature, please show detailed design here or add the link of design documentation.
   - If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
   - If there is a discussion in the mailing list, please add the link. -->
   
   ## Verifying these changes
   
   <!-- Please pick the proper options below -->
   
   - [ ] Trivial rework / code cleanup without any test coverage. (No Need)
   - [ ] Already covered by existing tests, such as *(please modify tests here)*.
   - [x] Need tests and can be verified as follows:
       - xxx
   
   ## Does this PR potentially affect the following parts?
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ]  Dependencies ([add/update license](https://hugegraph.apache.org/docs/contribution-guidelines/contribute/#321-check-licenses) info & [regenerate_dependencies](../hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh)) <!-- Don't forget to add/update the info in "LICENSE" & "NOTICE" files (both in root & dist module) -->
   - [ ]  Modify configurations
   - [ ]  The public API
   - [ ]  Other affects (typed here)
   - [x]  Nope
   
   
   ## Documentation Status
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [x]  `Doc - TODO` <!-- Your PR changes impact docs and you will update later -->
   - [ ]  `Doc - Done` <!-- Related docs have been already added or updated -->
   - [ ]  `Doc - No Need` <!-- Your PR changes don't impact/need docs -->
   


-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1718216709


##########
hugegraph-it/hg-it-dist/pom.xml:
##########
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   > the module name have been named for hugegraph-xxx, so the submodule perfect to keep consistent with the name, i mean, the 'hg' should replace with "hugegraph"
   
   maybe refer to the pd/store modules?.... 🔢 



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "shirleyStorage (via GitHub)" <gi...@apache.org>.
shirleyStorage commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1770349739


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.slf4j.Logger;
+
+public class ClusterConf {

Review Comment:
   ```suggestion
   public class ConfigUtils {
   ```



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1798389560


##########
hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/hugegraph-server.keystore:
##########


Review Comment:
   unnecessary binary file?



##########
hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/computer.yaml:
##########


Review Comment:
   same



##########
hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/log4j2.xml:
##########


Review Comment:
   do we need it?



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(ct): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "HJ-Young (via GitHub)" <gi...@apache.org>.
HJ-Young commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1766726525


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.slf4j.Logger;
+
+public abstract class AbstractConfig {
+
+    protected static final Logger LOG = HGTestLogger.LOG;
+    protected String config;
+    protected Map<String, String> properties = new HashMap<>();
+    protected String fileName;
+
+    protected void readTemplate(String filePath) {
+        try {
+            this.config = new String(Files.readAllBytes(Paths.get(filePath)));
+        } catch (IOException e) {
+            LOG.error("failed to get file", e);
+        }
+    }
+
+    protected void updateConfigs() {
+        for (Map.Entry<String, String> entry : properties.entrySet()) {
+            String placeholder = "$" + entry.getKey() + "$";
+            config = config.replace(placeholder, entry.getValue());

Review Comment:
   之前尝试过FreeMarker,但是出现了依赖问题,后来就用了这种 比较原始的方法



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "VGalaxies (via GitHub)" <gi...@apache.org>.
VGalaxies commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1793727466


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java:
##########
@@ -0,0 +1,133 @@
+/*
+ * 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.hugegraph.ct.base;
+
+import java.io.File;
+import java.util.Objects;
+
+import org.apache.commons.lang3.SystemUtils;
+
+public class ClusterConstant {
+
+    public static final String USER_DIR = "user.dir";
+    public static final String LOG = "logs";
+    public static final String PROJECT_DIR = getProjectDir();
+
+    public static final String LIB_DIR = "lib";
+    public static final String EXT_DIR = "ext";
+    public static final String PLUGINS_DIR = "plugins";
+    public static final String BIN_DIR = "bin";
+    public static final String CONF_DIR = "conf";
+
+    public static final String PD_PACKAGE_PREFIX = "apache-hugegraph-pd-incubating";
+    public static final String PD_JAR_PREFIX = "hg-pd-service";
+    public static final String STORE_PACKAGE_PREFIX = "apache-hugegraph-store-incubating";
+    public static final String STORE_JAR_PREFIX = "hg-store-node";
+    public static final String SERVER_PACKAGE_PREFIX = "apache-hugegraph-server-incubating";
+    public static final String CT_PACKAGE_PREFIX = "apache-hugegraph-ct-incubating";
+
+    public static final String APPLICATION_FILE = "application.yml";
+    public static final String SERVER_PROPERTIES = "rest-server.properties";
+    public static final String HUGEGRAPH_PROPERTIES = "graphs/hugegraph.properties";
+
+    public static final String LOG4J_FILE = "log4j2.xml";
+    public static final String VERIFY_LICENSE_FILE = "verify-license.json";
+    public static final String LICENSE_FILE = "hugegraph.license";
+    public static final String PD_TEMPLATE_FILE = "pd-application.yml.template";
+
+    public static final String STORE_TEMPLATE_FILE = "store-application.yml.template";
+
+    public static final String SERVER_TEMPLATE_FILE = "rest-server.properties.template";
+    public static final String GRAPH_TEMPLATE_FILE = "hugegraph.properties.template";
+    public static final String GREMLIN_DRIVER_SETTING_FILE = "gremlin-driver-settings.yaml";
+    public static final String GREMLIN_SERVER_FILE = "gremlin-server.yaml";
+    public static final String COMPUTER_SETTING_FILE = "computer.yaml";
+    public static final String HUGEGRAPH_SERVER_KEYSTORE = "hugegraph-server.keystore";
+    public static final String REMOTE_SETTING_FILE = "remote.yaml";
+    public static final String REMOTE_OBJECTS_SETTING_FILE = "remote-objects.yaml";
+    public static final String EMPTY_SAMPLE_GROOVY_FILE = "scripts/empty-sample.groovy";
+    public static final String EXAMPLE_GROOVY_FILE = "scripts/example.groovy";
+
+    public static final String JAVA_CMD = System.getProperty("java.home") +
+                                          File.separator + BIN_DIR + File.separator +
+                                          (SystemUtils.IS_OS_WINDOWS ? "java.exe" : "java");
+
+    public static final String PD_DIST_PATH = PROJECT_DIR + File.separator +
+                                              "hugegraph-pd" + File.separator;
+
+    public static final String PD_LIB_PATH = getFileInDir(PD_DIST_PATH, PD_PACKAGE_PREFIX) +
+                                             File.separator + LIB_DIR + File.separator;
+
+    public static final String STORE_DIST_PATH = PROJECT_DIR + File.separator + "hugegraph-store" +
+                                                 File.separator;
+
+    public static final String STORE_LIB_PATH = getFileInDir(STORE_DIST_PATH, STORE_PACKAGE_PREFIX)
+                                                + File.separator + LIB_DIR + File.separator;
+
+    public static final String SERVER_DIST_PATH = PROJECT_DIR + File.separator +
+                                                  "hugegraph-server" + File.separator;
+
+    public static final String SERVER_LIB_PATH = getFileInDir(SERVER_DIST_PATH,
+                                                              SERVER_PACKAGE_PREFIX) +
+                                                 File.separator;
+
+    public static final String CT_DIST_PATH = PROJECT_DIR + File.separator +
+                                              "hugegraph-cluster-test" + File.separator;
+
+    public static final String CT_PACKAGE_PATH = getFileInDir(CT_DIST_PATH, CT_PACKAGE_PREFIX) +
+                                                 File.separator;
+
+    private ClusterConstant() {
+        throw new IllegalStateException("Utility class");
+    }
+
+    public static String getFileInDir(String path, String fileName) {
+        File dir = new File(path);
+        if (dir.exists() && dir.isDirectory()) {
+            for (File file : Objects.requireNonNull(dir.listFiles())) {
+                if (file.getName().startsWith(fileName) && !file.getName().endsWith(".gz")) {
+                    return path + file.getName();
+                }
+            }
+        }
+        return "";
+    }
+
+    public static boolean isJava11OrHigher() {
+        String version = System.getProperty("java.version");
+        if (version.startsWith("1.")) {
+            version = version.substring(2, 3);
+        } else {
+            int dot = version.indexOf(".");
+            if (dot != -1) {
+                version = version.substring(0, dot);
+            }
+        }
+        int versionNumber = Integer.parseInt(version);
+        return versionNumber >= 11;
+    }
+
+    public static String getProjectDir() {
+        if (System.getProperty(USER_DIR).endsWith("hugegraph-cluster-test")) {
+            return System.getProperty(USER_DIR) + "/..";

Review Comment:
   avoid writing relative paths directly                                                                                                                                                                       
   



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java:
##########
@@ -0,0 +1,133 @@
+/*
+ * 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.hugegraph.ct.base;
+
+import java.io.File;
+import java.util.Objects;
+
+import org.apache.commons.lang3.SystemUtils;
+
+public class ClusterConstant {
+
+    public static final String USER_DIR = "user.dir";
+    public static final String LOG = "logs";
+    public static final String PROJECT_DIR = getProjectDir();
+
+    public static final String LIB_DIR = "lib";
+    public static final String EXT_DIR = "ext";
+    public static final String PLUGINS_DIR = "plugins";
+    public static final String BIN_DIR = "bin";
+    public static final String CONF_DIR = "conf";
+
+    public static final String PD_PACKAGE_PREFIX = "apache-hugegraph-pd-incubating";
+    public static final String PD_JAR_PREFIX = "hg-pd-service";
+    public static final String STORE_PACKAGE_PREFIX = "apache-hugegraph-store-incubating";
+    public static final String STORE_JAR_PREFIX = "hg-store-node";
+    public static final String SERVER_PACKAGE_PREFIX = "apache-hugegraph-server-incubating";
+    public static final String CT_PACKAGE_PREFIX = "apache-hugegraph-ct-incubating";
+
+    public static final String APPLICATION_FILE = "application.yml";
+    public static final String SERVER_PROPERTIES = "rest-server.properties";
+    public static final String HUGEGRAPH_PROPERTIES = "graphs/hugegraph.properties";
+
+    public static final String LOG4J_FILE = "log4j2.xml";
+    public static final String VERIFY_LICENSE_FILE = "verify-license.json";
+    public static final String LICENSE_FILE = "hugegraph.license";
+    public static final String PD_TEMPLATE_FILE = "pd-application.yml.template";
+
+    public static final String STORE_TEMPLATE_FILE = "store-application.yml.template";
+
+    public static final String SERVER_TEMPLATE_FILE = "rest-server.properties.template";
+    public static final String GRAPH_TEMPLATE_FILE = "hugegraph.properties.template";
+    public static final String GREMLIN_DRIVER_SETTING_FILE = "gremlin-driver-settings.yaml";
+    public static final String GREMLIN_SERVER_FILE = "gremlin-server.yaml";
+    public static final String COMPUTER_SETTING_FILE = "computer.yaml";
+    public static final String HUGEGRAPH_SERVER_KEYSTORE = "hugegraph-server.keystore";
+    public static final String REMOTE_SETTING_FILE = "remote.yaml";
+    public static final String REMOTE_OBJECTS_SETTING_FILE = "remote-objects.yaml";
+    public static final String EMPTY_SAMPLE_GROOVY_FILE = "scripts/empty-sample.groovy";
+    public static final String EXAMPLE_GROOVY_FILE = "scripts/example.groovy";
+
+    public static final String JAVA_CMD = System.getProperty("java.home") +
+                                          File.separator + BIN_DIR + File.separator +
+                                          (SystemUtils.IS_OS_WINDOWS ? "java.exe" : "java");
+
+    public static final String PD_DIST_PATH = PROJECT_DIR + File.separator +
+                                              "hugegraph-pd" + File.separator;
+
+    public static final String PD_LIB_PATH = getFileInDir(PD_DIST_PATH, PD_PACKAGE_PREFIX) +
+                                             File.separator + LIB_DIR + File.separator;
+
+    public static final String STORE_DIST_PATH = PROJECT_DIR + File.separator + "hugegraph-store" +
+                                                 File.separator;
+
+    public static final String STORE_LIB_PATH = getFileInDir(STORE_DIST_PATH, STORE_PACKAGE_PREFIX)
+                                                + File.separator + LIB_DIR + File.separator;
+
+    public static final String SERVER_DIST_PATH = PROJECT_DIR + File.separator +
+                                                  "hugegraph-server" + File.separator;
+
+    public static final String SERVER_LIB_PATH = getFileInDir(SERVER_DIST_PATH,
+                                                              SERVER_PACKAGE_PREFIX) +
+                                                 File.separator;
+
+    public static final String CT_DIST_PATH = PROJECT_DIR + File.separator +
+                                              "hugegraph-cluster-test" + File.separator;
+
+    public static final String CT_PACKAGE_PATH = getFileInDir(CT_DIST_PATH, CT_PACKAGE_PREFIX) +
+                                                 File.separator;
+
+    private ClusterConstant() {
+        throw new IllegalStateException("Utility class");
+    }
+
+    public static String getFileInDir(String path, String fileName) {
+        File dir = new File(path);
+        if (dir.exists() && dir.isDirectory()) {
+            for (File file : Objects.requireNonNull(dir.listFiles())) {
+                if (file.getName().startsWith(fileName) && !file.getName().endsWith(".gz")) {
+                    return path + file.getName();
+                }
+            }
+        }
+        return "";
+    }
+
+    public static boolean isJava11OrHigher() {
+        String version = System.getProperty("java.version");
+        if (version.startsWith("1.")) {
+            version = version.substring(2, 3);
+        } else {
+            int dot = version.indexOf(".");
+            if (dot != -1) {
+                version = version.substring(0, dot);
+            }
+        }
+        int versionNumber = Integer.parseInt(version);
+        return versionNumber >= 11;
+    }
+
+    public static String getProjectDir() {
+        if (System.getProperty(USER_DIR).endsWith("hugegraph-cluster-test")) {
+            return System.getProperty(USER_DIR) + "/..";
+        } else if (System.getProperty(USER_DIR).endsWith("hugegraph-clustertest-test")) {
+            return System.getProperty(USER_DIR) + "/../..";

Review Comment:
   ditto



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "zyxxoo (via GitHub)" <gi...@apache.org>.
zyxxoo commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1716248035


##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * 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.hugegraph.it.node;
+
+import static org.apache.hugegraph.it.base.ClusterConstant.CONF_DIR;
+import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD;
+import static org.apache.hugegraph.it.base.ClusterConstant.STORE_JAR_PREFIX;
+import static org.apache.hugegraph.it.base.ClusterConstant.getFileInDir;
+import static org.apache.hugegraph.it.base.ClusterConstant.isJava11OrHigher;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+
+public class StoreNodeWrapper extends AbstractNodeWrapper {

Review Comment:
   the nodeWrap look like a proxy or endpoint for remote server, so maybe can name to xxxProxy direct.



##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.hugegraph.it.node;
+
+import static org.apache.hugegraph.it.base.ClusterConstant.CONF_DIR;
+import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD;
+import static org.apache.hugegraph.it.base.ClusterConstant.PD_JAR_PREFIX;
+import static org.apache.hugegraph.it.base.ClusterConstant.getFileInDir;
+import static org.apache.hugegraph.it.base.ClusterConstant.isJava11OrHigher;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+
+public class PDNodeWrapper extends AbstractNodeWrapper {
+
+    public PDNodeWrapper(String host, int grpcPort, int clusterIndex, int cnt) {
+        super(host, grpcPort, clusterIndex, cnt);
+    }
+
+    public PDNodeWrapper(int clusterId, int cnt) {
+        this.clusterIndex = clusterId;
+        this.cnt = cnt;
+    }
+
+    /*
+    workPath is path of JAR package, configPath is path of config files
+     */
+    @Override
+    public void start() {
+        try {
+            File stdoutFile = new File(getLogPath());
+            List<String> startCmd = new ArrayList<>();
+            startCmd.add(JAVA_CMD);
+            if (!isJava11OrHigher()) {
+                LOG.error("Please make sure that the JDK is installed and the version >= 11");
+                return;
+            }
+            String pdNodeJarPath = getFileInDir(workPath, PD_JAR_PREFIX);
+            startCmd.addAll(
+                    Arrays.asList(
+                            "-Dname=HugeGraphPD" + this.cnt,
+                            "-Xms512m",
+                            "-Xmx4g",
+                            "-XX:+HeapDumpOnOutOfMemoryError",
+                            "-XX:HeapDumpPath=" + configPath + "logs",
+                            "-Dlog4j.configurationFile=" + configPath + CONF_DIR + File.separator +
+                            "log4j2.xml",
+                            "-Dspring.config.location=" + configPath + CONF_DIR + File.separator +
+                            "application.yml",
+                            "-jar", pdNodeJarPath));
+            FileUtils.write(
+                    stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true);
+            ProcessBuilder processBuilder =
+                    new ProcessBuilder(startCmd)
+                            .redirectOutput(ProcessBuilder.Redirect.appendTo(stdoutFile))
+                            .redirectError(ProcessBuilder.Redirect.appendTo(stdoutFile));

Review Comment:
   redict to log and stdio is perfect



##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/BaseNodeWrapper.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.hugegraph.it.node;
+
+public interface BaseNodeWrapper {
+
+    void createNodeDir();

Review Comment:
   should the log dir been delete with external tools?



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "Thespica (via GitHub)" <gi...@apache.org>.
Thespica commented on PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#issuecomment-2407354383

   > Cluster-Test CI is blocked by [PR](https://github.com/apache/incubator-hugegraph-toolchain/pull/624), which will fix the edgelabel_type in hugegraph-client
   
   Hi @HJ-Young , this PR is ready, and will be merged soon.


-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1793049163


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH;
+import static org.apache.hugegraph.ct.base.ClusterConstant.GRAPH_TEMPLATE_FILE;
+import static org.apache.hugegraph.ct.base.ClusterConstant.HUGEGRAPH_PROPERTIES;
+
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class GraphConfig extends AbstractConfig {
+
+    public GraphConfig() {
+        readTemplate(
+                Paths.get(CT_PACKAGE_PATH + GRAPH_TEMPLATE_FILE));
+        this.fileName = HUGEGRAPH_PROPERTIES;
+    }
+
+    public void setPDPeersList(List<String> pdPeersList) {
+        String pdPeers = pdPeersList.stream().collect(Collectors.joining(","));

Review Comment:
   ```suggestion
           String pdPeers = String.join(",", pdPeersList);
   ```



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(ct): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "HJ-Young (via GitHub)" <gi...@apache.org>.
HJ-Young commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1766728323


##########
hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.hugegraph.MultiClusterTest;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class MultiClusterDeployTest extends BaseMultiClusterTest {
+
+    @Test
+    public void testPDNodesDeployment() throws IOException {
+        List<String> addrs = env.getPDRestAddrs();
+        for (String addr : addrs) {
+            String url = addr;
+            String[] cmds = {"curl", url};
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < cmds.length; i++) {
+                sb.append(cmds[i] + " ");
+            }
+            String responseMsg = execCurl(cmds);
+            Assert.assertEquals(responseMsg, "");
+        }
+    }
+
+    @Test
+    public void testStoreNodesDeployment() throws IOException, InterruptedException {
+        List<String> addrs = env.getStoreRestAddrs();
+        for (String addr : addrs) {
+            String url = addr;
+            String[] cmds = {"curl", url};
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < cmds.length; i++) {
+                sb.append(cmds[i] + " ");
+            }
+            String responseMsg = execCurl(cmds);
+            Assert.assertTrue(responseMsg.startsWith("{"));
+        }
+    }
+
+    @Test
+    public void testServerNodesDeployment() throws IOException, InterruptedException {
+        List<String> addrs = env.getServerRestAddrs();
+        for (String addr : addrs) {
+            String url = addr;
+            String[] cmds = {"curl", url};
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < cmds.length; i++) {
+                sb.append(cmds[i] + " ");
+            }
+            String responseMsg = execCurl(cmds);

Review Comment:
   之前没有考虑到数据校验的问题,只有测试用例中加入了对返回msg的测试



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(ct): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "HJ-Young (via GitHub)" <gi...@apache.org>.
HJ-Young commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1766731963


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java:
##########
@@ -0,0 +1,179 @@
+/*
+ * 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.hugegraph.ct.env;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.CONF_DIR;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.apache.hugegraph.ct.config.ClusterConf;
+import org.apache.hugegraph.ct.config.GraphConfig;
+import org.apache.hugegraph.ct.config.PDConfig;
+import org.apache.hugegraph.ct.config.ServerConfig;
+import org.apache.hugegraph.ct.config.StoreConfig;
+import org.apache.hugegraph.ct.node.PDNodeWrapper;
+import org.apache.hugegraph.ct.node.ServerNodeWrapper;
+import org.apache.hugegraph.ct.node.StoreNodeWrapper;
+import org.slf4j.Logger;
+
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public abstract class AbstractEnv implements BaseEnv {
+
+    private static final Logger LOG = HGTestLogger.LOG;
+    protected ClusterConf clusterConf;
+    protected List<PDNodeWrapper> pdNodeWrappers;
+    protected List<ServerNodeWrapper> serverNodeWrappers;
+    protected List<StoreNodeWrapper> storeNodeWrappers;
+    @Setter
+    protected int cluster_id = 0;
+
+    protected AbstractEnv() {
+        this.pdNodeWrappers = new ArrayList<>();
+        this.serverNodeWrappers = new ArrayList<>();
+        this.storeNodeWrappers = new ArrayList<>();
+    }
+
+    protected void init(int pdCnt, int storeCnt, int serverCnt) {
+        this.clusterConf = new ClusterConf(pdCnt, storeCnt, serverCnt);
+        for (int i = 0; i < pdCnt; i++) {
+            PDNodeWrapper pdNodeWrapper = new PDNodeWrapper(cluster_id, i);
+            PDConfig pdConfig = clusterConf.getPDConfig(i);
+            pdNodeWrappers.add(pdNodeWrapper);
+            pdConfig.writeConfig(pdNodeWrapper.getNodePath()
+                                 + CONF_DIR);
+        }
+
+        for (int i = 0; i < storeCnt; i++) {
+            StoreNodeWrapper storeNodeWrapper = new StoreNodeWrapper(cluster_id, i);
+            StoreConfig storeConfig = clusterConf.getStoreConfig(i);
+            storeNodeWrappers.add(storeNodeWrapper);
+            storeConfig.writeConfig(storeNodeWrapper.getNodePath()
+                                    + CONF_DIR);
+        }
+
+        for (int i = 0; i < serverCnt; i++) {
+            ServerNodeWrapper serverNodeWrapper = new ServerNodeWrapper(cluster_id, i);
+            serverNodeWrappers.add(serverNodeWrapper);
+            ServerConfig serverConfig = clusterConf.getServerConfig(i);
+            serverConfig.setServerID(serverNodeWrapper.getID());
+            GraphConfig graphConfig = clusterConf.getGraphConfig(i);
+            if (i == 0) {
+                serverConfig.setRole("master");
+            } else {
+                serverConfig.setRole("worker");
+            }
+            serverConfig.writeConfig(serverNodeWrapper.getNodePath()
+                                     + CONF_DIR);
+            graphConfig.writeConfig(serverNodeWrapper.getNodePath()
+                                    + CONF_DIR);
+        }
+    }
+
+    public void startCluster() {
+        for (int i = 0; i < pdNodeWrappers.size(); i++) {
+            PDNodeWrapper pdNodeWrapper = pdNodeWrappers.get(i);
+            pdNodeWrapper.start();
+            while (!pdNodeWrapper.isStarted()) {
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+        for (int i = 0; i < storeNodeWrappers.size(); i++) {
+            StoreNodeWrapper storeNodeWrapper = storeNodeWrappers.get(i);
+            storeNodeWrapper.start();
+            while (!storeNodeWrapper.isStarted()) {
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+        for (ServerNodeWrapper serverNodeWrapper : serverNodeWrappers) {
+            serverNodeWrapper.start();
+            while (!serverNodeWrapper.isStarted()) {
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+    }
+
+    public void clearCluster() {

Review Comment:
   确实使用stopCluster更合适一些



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "VGalaxies (via GitHub)" <gi...@apache.org>.
VGalaxies commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1793731177


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.hugegraph.ct.base;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class HGTestLogger {
+
+    public static Logger UtilLOG = LoggerFactory.getLogger(HGTestLogger.class);
+    public static Logger EnvLOG = LoggerFactory.getLogger(HGTestLogger.class);
+    public static Logger ConfigLOG = LoggerFactory.getLogger(HGTestLogger.class);
+    public static Logger NodeLOG = LoggerFactory.getLogger(HGTestLogger.class);

Review Comment:
   static final with name like NODE_LOGGER



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "HJ-Young (via GitHub)" <gi...@apache.org>.
HJ-Young commented on PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#issuecomment-2408859377

   > > Cluster-Test CI is blocked by [PR](https://github.com/apache/incubator-hugegraph-toolchain/pull/624), which will fix the edgelabel_type in hugegraph-client
   > 
   > Hi @HJ-Young , this PR is ready, and will be merged soon.
   
   Hi, @Thespica . It seems that release jar package has not been updated?


-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1712617757


##########
hugegraph-it/hg-it-dist/pom.xml:
##########
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   > hugegraph-it name is a bit hard to understand, it needs to be more specific, such as hugegraph-cluster-deploy or hugegraph-cluster-test
   
   +1, already mentioned it
   
   `hugegraph-mini-cluster` is also fine to me (easy to understand)



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "HJ-Young (via GitHub)" <gi...@apache.org>.
HJ-Young commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1712653895


##########
hugegraph-it/hg-it-dist/pom.xml:
##########
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   plan to replace hugegraph-it with hugegraph-cluster-test



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1798389953


##########
hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/log4j2.xml:
##########


Review Comment:
   do we need it? Also add a TODO comment to reuse the config files in future



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "HJ-Young (via GitHub)" <gi...@apache.org>.
HJ-Young commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1712633448


##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConfImpl.java:
##########
@@ -0,0 +1,22 @@
+/*
+ * 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.hugegraph.it.config;
+
+public class ClusterConfImpl implements ClusterConf {

Review Comment:
   ClusterConfImpl is designed to reserve the configuration of nodes, which is used in the production of configuration files e.g. xml files. It will be completed in the next push



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "Thespica (via GitHub)" <gi...@apache.org>.
Thespica commented on PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#issuecomment-2408871674

   > > > Cluster-Test CI is blocked by [PR](https://github.com/apache/incubator-hugegraph-toolchain/pull/624), which will fix the edgelabel_type in hugegraph-client
   > > 
   > > 
   > > Hi @HJ-Young , this PR is ready, and will be merged soon.
   > 
   > Hi, @Thespica . It seems that release jar package has not been updated?
   
   Yes, it hasn't been released yet. 
   
   For testing purpose, you can modify the ci temporarily to  install the hugegraph-client that supports father-sub-edge from source(or only do it on your local), then have a test.


-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "VGalaxies (via GitHub)" <gi...@apache.org>.
VGalaxies commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1793732850


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * 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.hugegraph.ct.env;
+
+import org.apache.hugegraph.ct.base.EnvType;
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.slf4j.Logger;
+
+public class EnvFactory {
+
+    private static final Logger LOG = HGTestLogger.EnvLOG;
+    private static BaseEnv env;
+
+    public static BaseEnv getEnv() {
+        if (env == null) {
+            EnvType envType = EnvType.getSystemEnvType();
+            switch (envType) {
+                case SingleNode:
+                    env = new SimpleEnv();
+                    break;
+                case MultiNode:
+                    env = new MultiNodeEnv();
+                    break;
+                default:
+                    LOG.error("No such env type :{}", envType);

Review Comment:
   ```suggestion
                       LOG.error("No such env type: {}", envType);
   ```



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "VGalaxies (via GitHub)" <gi...@apache.org>.
VGalaxies commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1793725525


##########
hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd-application.yml.template:
##########


Review Comment:
   translate CJK characters



##########
hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store-application.yml.template:
##########


Review Comment:
   translate CJK characters



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "shirleyStorage (via GitHub)" <gi...@apache.org>.
shirleyStorage commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1770349739


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.slf4j.Logger;
+
+public class ClusterConf {

Review Comment:
   ```suggestion
   public class ClusterConfigUtils {
   ```



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "shirleyStorage (via GitHub)" <gi...@apache.org>.
shirleyStorage commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1770349739


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.slf4j.Logger;
+
+public class ClusterConf {

Review Comment:
   ```suggestion
   public class ClusterConfig {
   ```



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "HJ-Young (via GitHub)" <gi...@apache.org>.
HJ-Young commented on PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#issuecomment-2280535005

   doc reference url is here[https://hugegraph.feishu.cn/wiki/CLCTwePORiPZo5keyJUcVSymnzc?from=from_copylink](url)


-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "javeme (via GitHub)" <gi...@apache.org>.
javeme commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1720595265


##########
hugegraph-cluster-test/hg-ct-dist/pom.xml:
##########
@@ -22,20 +22,20 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.hugegraph</groupId>
-        <artifactId>hugegraph-it</artifactId>
+        <artifactId>hugegraph-cluster-test</artifactId>
         <version>${revision}</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
-    <artifactId>hg-it-dist</artifactId>
+    <artifactId>hg-ct-dist</artifactId>

Review Comment:
   hugegraph-cluster-test-dist is ok, we can keep the name longer for clarity.



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "HJ-Young (via GitHub)" <gi...@apache.org>.
HJ-Young commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1720988539


##########
hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml.template:
##########


Review Comment:
   yes, application.yml was used to generate certain cluster, but can't use random ports to deploy nodes, recent commits use template files to generate configuration files



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(ct): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "zyxxoo (via GitHub)" <gi...@apache.org>.
zyxxoo commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1759741851


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.slf4j.Logger;
+
+public abstract class AbstractConfig {
+
+    protected static final Logger LOG = HGTestLogger.LOG;
+    protected String config;
+    protected Map<String, String> properties = new HashMap<>();
+    protected String fileName;
+
+    protected void readTemplate(String filePath) {
+        try {
+            this.config = new String(Files.readAllBytes(Paths.get(filePath)));
+        } catch (IOException e) {
+            LOG.error("failed to get file", e);
+        }
+    }
+
+    protected void updateConfigs() {
+        for (Map.Entry<String, String> entry : properties.entrySet()) {
+            String placeholder = "$" + entry.getKey() + "$";
+            config = config.replace(placeholder, entry.getValue());

Review Comment:
   虽然说自己写也行,就是好奇为啥不考虑类似 FreeMarker 来做模版渲染呢?



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH;
+import static org.apache.hugegraph.ct.base.ClusterConstant.GRAPH_TEMPLATE_FILE;
+import static org.apache.hugegraph.ct.base.ClusterConstant.HUGEGRAPH_PROPERTIES;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class GraphConfig extends AbstractConfig {
+
+    public GraphConfig() {
+        readTemplate(CT_PACKAGE_PATH + GRAPH_TEMPLATE_FILE);

Review Comment:
   DI



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.slf4j.Logger;
+
+public abstract class AbstractConfig {
+
+    protected static final Logger LOG = HGTestLogger.LOG;
+    protected String config;
+    protected Map<String, String> properties = new HashMap<>();
+    protected String fileName;
+
+    protected void readTemplate(String filePath) {
+        try {
+            this.config = new String(Files.readAllBytes(Paths.get(filePath)));
+        } catch (IOException e) {
+            LOG.error("failed to get file", e);
+        }
+    }
+
+    protected void updateConfigs() {
+        for (Map.Entry<String, String> entry : properties.entrySet()) {
+            String placeholder = "$" + entry.getKey() + "$";
+            config = config.replace(placeholder, entry.getValue());
+        }
+    }
+
+    public void writeConfig(String filePath) {
+        updateConfigs();
+        String destPath = filePath + File.separator + fileName;

Review Comment:
   Paths.get



##########
hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.hugegraph.MultiClusterTest;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.hugegraph.ct.env.BaseEnv;
+import org.apache.hugegraph.ct.env.MultiNodeEnv;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+public class BaseMultiClusterTest {
+
+    protected static BaseEnv env;
+
+    protected static Process p;
+
+    @BeforeClass
+    public static void initEnv() throws InterruptedException {
+        env = new MultiNodeEnv();
+        env.startCluster();
+    }
+
+    @AfterClass
+    public static void clearEnv() throws InterruptedException {
+        env.clearCluster();
+        Thread.sleep(2000);
+    }
+
+    protected String execCurl(String[] cmds) throws IOException {

Review Comment:
   execCmd



##########
hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.hugegraph.MultiClusterTest;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class MultiClusterDeployTest extends BaseMultiClusterTest {
+
+    @Test
+    public void testPDNodesDeployment() throws IOException {
+        List<String> addrs = env.getPDRestAddrs();
+        for (String addr : addrs) {
+            String url = addr;
+            String[] cmds = {"curl", url};
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < cmds.length; i++) {
+                sb.append(cmds[i] + " ");
+            }
+            String responseMsg = execCurl(cmds);
+            Assert.assertEquals(responseMsg, "");
+        }
+    }
+
+    @Test
+    public void testStoreNodesDeployment() throws IOException, InterruptedException {
+        List<String> addrs = env.getStoreRestAddrs();
+        for (String addr : addrs) {
+            String url = addr;
+            String[] cmds = {"curl", url};
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < cmds.length; i++) {
+                sb.append(cmds[i] + " ");
+            }
+            String responseMsg = execCurl(cmds);
+            Assert.assertTrue(responseMsg.startsWith("{"));
+        }
+    }
+
+    @Test
+    public void testServerNodesDeployment() throws IOException, InterruptedException {
+        List<String> addrs = env.getServerRestAddrs();
+        for (String addr : addrs) {
+            String url = addr;
+            String[] cmds = {"curl", url};
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < cmds.length; i++) {
+                sb.append(cmds[i] + " ");
+            }
+            String responseMsg = execCurl(cmds);

Review Comment:
   最好校验数据,返回的json 可以解析一下



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java:
##########
@@ -0,0 +1,92 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.APPLICATION_FILE;
+import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH;
+import static org.apache.hugegraph.ct.base.ClusterConstant.PD_TEMPLATE_FILE;
+import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import lombok.Getter;
+
+public class PDConfig extends AbstractConfig {
+
+    @Getter
+    private final int raftPort, grpcPort, restPort;
+    @Getter
+    private String grpcHost, dataPath, raftHost;
+
+    public PDConfig() {
+        readTemplate(CT_PACKAGE_PATH + PD_TEMPLATE_FILE);
+        this.fileName = APPLICATION_FILE;
+        this.grpcHost = "127.0.0.1";
+        this.raftHost = "127.0.0.1";
+        this.dataPath = "./pd_data";
+        this.raftPort = getAvailablePort();
+        this.grpcPort = getAvailablePort();
+        this.restPort = getAvailablePort();
+        properties.put("GRPC_HOST", grpcHost);
+        properties.put("GRPC_PORT", String.valueOf(grpcPort));
+        properties.put("REST_PORT", String.valueOf(restPort));
+        properties.put("PD_DATA_PATH", dataPath);

Review Comment:
   DI,这些可以作为默认的参数



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java:
##########
@@ -0,0 +1,179 @@
+/*
+ * 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.hugegraph.ct.env;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.CONF_DIR;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.apache.hugegraph.ct.config.ClusterConf;
+import org.apache.hugegraph.ct.config.GraphConfig;
+import org.apache.hugegraph.ct.config.PDConfig;
+import org.apache.hugegraph.ct.config.ServerConfig;
+import org.apache.hugegraph.ct.config.StoreConfig;
+import org.apache.hugegraph.ct.node.PDNodeWrapper;
+import org.apache.hugegraph.ct.node.ServerNodeWrapper;
+import org.apache.hugegraph.ct.node.StoreNodeWrapper;
+import org.slf4j.Logger;
+
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public abstract class AbstractEnv implements BaseEnv {
+
+    private static final Logger LOG = HGTestLogger.LOG;
+    protected ClusterConf clusterConf;
+    protected List<PDNodeWrapper> pdNodeWrappers;
+    protected List<ServerNodeWrapper> serverNodeWrappers;
+    protected List<StoreNodeWrapper> storeNodeWrappers;
+    @Setter
+    protected int cluster_id = 0;
+
+    protected AbstractEnv() {
+        this.pdNodeWrappers = new ArrayList<>();
+        this.serverNodeWrappers = new ArrayList<>();
+        this.storeNodeWrappers = new ArrayList<>();
+    }
+
+    protected void init(int pdCnt, int storeCnt, int serverCnt) {
+        this.clusterConf = new ClusterConf(pdCnt, storeCnt, serverCnt);
+        for (int i = 0; i < pdCnt; i++) {
+            PDNodeWrapper pdNodeWrapper = new PDNodeWrapper(cluster_id, i);
+            PDConfig pdConfig = clusterConf.getPDConfig(i);
+            pdNodeWrappers.add(pdNodeWrapper);
+            pdConfig.writeConfig(pdNodeWrapper.getNodePath()
+                                 + CONF_DIR);
+        }
+
+        for (int i = 0; i < storeCnt; i++) {
+            StoreNodeWrapper storeNodeWrapper = new StoreNodeWrapper(cluster_id, i);
+            StoreConfig storeConfig = clusterConf.getStoreConfig(i);
+            storeNodeWrappers.add(storeNodeWrapper);
+            storeConfig.writeConfig(storeNodeWrapper.getNodePath()
+                                    + CONF_DIR);
+        }
+
+        for (int i = 0; i < serverCnt; i++) {
+            ServerNodeWrapper serverNodeWrapper = new ServerNodeWrapper(cluster_id, i);
+            serverNodeWrappers.add(serverNodeWrapper);
+            ServerConfig serverConfig = clusterConf.getServerConfig(i);
+            serverConfig.setServerID(serverNodeWrapper.getID());
+            GraphConfig graphConfig = clusterConf.getGraphConfig(i);
+            if (i == 0) {
+                serverConfig.setRole("master");
+            } else {
+                serverConfig.setRole("worker");
+            }
+            serverConfig.writeConfig(serverNodeWrapper.getNodePath()
+                                     + CONF_DIR);
+            graphConfig.writeConfig(serverNodeWrapper.getNodePath()
+                                    + CONF_DIR);
+        }
+    }
+
+    public void startCluster() {
+        for (int i = 0; i < pdNodeWrappers.size(); i++) {
+            PDNodeWrapper pdNodeWrapper = pdNodeWrappers.get(i);
+            pdNodeWrapper.start();
+            while (!pdNodeWrapper.isStarted()) {
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+        for (int i = 0; i < storeNodeWrappers.size(); i++) {
+            StoreNodeWrapper storeNodeWrapper = storeNodeWrappers.get(i);
+            storeNodeWrapper.start();
+            while (!storeNodeWrapper.isStarted()) {
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+        for (ServerNodeWrapper serverNodeWrapper : serverNodeWrappers) {
+            serverNodeWrapper.start();
+            while (!serverNodeWrapper.isStarted()) {
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+    }
+
+    public void clearCluster() {

Review Comment:
   stopCluster?



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "javeme (via GitHub)" <gi...@apache.org>.
javeme commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1712615028


##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.hugegraph.it.node;
+
+import static org.apache.hugegraph.it.base.ClusterConstant.CONF_DIR;
+import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD;
+import static org.apache.hugegraph.it.base.ClusterConstant.PD_JAR_PREFIX;
+import static org.apache.hugegraph.it.base.ClusterConstant.getFileInDir;
+import static org.apache.hugegraph.it.base.ClusterConstant.isJava11OrHigher;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+
+public class PDNodeWrapper extends AbstractNodeWrapper {
+
+    public PDNodeWrapper(String host, int grpcPort, int clusterIndex, int cnt) {
+        super(host, grpcPort, clusterIndex, cnt);
+    }
+
+    public PDNodeWrapper(int clusterId, int cnt) {
+        this.clusterIndex = clusterId;

Review Comment:
   prefer to keep the same name with clusterId param: this.clusterIndex => this.clusterId



##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConfImpl.java:
##########
@@ -0,0 +1,22 @@
+/*
+ * 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.hugegraph.it.config;
+
+public class ClusterConfImpl implements ClusterConf {

Review Comment:
   not sure why this class is empty



##########
hugegraph-it/hg-it-dist/pom.xml:
##########
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   hugegraph-it name is a bit hard to understand, it needs to be more specific, such as hugegraph-cluster-deploy or hugegraph-cluster-test



##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.hugegraph.it.node;
+
+import static org.apache.hugegraph.it.base.ClusterConstant.CONF_DIR;
+import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD;
+import static org.apache.hugegraph.it.base.ClusterConstant.PD_JAR_PREFIX;
+import static org.apache.hugegraph.it.base.ClusterConstant.getFileInDir;
+import static org.apache.hugegraph.it.base.ClusterConstant.isJava11OrHigher;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+
+public class PDNodeWrapper extends AbstractNodeWrapper {
+
+    public PDNodeWrapper(String host, int grpcPort, int clusterIndex, int cnt) {
+        super(host, grpcPort, clusterIndex, cnt);
+    }
+
+    public PDNodeWrapper(int clusterId, int cnt) {

Review Comment:
   can we improve the cnt name for better readability, like xxCount



##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.hugegraph.it.node;
+
+import static org.apache.hugegraph.it.base.ClusterConstant.CONF_DIR;
+import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD;
+import static org.apache.hugegraph.it.base.ClusterConstant.PD_JAR_PREFIX;
+import static org.apache.hugegraph.it.base.ClusterConstant.getFileInDir;
+import static org.apache.hugegraph.it.base.ClusterConstant.isJava11OrHigher;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+
+public class PDNodeWrapper extends AbstractNodeWrapper {
+
+    public PDNodeWrapper(String host, int grpcPort, int clusterIndex, int cnt) {
+        super(host, grpcPort, clusterIndex, cnt);
+    }
+
+    public PDNodeWrapper(int clusterId, int cnt) {
+        this.clusterIndex = clusterId;
+        this.cnt = cnt;
+    }
+
+    /*
+    workPath is path of JAR package, configPath is path of config files
+     */
+    @Override
+    public void start() {
+        try {
+            File stdoutFile = new File(getLogPath());
+            List<String> startCmd = new ArrayList<>();
+            startCmd.add(JAVA_CMD);
+            if (!isJava11OrHigher()) {
+                LOG.error("Please make sure that the JDK is installed and the version >= 11");
+                return;
+            }
+            String pdNodeJarPath = getFileInDir(workPath, PD_JAR_PREFIX);
+            startCmd.addAll(
+                    Arrays.asList(
+                            "-Dname=HugeGraphPD" + this.cnt,
+                            "-Xms512m",
+                            "-Xmx4g",
+                            "-XX:+HeapDumpOnOutOfMemoryError",
+                            "-XX:HeapDumpPath=" + configPath + "logs",
+                            "-Dlog4j.configurationFile=" + configPath + CONF_DIR + File.separator +
+                            "log4j2.xml",
+                            "-Dspring.config.location=" + configPath + CONF_DIR + File.separator +
+                            "application.yml",
+                            "-jar", pdNodeJarPath));
+            FileUtils.write(
+                    stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true);

Review Comment:
   can we add a method like `AbstractNodeWrapper.runCmd(cmd)` or `ProcessUtil.runCmd(cmd)`, to avoid writing these repeated codes in many places.



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "shirleyStorage (via GitHub)" <gi...@apache.org>.
shirleyStorage commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1770282688


##########
hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.hugegraph.MultiClusterTest;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.hugegraph.ct.env.BaseEnv;
+import org.apache.hugegraph.ct.env.MultiNodeEnv;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+public class BaseMultiClusterTest {

Review Comment:
   How about considering adding code comments to BaseMultiClusterTest to explain its responsibilities? This would help other developers understand which methods should be added or which methods should not be included in this class.



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "HJ-Young (via GitHub)" <gi...@apache.org>.
HJ-Young commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1771609751


##########
hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.hugegraph.MultiClusterTest;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.hugegraph.ct.env.BaseEnv;
+import org.apache.hugegraph.ct.env.MultiNodeEnv;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+public class BaseMultiClusterTest {

Review Comment:
   I will add code comments in next commit



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "HJ-Young (via GitHub)" <gi...@apache.org>.
HJ-Young commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1771607579


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml:
##########
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   It is designed to be used in production environments



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#issuecomment-2294851552

   ## [Codecov](https://app.codecov.io/gh/apache/incubator-hugegraph/pull/2615?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   All modified and coverable lines are covered by tests :white_check_mark:
   > Project coverage is 35.76%. Comparing base [(`ba5b89e`)](https://app.codecov.io/gh/apache/incubator-hugegraph/commit/ba5b89e374f3335865cea36a50eca1e99ccaf56e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`3476109`)](https://app.codecov.io/gh/apache/incubator-hugegraph/commit/3476109261894d380e417af65e865777a2ce879e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   > :exclamation:  There is a different number of reports uploaded between BASE (ba5b89e) and HEAD (3476109). Click for more details.
   > 
   > <details><summary>HEAD has 4 uploads less than BASE</summary>
   >
   >| Flag | BASE (ba5b89e) | HEAD (3476109) |
   >|------|------|------|
   >||5|1|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@              Coverage Diff              @@
   ##             master    #2615       +/-   ##
   =============================================
   - Coverage     46.84%   35.76%   -11.09%     
   - Complexity      343      387       +44     
   =============================================
     Files           719      719               
     Lines         58465    58465               
     Branches       7495     7495               
   =============================================
   - Hits          27387    20908     -6479     
   - Misses        28306    35280     +6974     
   + Partials       2772     2277      -495     
   ```
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/incubator-hugegraph/pull/2615?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "zyxxoo (via GitHub)" <gi...@apache.org>.
zyxxoo commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1716234402


##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java:
##########
@@ -0,0 +1,174 @@
+/*
+ * 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.hugegraph.it.node;
+
+import static org.apache.hugegraph.it.base.ClusterConstant.IT_LOG_PATH;
+import static org.apache.hugegraph.it.base.ClusterConstant.TARGET;
+import static org.apache.hugegraph.it.base.ClusterConstant.TEMPLATE_NODE_DIR;
+import static org.apache.hugegraph.it.base.ClusterConstant.USER_DIR;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.LinkOption;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.file.PathUtils;
+import org.apache.hugegraph.it.base.HGTestLogger;
+import org.slf4j.Logger;
+
+public abstract class AbstractNodeWrapper implements BaseNodeWrapper {
+
+    protected static final Logger LOG = HGTestLogger.LOG;
+
+    protected final String host;
+    protected final int port;
+    protected final Properties properties = new Properties();
+    protected final long startTime;
+    protected int clusterIndex;
+    protected String workPath;
+    protected String configPath;
+    protected Process instance;
+    protected int cnt;
+
+    public AbstractNodeWrapper() {
+        this.startTime = System.currentTimeMillis();
+        this.clusterIndex = 1;
+        this.host = "127.0.0.1";
+        this.port = 8086;
+    }
+
+    protected AbstractNodeWrapper(String host, int port, int clusterIndex, int cnt) {
+        this.host = host;
+        this.port = port;
+        this.clusterIndex = clusterIndex;
+        this.startTime = System.currentTimeMillis();
+        this.cnt = cnt;
+    }
+
+    /**
+     * Node Dir should be created before changing Config
+     */
+    @Override
+    public void createNodeDir() {
+        String destDir = getNodePath();
+        try {
+            try {
+                if (new File(destDir).exists()) {
+                    PathUtils.delete(Paths.get(destDir));
+                }
+            } catch (NoSuchFileException fileException) {
+                //no need to handle
+            }
+            // To avoid following symbolic links
+            try (Stream<Path> stream = Files.walk(Paths.get(TEMPLATE_NODE_DIR))) {
+                stream.forEach(
+                        source -> {
+                            Path destination =
+                                    Paths.get(destDir,
+                                              source.toString()
+                                                    .substring(TEMPLATE_NODE_DIR.length()));
+                            try {
+                                Files.copy(source,
+                                           destination,
+                                           LinkOption.NOFOLLOW_LINKS,
+                                           StandardCopyOption.COPY_ATTRIBUTES);
+                            } catch (IOException ioException) {
+                                LOG.error("Fail to copy files to node dest dir", ioException);
+                                throw new RuntimeException(ioException);
+                            }
+                        }
+                );
+            }
+        } catch (IOException ioException) {
+            LOG.error("Got error copying files to node dest dir", ioException);
+            throw new AssertionError();
+        }
+    }
+
+    @Override
+    public void createLogDir() {
+        String logPath = getLogPath();
+        try {
+            FileUtils.createParentDirectories(new File(logPath));
+        } catch (IOException e) {
+            LOG.error("Create log dir failed", e);
+            throw new AssertionError();
+        }
+    }
+
+    public void deleteDir() {
+        try {
+            PathUtils.deleteDirectory(Paths.get(getNodePath()));
+        } catch (IOException ex) {
+            try {
+                TimeUnit.SECONDS.sleep(1);
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                ex.printStackTrace();
+                throw new AssertionError("Delete node dir failed. " + e);
+            }
+        }
+    }
+
+    /**
+     * @return (user.dir).target.id
+     */
+    public String getNodePath() {
+        return System.getProperty(USER_DIR) + File.separator + TARGET + File.separator +

Review Comment:
   the method style should be dependency injection, as above talk, these config should come from clusterEnv



##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/AbstractEnv.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.hugegraph.it.env;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hugegraph.it.base.HGTestLogger;
+import org.apache.hugegraph.it.config.ClusterConf;
+import org.apache.hugegraph.it.config.ClusterConfImpl;
+import org.apache.hugegraph.it.node.PDNodeWrapper;
+import org.apache.hugegraph.it.node.ServerNodeWrapper;
+import org.apache.hugegraph.it.node.StoreNodeWrapper;
+import org.slf4j.Logger;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public abstract class AbstractEnv implements BaseEnv {
+
+    private static final Logger LOG = HGTestLogger.LOG;
+    private final ClusterConf clusterConf;
+    protected List<PDNodeWrapper> pdNodeWrappers;
+    protected List<ServerNodeWrapper> serverNodeWrappers;
+    protected List<StoreNodeWrapper> storeNodeWrappers;
+    protected int cluster_id = 0;
+
+    public AbstractEnv() {
+        this.clusterConf = new ClusterConfImpl();
+        this.pdNodeWrappers = new ArrayList<>();
+        this.serverNodeWrappers = new ArrayList<>();
+        this.storeNodeWrappers = new ArrayList<>();
+    }
+
+    protected void addPDNode(PDNodeWrapper pdNodeWrapper) {
+        this.pdNodeWrappers.add(pdNodeWrapper);
+    }
+
+    protected void addStoreNode(StoreNodeWrapper storeNodeWrapper) {
+        this.storeNodeWrappers.add(storeNodeWrapper);
+    }
+
+    protected void addServerNode(ServerNodeWrapper serverNodeWrapper) {
+        this.serverNodeWrappers.add(serverNodeWrapper);
+    }
+
+    @Override
+    public void initCluster() {

Review Comment:
   i am confuse for the method behavior, i understand the ClusterConf hold the config information, the clusterEnv hold the clusterConf and expose configuration lookup function, but I feel the pdNodeWraper or serverNodeWrapper should't place the class, they maybe place in like a HugeClusterFacade class, the main class have start method, and init method, the init method init the wrapper by clusterEnv params, and the start method call each start method of wrappers;



##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/BaseNodeWrapper.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.hugegraph.it.node;
+
+public interface BaseNodeWrapper {
+
+    void createNodeDir();

Review Comment:
   i can't think these method are needed
   sometimes, i am confused, what is  the responsibility of the wrapper class's;
   if i can't understand wrong, i think the createNodeDir or createLogDir, deleteDir method are the spec impl logic, their should been call in the wrap inner in the different lifecycle. don't need expose for other class call



##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java:
##########
@@ -0,0 +1,174 @@
+/*
+ * 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.hugegraph.it.node;
+
+import static org.apache.hugegraph.it.base.ClusterConstant.IT_LOG_PATH;
+import static org.apache.hugegraph.it.base.ClusterConstant.TARGET;
+import static org.apache.hugegraph.it.base.ClusterConstant.TEMPLATE_NODE_DIR;
+import static org.apache.hugegraph.it.base.ClusterConstant.USER_DIR;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.LinkOption;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.file.PathUtils;
+import org.apache.hugegraph.it.base.HGTestLogger;
+import org.slf4j.Logger;
+
+public abstract class AbstractNodeWrapper implements BaseNodeWrapper {
+
+    protected static final Logger LOG = HGTestLogger.LOG;
+
+    protected final String host;
+    protected final int port;
+    protected final Properties properties = new Properties();
+    protected final long startTime;
+    protected int clusterIndex;
+    protected String workPath;
+    protected String configPath;
+    protected Process instance;
+    protected int cnt;
+
+    public AbstractNodeWrapper() {
+        this.startTime = System.currentTimeMillis();

Review Comment:
   maybe this place call this("127.0.0.1", 8086, 1, 1)



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "VGalaxies (via GitHub)" <gi...@apache.org>.
VGalaxies commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1793733261


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java:
##########
@@ -0,0 +1,191 @@
+/*
+ * 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.hugegraph.ct.node;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.file.PathUtils;
+import org.apache.hugegraph.ct.base.ClusterConstant;
+import org.apache.hugegraph.ct.base.EnvUtil;
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.slf4j.Logger;
+
+import lombok.Getter;
+
+public abstract class AbstractNodeWrapper implements BaseNodeWrapper {
+
+    protected final Logger LOG = HGTestLogger.NodeLOG;
+
+    protected int clusterIndex;
+    @Getter
+    protected String workPath;
+    @Getter
+    protected String configPath;
+    protected Process instance;
+    protected int index;
+    protected List<String> fileNames;
+    protected String startLine;
+
+    public AbstractNodeWrapper() {
+        this.clusterIndex = 1;
+        fileNames = new ArrayList<>();
+        this.configPath = getNodePath();
+    }
+
+    public AbstractNodeWrapper(int clusterIndex, int index) {
+        this.clusterIndex = clusterIndex;
+        this.index = index;
+        fileNames = new ArrayList<>();
+        this.configPath = getNodePath();
+    }
+
+    /**
+     * Node Dir should be created before changing Config
+     */
+    public void createNodeDir(String destDir) {
+        try {
+            try {
+                if (!new File(destDir).exists()) {
+                    FileUtils.createParentDirectories(new File(destDir));
+                }
+            } catch (NoSuchFileException fileException) {
+                //Ignored

Review Comment:
   ```suggestion
                   // Ignored
   ```



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "HJ-Young (via GitHub)" <gi...@apache.org>.
HJ-Young commented on PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#issuecomment-2406433848

   Cluster-Test CI is blocked by [PR](https://github.com/apache/incubator-hugegraph-toolchain/pull/624), which will fix the edgelabel_type in hugegraph-client


-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "VGalaxies (via GitHub)" <gi...@apache.org>.
VGalaxies merged PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615


-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "javeme (via GitHub)" <gi...@apache.org>.
javeme commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1769700195


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * 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.hugegraph.ct.base;
+
+public enum EnvType {
+    Simple,
+    MultiNode;
+
+    public static EnvType getSystemEnvType() {
+        String envType = System.getProperty("TestEnv", Simple.name());

Review Comment:
   expect "test_env" style



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.hugegraph.ct.base;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+
+public class EnvUtil {
+
+    private static final Logger LOG = HGTestLogger.LOG;
+    private static final List<Integer> ports = new ArrayList<>();
+
+    public static int getAvailablePort() {
+        try {
+            ServerSocket socket = new ServerSocket(0);
+            int port = socket.getLocalPort();
+            while (ports.contains(port)) {
+                socket.close();
+                socket = new ServerSocket(0);
+                port = socket.getLocalPort();
+            }

Review Comment:
   can we use do-while to avoid repeated code?



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java:
##########
@@ -0,0 +1,92 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.APPLICATION_FILE;
+import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH;
+import static org.apache.hugegraph.ct.base.ClusterConstant.PD_TEMPLATE_FILE;
+import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import lombok.Getter;
+
+public class PDConfig extends AbstractConfig {
+
+    @Getter
+    private final int raftPort, grpcPort, restPort;
+    @Getter
+    private String grpcHost, dataPath, raftHost;
+
+    public PDConfig() {
+        readTemplate(CT_PACKAGE_PATH + PD_TEMPLATE_FILE);
+        this.fileName = APPLICATION_FILE;
+        this.grpcHost = "127.0.0.1";
+        this.raftHost = "127.0.0.1";
+        this.dataPath = "./pd_data";
+        this.raftPort = getAvailablePort();
+        this.grpcPort = getAvailablePort();
+        this.restPort = getAvailablePort();
+        properties.put("GRPC_HOST", grpcHost);
+        properties.put("GRPC_PORT", String.valueOf(grpcPort));
+        properties.put("REST_PORT", String.valueOf(restPort));
+        properties.put("PD_DATA_PATH", dataPath);
+        properties.put("RAFT_ADDRESS", raftHost + ":"
+                                       + raftPort);
+    }
+
+    public void setGrpcHost(String grpcHost) {
+        this.grpcHost = grpcHost;
+        setProperty("GRPC_HOST", grpcHost);
+    }
+
+    public void setDataPath(String dataPath) {
+        this.dataPath = dataPath;
+        setProperty("PD_DATA_PATH", dataPath);
+    }
+
+    public void setRaftHost(String raftHost) {
+        this.raftHost = raftHost;
+        setProperty("RAFT_ADDRESS", raftHost + ":" + raftPort);
+    }
+
+    public void setRaftPeerList(List<String> raftPeerList) {
+        String raftPeers = raftPeerList.stream()
+                                       .collect(Collectors.joining(","));
+        setProperty("RAFT_PEERS_LIST", raftPeers);
+    }
+
+    public void setStoreCount(int storeCount) {
+        setProperty("STORE_COUNT", String.valueOf(storeCount));
+    }
+
+    public void setStoreGrpcList(List<String> storeGrpcList) {
+        String storeGrpcLists = storeGrpcList.stream()
+                                             .collect(Collectors.joining(","));
+        setProperty("STORE_GRPC_LIST", storeGrpcLists);
+    }
+
+    public String getRaftAddress() {
+        return raftHost + ":" + raftPort;

Review Comment:
   expect "this." prefix for member access



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java:
##########
@@ -0,0 +1,29 @@
+/*
+ * 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.hugegraph.ct.base;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class HGTestLogger {
+
+    public static Logger LOG = LoggerFactory.getLogger(HGTestLogger.class);

Review Comment:
   prefer to don't share one LOG in whole module



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.hugegraph.ct.base;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+
+public class EnvUtil {
+
+    private static final Logger LOG = HGTestLogger.LOG;
+    private static final List<Integer> ports = new ArrayList<>();
+
+    public static int getAvailablePort() {
+        try {
+            ServerSocket socket = new ServerSocket(0);
+            int port = socket.getLocalPort();
+            while (ports.contains(port)) {
+                socket.close();
+                socket = new ServerSocket(0);
+                port = socket.getLocalPort();
+            }
+            ports.add(port);
+            socket.close();
+            return port;
+        } catch (IOException e) {
+            LOG.error("fail to get available ports", e);

Review Comment:
   `Failed to ...`



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * 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.hugegraph.ct.base;
+
+public enum EnvType {
+    Simple,

Review Comment:
   SingleNode



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.hugegraph.ct.base;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+
+public class EnvUtil {
+
+    private static final Logger LOG = HGTestLogger.LOG;
+    private static final List<Integer> ports = new ArrayList<>();
+
+    public static int getAvailablePort() {
+        try {
+            ServerSocket socket = new ServerSocket(0);
+            int port = socket.getLocalPort();
+            while (ports.contains(port)) {
+                socket.close();
+                socket = new ServerSocket(0);
+                port = socket.getLocalPort();
+            }
+            ports.add(port);
+            socket.close();
+            return port;
+        } catch (IOException e) {
+            LOG.error("fail to get available ports", e);
+            return -1;
+        }
+    }
+

Review Comment:
   remove the blank line?



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.hugegraph.ct.base;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+
+public class EnvUtil {
+
+    private static final Logger LOG = HGTestLogger.LOG;
+    private static final List<Integer> ports = new ArrayList<>();

Review Comment:
   prefer `Set<Integer>`



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * 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.hugegraph.ct.base;
+
+public enum EnvType {

Review Comment:
   expect a blank line



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java:
##########
@@ -0,0 +1,202 @@
+/*
+ * 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.hugegraph.ct.node;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.file.PathUtils;
+import org.apache.hugegraph.ct.base.ClusterConstant;
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.slf4j.Logger;
+
+import lombok.Getter;
+
+public abstract class AbstractNodeWrapper implements BaseNodeWrapper {
+
+    protected static final Logger LOG = HGTestLogger.LOG;
+    protected int clusterIndex;
+    @Getter
+    protected String workPath;
+    @Getter
+    protected String configPath;
+    protected Process instance;
+    protected int index;
+    protected List<String> fileNames;
+    protected String startLine;
+
+    public AbstractNodeWrapper() {
+        this.clusterIndex = 1;
+        fileNames = new ArrayList<>();
+        this.configPath = getNodePath();
+    }
+
+    public AbstractNodeWrapper(int clusterIndex, int index) {
+        this.clusterIndex = clusterIndex;
+        this.index = index;
+        fileNames = new ArrayList<>();
+        this.configPath = getNodePath();
+    }
+
+    /**
+     * Node Dir should be created before changing Config
+     */
+    public void createNodeDir(String destDir) {
+        try {
+            try {
+                if (!new File(destDir).exists()) {
+                    FileUtils.createParentDirectories(new File(destDir));
+                }
+            } catch (NoSuchFileException fileException) {
+            }
+            Path sourcePath = Paths.get(CT_PACKAGE_PATH);
+            // To avoid following symbolic links
+            try (Stream<Path> stream = Files.walk(sourcePath)) {
+                stream.forEach(
+                        source -> {
+                            Path relativePath = sourcePath.relativize(source);
+                            Path destination =
+                                    Paths.get(destDir).resolve(relativePath);
+                            if (fileNames.contains(relativePath.toString())) {
+                                try {
+                                    if (Files.notExists(destination.getParent())) {
+                                        Files.createDirectories(destination.getParent());
+                                    }
+                                    Files.copy(source,

Review Comment:
   can we reduce the level of code nesting?



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH;
+import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_PROPERTIES;
+import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_FILE;
+import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort;

Review Comment:
   expect we don't use import static ASAP



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java:
##########
@@ -0,0 +1,202 @@
+/*
+ * 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.hugegraph.ct.node;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.file.PathUtils;
+import org.apache.hugegraph.ct.base.ClusterConstant;
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.slf4j.Logger;
+
+import lombok.Getter;
+
+public abstract class AbstractNodeWrapper implements BaseNodeWrapper {
+
+    protected static final Logger LOG = HGTestLogger.LOG;
+    protected int clusterIndex;
+    @Getter
+    protected String workPath;
+    @Getter
+    protected String configPath;
+    protected Process instance;
+    protected int index;
+    protected List<String> fileNames;
+    protected String startLine;
+
+    public AbstractNodeWrapper() {
+        this.clusterIndex = 1;
+        fileNames = new ArrayList<>();
+        this.configPath = getNodePath();
+    }
+
+    public AbstractNodeWrapper(int clusterIndex, int index) {
+        this.clusterIndex = clusterIndex;
+        this.index = index;
+        fileNames = new ArrayList<>();
+        this.configPath = getNodePath();
+    }
+
+    /**
+     * Node Dir should be created before changing Config
+     */
+    public void createNodeDir(String destDir) {
+        try {
+            try {
+                if (!new File(destDir).exists()) {
+                    FileUtils.createParentDirectories(new File(destDir));
+                }
+            } catch (NoSuchFileException fileException) {

Review Comment:
   can we mark ignored if it's expected or else handle the exception



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH;
+import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_PROPERTIES;
+import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_FILE;
+import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort;
+
+import lombok.Getter;
+
+public class ServerConfig extends AbstractConfig {
+
+    @Getter
+    private int rpcPort, restPort;
+    @Getter
+    private String restHost, rpcHost;
+
+    public ServerConfig() {
+        readTemplate(CT_PACKAGE_PATH + SERVER_TEMPLATE_FILE);
+        this.fileName = SERVER_PROPERTIES;
+        this.restHost = "127.0.0.1";
+        this.rpcHost = "127.0.0.1";
+        this.rpcPort = getAvailablePort();
+        this.restPort = getAvailablePort();
+        properties.put("REST_SERVER_ADDRESS", restHost + ":" + restPort);
+        properties.put("RPC_PORT", String.valueOf(rpcPort));
+        properties.put("RPC_HOST", rpcHost);
+    }
+
+    public void setRestHost(String restHost) {
+        this.restHost = restHost;
+        setProperty("REST_SERVER_ADDRESS", restHost + ":" + restPort);
+    }
+
+    public void setServerID(String serverID) {
+        setProperty("SERVER_ID", serverID);
+    }
+
+    public void setRole(String role) {
+        setProperty("ROLE", role);
+    }
+}
+

Review Comment:
   ditto



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.slf4j.Logger;
+
+public abstract class AbstractConfig {
+
+    protected static final Logger LOG = HGTestLogger.LOG;
+    protected String config;
+    protected Map<String, String> properties = new HashMap<>();
+    protected String fileName;
+
+    protected void readTemplate(String filePath) {
+        try {
+            this.config = new String(Files.readAllBytes(Paths.get(filePath)));
+        } catch (IOException e) {
+            LOG.error("failed to get file", e);
+        }
+    }
+
+    protected void updateConfigs() {
+        for (Map.Entry<String, String> entry : properties.entrySet()) {
+            String placeholder = "$" + entry.getKey() + "$";
+            config = config.replace(placeholder, entry.getValue());
+        }
+    }
+
+    public void writeConfig(String filePath) {
+        updateConfigs();
+        String destPath = filePath + File.separator + fileName;
+        try {
+            if (Files.notExists(Path.of(destPath).getParent())) {
+                Files.createDirectories(Path.of(destPath).getParent());
+            }
+        } catch (IOException e) {
+            e.printStackTrace();

Review Comment:
   use log instead



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH;
+import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_PROPERTIES;
+import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_FILE;
+import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort;
+
+import lombok.Getter;
+
+public class ServerConfig extends AbstractConfig {
+
+    @Getter
+    private int rpcPort, restPort;

Review Comment:
   expect one member each line



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.slf4j.Logger;
+
+public abstract class AbstractConfig {
+
+    protected static final Logger LOG = HGTestLogger.LOG;
+    protected String config;
+    protected Map<String, String> properties = new HashMap<>();
+    protected String fileName;
+
+    protected void readTemplate(String filePath) {
+        try {
+            this.config = new String(Files.readAllBytes(Paths.get(filePath)));
+        } catch (IOException e) {
+            LOG.error("failed to get file", e);
+        }
+    }
+
+    protected void updateConfigs() {
+        for (Map.Entry<String, String> entry : properties.entrySet()) {
+            String placeholder = "$" + entry.getKey() + "$";
+            config = config.replace(placeholder, entry.getValue());
+        }
+    }
+
+    public void writeConfig(String filePath) {
+        updateConfigs();
+        String destPath = filePath + File.separator + fileName;
+        try {
+            if (Files.notExists(Path.of(destPath).getParent())) {
+                Files.createDirectories(Path.of(destPath).getParent());
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        try (FileWriter writer = new FileWriter(destPath)) {
+            writer.write(config);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public String getProperty(String propertyName) {
+        return properties.get(propertyName);
+    }
+
+    protected void setProperty(String propertyName, String value) {
+        if (properties.containsKey(propertyName)) {
+            properties.replace(propertyName, value);
+        } else {
+            properties.put(propertyName, value);
+        }
+    }
+}
+
+

Review Comment:
   ditto



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH;
+import static org.apache.hugegraph.ct.base.ClusterConstant.GRAPH_TEMPLATE_FILE;
+import static org.apache.hugegraph.ct.base.ClusterConstant.HUGEGRAPH_PROPERTIES;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class GraphConfig extends AbstractConfig {
+
+    public GraphConfig() {
+        readTemplate(CT_PACKAGE_PATH + GRAPH_TEMPLATE_FILE);
+        this.fileName = HUGEGRAPH_PROPERTIES;
+    }
+
+    public void setPDPeersList(List<String> pdPeersList) {
+        String pdPeers = pdPeersList.stream().collect(Collectors.joining(","));
+        setProperty("PD_PEERS_LIST", pdPeers);
+    }
+

Review Comment:
   ditto



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java:
##########
@@ -0,0 +1,92 @@
+/*
+ * 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.hugegraph.ct.config;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.APPLICATION_FILE;
+import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH;
+import static org.apache.hugegraph.ct.base.ClusterConstant.PD_TEMPLATE_FILE;
+import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import lombok.Getter;
+
+public class PDConfig extends AbstractConfig {
+
+    @Getter
+    private final int raftPort, grpcPort, restPort;
+    @Getter
+    private String grpcHost, dataPath, raftHost;
+
+    public PDConfig() {
+        readTemplate(CT_PACKAGE_PATH + PD_TEMPLATE_FILE);
+        this.fileName = APPLICATION_FILE;
+        this.grpcHost = "127.0.0.1";
+        this.raftHost = "127.0.0.1";
+        this.dataPath = "./pd_data";
+        this.raftPort = getAvailablePort();
+        this.grpcPort = getAvailablePort();
+        this.restPort = getAvailablePort();
+        properties.put("GRPC_HOST", grpcHost);
+        properties.put("GRPC_PORT", String.valueOf(grpcPort));
+        properties.put("REST_PORT", String.valueOf(restPort));
+        properties.put("PD_DATA_PATH", dataPath);
+        properties.put("RAFT_ADDRESS", raftHost + ":"
+                                       + raftPort);

Review Comment:
   keeping in one line is ok



##########
hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.hugegraph.SimpleClusterTest;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SimpleClusterDeployTest extends BaseSimpleTest {
+
+    @Test
+    public void testPDNodesDeployment() throws IOException {
+        List<String> addrs = env.getPDRestAddrs();
+        for (String addr : addrs) {
+            String url = addr;
+            String[] cmds = {"curl", url};
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < cmds.length; i++) {
+                sb.append(cmds[i] + " ");
+            }
+            String responseMsg = execCurl(cmds);
+            Assert.assertEquals(responseMsg, "");
+        }
+    }
+
+    @Test
+    public void testStoreNodesDeployment() throws IOException, InterruptedException {
+        List<String> addrs = env.getStoreRestAddrs();
+        for (String addr : addrs) {
+            String url = addr;
+            String[] cmds = {"curl", url};
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < cmds.length; i++) {
+                sb.append(cmds[i] + " ");
+            }
+            String responseMsg = execCurl(cmds);
+            Assert.assertTrue(responseMsg.startsWith("{"));
+        }
+    }
+
+    @Test
+    public void testServerNodesDeployment() throws IOException, InterruptedException {
+        List<String> addrs = env.getServerRestAddrs();
+        for (String addr : addrs) {
+            String url = addr;
+            String[] cmds = {"curl", url};

Review Comment:
   not addressed?



##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml:
##########
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   this module is just for testing or can also be used for deployment in production environments?



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(ct): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "zyxxoo (via GitHub)" <gi...@apache.org>.
zyxxoo commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1759749530


##########
hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.hugegraph.SimpleClusterTest;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SimpleClusterDeployTest extends BaseSimpleTest {
+
+    @Test
+    public void testPDNodesDeployment() throws IOException {
+        List<String> addrs = env.getPDRestAddrs();
+        for (String addr : addrs) {
+            String url = addr;
+            String[] cmds = {"curl", url};
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < cmds.length; i++) {
+                sb.append(cmds[i] + " ");
+            }
+            String responseMsg = execCurl(cmds);
+            Assert.assertEquals(responseMsg, "");
+        }
+    }
+
+    @Test
+    public void testStoreNodesDeployment() throws IOException, InterruptedException {
+        List<String> addrs = env.getStoreRestAddrs();
+        for (String addr : addrs) {
+            String url = addr;
+            String[] cmds = {"curl", url};
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < cmds.length; i++) {
+                sb.append(cmds[i] + " ");
+            }
+            String responseMsg = execCurl(cmds);
+            Assert.assertTrue(responseMsg.startsWith("{"));
+        }
+    }
+
+    @Test
+    public void testServerNodesDeployment() throws IOException, InterruptedException {
+        List<String> addrs = env.getServerRestAddrs();
+        for (String addr : addrs) {
+            String url = addr;
+            String[] cmds = {"curl", url};

Review Comment:
   我们是有 http 框架的=。=



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1712617757


##########
hugegraph-it/hg-it-dist/pom.xml:
##########
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   > hugegraph-it name is a bit hard to understand, it needs to be more specific, such as hugegraph-cluster-deploy or hugegraph-cluster-test
   
   +1, already already mentioned it
   
   `hugegraph-mini-cluster` is also fine to me (easy to understand)



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "zyxxoo (via GitHub)" <gi...@apache.org>.
zyxxoo commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1716167372


##########
hugegraph-it/hg-it-dist/pom.xml:
##########
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   the module name have been named for hugegraph-xxx, so the submodule perfect to keep consistent with the name, i mean, the 'hg' should replace with "hugegraph"



##########
hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml.template:
##########


Review Comment:
   I feel the template is a good idea, but i am confuse the 'application.yml', i think, the spec file should been generated by template with runtime params. we can use different params to generation different configuration cluster otherwise default



##########
hugegraph-it/hg-it-dist/pom.xml:
##########
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   +1



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(it): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "zyxxoo (via GitHub)" <gi...@apache.org>.
zyxxoo commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1716238595


##########
hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/BaseNodeWrapper.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.hugegraph.it.node;
+
+public interface BaseNodeWrapper {
+
+    void createNodeDir();

Review Comment:
   i can't think these method are needed
   sometimes, i am confused, what is  the responsibility of the wrapper class's;
   if i don't understand wrong, i think the createNodeDir or createLogDir, deleteDir method are the spec impl logic, their should been call in the wrap inner in the different lifecycle. don't need expose for other class call



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [PR] feat(clustertest): add basic MiniCluster module for distributed system [incubator-hugegraph]

Posted by "VGalaxies (via GitHub)" <gi...@apache.org>.
VGalaxies commented on code in PR #2615:
URL: https://github.com/apache/incubator-hugegraph/pull/2615#discussion_r1793734396


##########
hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java:
##########
@@ -0,0 +1,191 @@
+/*
+ * 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.hugegraph.ct.node;
+
+import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.file.PathUtils;
+import org.apache.hugegraph.ct.base.ClusterConstant;
+import org.apache.hugegraph.ct.base.EnvUtil;
+import org.apache.hugegraph.ct.base.HGTestLogger;
+import org.slf4j.Logger;
+
+import lombok.Getter;
+
+public abstract class AbstractNodeWrapper implements BaseNodeWrapper {
+
+    protected final Logger LOG = HGTestLogger.NodeLOG;
+
+    protected int clusterIndex;
+    @Getter
+    protected String workPath;
+    @Getter
+    protected String configPath;
+    protected Process instance;
+    protected int index;
+    protected List<String> fileNames;
+    protected String startLine;
+
+    public AbstractNodeWrapper() {
+        this.clusterIndex = 1;
+        fileNames = new ArrayList<>();
+        this.configPath = getNodePath();
+    }
+
+    public AbstractNodeWrapper(int clusterIndex, int index) {
+        this.clusterIndex = clusterIndex;
+        this.index = index;
+        fileNames = new ArrayList<>();
+        this.configPath = getNodePath();
+    }
+
+    /**
+     * Node Dir should be created before changing Config
+     */
+    public void createNodeDir(String destDir) {
+        try {
+            try {
+                if (!new File(destDir).exists()) {
+                    FileUtils.createParentDirectories(new File(destDir));
+                }
+            } catch (NoSuchFileException fileException) {
+                //Ignored
+            }
+            Path sourcePath = Paths.get(CT_PACKAGE_PATH);
+            // To avoid following symbolic links
+            try (Stream<Path> stream = Files.walk(sourcePath)) {
+                stream.forEach(source -> {
+                    Path relativePath = sourcePath.relativize(source);
+                    Path destination = Paths.get(destDir).resolve(relativePath);
+                    if (fileNames.contains(relativePath.toString())) {
+                        EnvUtil.copyFileToDestination(source, destination);
+                    }
+                });
+            }
+        } catch (IOException ioException) {
+            LOG.error("Got error copying files to node destination dir", ioException);
+            throw new AssertionError();
+        }
+    }
+
+    public void createLogDir() {
+        String logPath = getLogPath();
+        try {
+            FileUtils.createParentDirectories(new File(logPath));
+        } catch (IOException e) {
+            LOG.error("Create log dir failed", e);
+            throw new AssertionError();
+        }
+    }
+
+    public void deleteDir() {
+        try {
+            PathUtils.deleteDirectory(Paths.get(getNodePath()));
+        } catch (IOException ex) {
+            try {
+                TimeUnit.SECONDS.sleep(1);
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                LOG.error("Fail to delete node file", e);
+                throw new AssertionError("Delete node dir failed. " + e);
+            }
+        }
+    }
+
+    /**
+     * @return (user.dir).id
+     */
+    @Override
+    public String getNodePath() {
+        return CT_PACKAGE_PATH + getID() + File.separator;
+    }
+
+    @Override
+    public String getLogPath() {
+        return getNodePath() + ClusterConstant.LOG + File.separator + getID() + "-start.log";
+    }
+
+    @Override
+    public void updateWorkPath(String workPath) {
+        this.workPath = workPath;
+    }
+
+    @Override
+    public void updateConfigPath(String ConfigPath) {
+        this.configPath = ConfigPath;
+    }
+
+    @Override
+    public boolean isStarted() {
+        try (Scanner sc = new Scanner(new FileReader(getLogPath()))) {
+            while (sc.hasNextLine()) {
+                String line = sc.nextLine();
+                if (line.contains(startLine)) return true;
+            }
+        } catch (FileNotFoundException ignored) {
+        }
+        return false;
+    }
+
+    public void stop() {
+        if (this.instance == null) {
+            return;
+        }
+        this.instance.destroy();
+        try {
+            if (!this.instance.waitFor(20, TimeUnit.SECONDS)) {
+                this.instance.destroyForcibly().waitFor(10, TimeUnit.SECONDS);
+            }
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            LOG.error("Waiting node to shutdown error.", e);
+        }
+        deleteDir();
+    }
+
+    public boolean isAlive() {
+        return this.instance.isAlive();
+    }
+
+    protected ProcessBuilder runCmd(List<String> startCmd, File stdoutFile) throws IOException {
+        FileUtils.write(stdoutFile,
+                        String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true);

Review Comment:
   use System.lineSeparator() instead of \n



-- 
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: issues-unsubscribe@hugegraph.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org