This guide helps developers run HugeGraph toolchain tests locally.
1. Core Concepts
1.1 Core Dependency: HugeGraph Server
Integration and functional tests of the toolchain depend on HugeGraph Server, including Client, Loader, Hubble, Spark Connector, Tools, and other components.
1.2 Test Types
Unit Tests: Test individual functions/methods, no external dependencies required
API Tests (ApiTestSuite): Test API interfaces, requires running HugeGraph Server
Functional Tests (FuncTestSuite): End-to-end tests, require complete system environment
2. Environment Setup
2.1 System Requirements
Operating System: Linux / macOS (Windows use WSL2)
JDK: >= 11, configure JAVA_HOME
Maven: >= 3.6
Python: >= 3.11 (only required for Hubble tests)
2.2 Clone Code
git clone https://github.com/apache/hugegraph-toolchain.git
cd hugegraph-toolchain
3. Deploy Test Environment
Deployment Options
Script Deployment: Specify a Server commit to reproduce the server version used by CI
Docker Deployment: Suitable for quick checks; if tests fail, first verify compatibility between the image and Toolchain
$COMMIT_ID: Specify Server source code Git Commit ID
$DB_DATABASE / $DB_PASS: MySQL database name and password for Loader JDBC tests
Deployment Steps
1. Install HugeGraph Server
# Set the Server baseline; use a full commit SHA for reproducible resultsexportCOMMIT_ID="master"# Execute installation (script located in /assembly/travis/ directory)hugegraph-client/assembly/travis/install-hugegraph-from-source.sh $COMMIT_ID
The script starts HTTP and HTTPS instances on ports 8080 and 8443 and configures admin/pa authentication.
Ensure both ports are available before running it.
2. Install Optional Dependencies
# Hadoop (only required for Loader HDFS tests)hugegraph-loader/assembly/travis/install-hadoop.sh
# MySQL (only required for Loader JDBC tests)hugegraph-loader/assembly/travis/install-mysql.sh $DB_DATABASE$DB_PASS
Complete configuration example including Server, MySQL, Hadoop services (requires Docker Compose V2):
version:'3.8'services:hugegraph-server:image:hugegraph/hugegraph:latest # Can be replaced with a specific version, or build your own imagecontainer_name:hugegraph-serverports:- "8080:8080"# HugeGraph Server HTTP portenvironment:# Configure HugeGraph Server parameters as needed, e.g., backend storage- HUGEGRAPH_SERVER_OPTIONS="-Dstore.backend=rocksdb"volumes:# If you need to persist data or mount configuration files, add volumes here# - ./hugegraph-data:/opt/hugegraph/datahealthcheck:test:["CMD-SHELL","curl -f http://localhost:8080/graphspaces/DEFAULT/graphs || exit 1"]interval:10stimeout:3sretries:5networks:- hugegraph-net# If you need JDBC tests for hugegraph-loader, you can add the following service# mysql:# image: mysql:5.7# container_name: mysql-db# environment:# MYSQL_ROOT_PASSWORD: ${DB_PASS:-your_mysql_root_password} # Read from environment variable, or use default# MYSQL_DATABASE: ${DB_DATABASE:-hugegraph_test_db} # Read from environment variable, or use default# ports:# - "3306:3306"# volumes:# - ./mysql-data:/var/lib/mysql # Data persistence# healthcheck:# test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-p${DB_PASS:-your_mysql_root_password}"]# interval: 5s# timeout: 3s# retries: 5# networks:# - hugegraph-net# If you need Hadoop/HDFS tests for hugegraph-loader, you can add the following services# namenode:# image: johannestang/hadoop-namenode:2.0.0-hadoop2.8.5-java8# container_name: namenode# ports:# - "0.0.0.0:9870:9870"# - "0.0.0.0:8020:8020"# environment:# - CLUSTER_NAME=test-cluster# - HDFS_NAMENODE_USER=root# - HADOOP_CONF_DIR=/hadoop/etc/hadoop# volumes:# - ./config/core-site.xml:/hadoop/etc/hadoop/core-site.xml# - ./config/hdfs-site.xml:/hadoop/etc/hadoop/hdfs-site.xml# - namenode_data:/hadoop/dfs/name# command: bash -c "if [ ! -d /hadoop/dfs/name/current ]; then hdfs namenode -format; fi && /entrypoint.sh"# healthcheck:# test: ["CMD", "hdfs", "dfsadmin", "-report"]# interval: 5s# timeout: 3s# retries: 5# networks:# - hugegraph-net# datanode:# image: johannestang/hadoop-datanode:2.0.0-hadoop2.8.5-java8# container_name: datanode# depends_on:# - namenode# environment:# - CLUSTER_NAME=test-cluster# - HDFS_DATANODE_USER=root# - HADOOP_CONF_DIR=/hadoop/etc/hadoop# volumes:# - ./config/core-site.xml:/hadoop/etc/hadoop/core-site.xml# - ./config/hdfs-site.xml:/hadoop/etc/hadoop/hdfs-site.xml# - datanode_data:/hadoop/dfs/data# healthcheck:# test: ["CMD", "hdfs", "dfsadmin", "-report"]# interval: 5s# timeout: 3s# retries: 5# networks:# - hugegraph-netnetworks:hugegraph-net:driver:bridgevolumes:namenode_data:datanode_data:
Hadoop Configuration Mounts
Create a ./config folder in the same directory as docker-compose.yml to mount Hadoop configuration files. You can skip this step if HDFS testing is not required.
ApiTest requires authentication. No additional configuration is needed when using the script in Section 3.1. For a manually deployed Server, the authentication settings and test credentials must match the test code.
# 1. Modify authentication modecp conf/rest-server.properties conf/rest-server.properties.backup
sed -i 's|#auth.authenticator=.*|auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator|' conf/rest-server.properties
grep auth.authenticator conf/rest-server.properties
sed -i 's|gremlin.graph=org.apache.hugegraph.HugeFactory|gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy|' conf/graphs/hugegraph.properties
# 2. Set password# Note: Test code uses "pa" as default password, must match for tests to workbin/stop-hugegraph.sh
exportPASSWORD="pa"# Set to test default passwordecho -e "${PASSWORD}"| bin/init-store.sh
bin/start-hugegraph.sh
Run Tests
# Check environmentcurl -u admin:pa http://localhost:8080/graphspaces/DEFAULT/graphs
# Run testscd hugegraph-client
mvn test -Dtest=UnitTestSuite -ntp # Unit testsmvn test -Dtest=ApiTestSuite -ntp # API tests (requires Server)mvn test -Dtest=FuncTestSuite -ntp # Functional tests (requires Server)
Check Server log if tests fail: logs/hugegraph-server.log
cd hugegraph-loader
mvn test -P unit -ntp # Unit testsmvn test -P file -ntp # File tests (requires Server)mvn test -P hdfs -ntp # HDFS tests (requires Server + Hadoop)mvn test -P jdbc -ntp # JDBC tests (requires Server + MySQL)mvn test -P kafka -ntp # Kafka tests (requires Server)
# Unit testsmvn test -P unit-test -pl hugegraph-hubble/hubble-be -ntp
# Legacy Python API tests (requires Server; the script installs and starts Hubble)curl -u admin:pa http://localhost:8080/graphspaces/DEFAULT/graphs # Check Servercd hugegraph-hubble
./hubble-dist/assembly/travis/run-api-test.sh
# Full verification entry point used by current CI (build the Hubble tarball first)HUBBLE_TARBALL="$(ls target/apache-hugegraph-hubble-*.tar.gz | head -n 1)"hubble-dist/assembly/travis/verify-hubble-issue-694.sh \
"$HUBBLE_TARBALL" http://127.0.0.1:8080