Version 1.7 of the documentation is no longer actively maintained. The site that you are currently viewing is an archived snapshot.
For up-to-date documentation, see the latest version.
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.5
Python: >= 3.11 (only required for Hubble tests)
2.2 Clone Code
git clone https://github.com/${GITHUB_USER_NAME}/hugegraph-toolchain.git
cd hugegraph-toolchain
3. Deploy Test Environment
Deployment Options
Script Deployment (Recommended): Precisely control Server version by specifying Commit ID, avoid interface incompatibility
Docker Deployment: Quick start, but may have version lag causing test failures
$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 versionexportCOMMIT_ID="master"# Or specific commit hash, e.g. "8b90977"# Execute installation (script located in /assembly/travis/ directory)hugegraph-client/assembly/travis/install-hugegraph-from-source.sh $COMMIT_ID
Default ports: http 8080, https 8443
Ensure ports are not occupied
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/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.
Note: Docker images <= 1.5.0 don’t support authentication tests, need 1.6.0+
ApiTest requires authentication configuration. Skip this if using script installation. Manual configuration needed for Docker:
# 1. Modify authentication modecp conf/rest-server.properties conf/rest-server.properties.backup
sed -i '/^auth.authenticator=/c\auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator' conf/rest-server.properties
grep auth.authenticator conf/rest-server.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 http://localhost:8080/graphs # Should return {"graphs":["hugegraph"]}curl -u admin:pa http://localhost:8080/graphs # Authentication test (pa is test default password)# 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)
CI Script Path: .github/workflows/*-ci.yml (CI configuration files in the HugeGraph toolchain project, which can be used as a reference)
Dependent Service Installation Scripts: hugegraph-*/assembly/travis/ (Installation scripts for CI and local testing in the HugeGraph toolchain project, can be used directly or as a reference)