You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 28, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: content/en/docs/guides/toolchain-local-test.md
+99-38Lines changed: 99 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ This guide aims to help developers efficiently run tests for the HugeGraph toolc
11
11
12
12
### 1.1 Core Dependency: HugeGraph Server
13
13
14
-
In the testing of the HugeGraph toolchain, **HugeGraph Server is the core dependency for the vast majority of integration and functional tests**. It provides the core services of the graph database, and many components in the toolchain (such as Client, Loader, Hubble, Spark Connector, Tools) need to interact with the Server to perform their functions and be tested. Therefore, a properly configured and running HugeGraph Server is a prerequisite for complete functional testing. This guide will explain how to install/build HugeGraph Server in the sections below.
14
+
In the testing of the HugeGraph toolchain, **HugeGraph Server is the core dependency for most integration and functional tests**. It provides the core services of the graph database, and many components in the toolchain (such as Client, Loader, Hubble, Spark Connector, Tools) need to interact with the Server to perform their functions and be tested. Therefore, a properly configured and running HugeGraph Server is a prerequisite for complete functional testing. This guide will explain how to install/build HugeGraph Server in the sections below.
15
15
16
16
### 1.2 Explanation of Test Suite Types
17
17
@@ -25,7 +25,7 @@ In the testing of the HugeGraph toolchain, you may encounter the following commo
25
25
***Characteristics**: Requires a running server (like HugeGraph Server) to respond to API requests.
***Goal**: To verify that a specific function of a system or component works as required. They are used to simulate user scenarios or business processes, involve the interaction of multiple components, and are end-to-end tests.
28
+
***Goal**: To verify that a specific function of a system or component works as required. They simulate user scenarios or business processes and involve interactions between multiple components, and are end-to-end tests.
29
29
***Characteristics**: They take a relatively long time to execute, require a complete system environment (including all dependent services) to run, and can identify issues at the integration level.
30
30
31
31
## 2. Pre-Test Preparation
@@ -67,13 +67,18 @@ This method allows you to compile and install a specific version of HugeGraph Se
67
67
***`$DB_DATABASE` & `$DB_PASS`**
68
68
* Specify the name of the MySQL database and the root user password for the connection used in HugeGraph-Loader's JDBC tests. Providing this database connection information allows the Loader to read and write data correctly. Pass them directly as parameters to the `install-mysql.sh` script.
69
69
70
-
#### 3.1.2 Test Processing
70
+
#### 3.1.2 Execution Process
71
71
72
72
**Install and Start HugeGraph Server**
73
73
74
74
If you choose to install manually, you can use the following script to install HugeGraph Server. The script is located in the `/assembly/travis/` directory of any tool's repository. It is used to pull the HugeGraph Server source code from a specified commit ID, compile it, unzip it, and start the service via both http and https.
*`$COMMIT_ID`: Specifies the Git Commit ID of HugeGraph Server.
@@ -103,14 +108,18 @@ By using the officially released `hugegraph-server` Docker image, you can quickl
103
108
#### Quick Start with Docker
104
109
105
110
```bash
106
-
docker run -itd --name=server -p 8080:8080 hugegraph/hugegraph:latest
111
+
# 1. First, create the network
112
+
docker network create hugegraph-net
113
+
114
+
# 2. Start the server and join the network
115
+
docker run -itd --name=server -p 8080:8080 --network hugegraph-net hugegraph/hugegraph:latest
107
116
```
108
117
109
118
This quickly starts a HugeGraph server with built-in RocksDB, which meets the requirements for most tests and toolchain components.
110
119
111
120
#### Example `docker-compose.yml` File
112
121
113
-
The following is an example `docker-compose.yml` file that defines the HugeGraph Server, MySQL, and Hadoop (HDFS) services. You can adjust it according to your actual testing needs.
122
+
The following is an example `docker-compose.yml` file that defines the HugeGraph Server, MySQL, and Hadoop (HDFS) services. You can adjust it according to your actual testing needs. Please use Docker Compose V2.
114
123
115
124
```yaml
116
125
version: '3.8'
@@ -202,6 +211,9 @@ services:
202
211
networks:
203
212
hugegraph-net:
204
213
driver: bridge
214
+
volumes:
215
+
namenode_data:
216
+
datanode_data:
205
217
```
206
218
207
219
#### Hadoop Configuration Mounts
@@ -265,7 +277,7 @@ networks:
265
277
lsof -i:3306 # mysql port
266
278
```
267
279
268
-
4. **Stop Services**: After testing is complete, you can stop and remove all containers:
280
+
4. **Stop Services**: After testing is complete, you can stop and remove all services:
269
281
270
282
```bash
271
283
docker compose down
@@ -276,7 +288,7 @@ networks:
276
288
Generally, the local testing process for each tool is as follows, which will be explained in detail below.
Follow the instructions in [Deploying the Test Environment](#3-deploying-the-test-environment) to start `hugegraph-server`.
302
314
303
-
##### Server Authentication Settings (Authentication tests are not supported for Docker image versions <= 1.5.0)
315
+
##### Server Authentication Settings
304
316
317
+
> **Warning:** Authentication tests are **not supported** for Docker image versions <= 1.5.0. Please ensure you are using a newer version if you intend to run authentication-related tests.
305
318
Since the client's ApiTest includes authentication tests, you must ensure that the server's password is the same as in the test code; otherwise, data transfer between the client and server will fail. If you use the client's built-in script to install and start the server, you can skip this step.
306
319
However, if you start the server using other methods, you must perform the following authentication settings, as the default server does not have them set. For example, enter the container environment with `docker exec -it server bash` to make modifications.
307
320
308
321
```bash
309
-
# Step 1: Modify the authentication mode
310
-
vi conf/rest-server.properties
311
-
```
312
-
Change line 23 from `auth.authenticator=` to `auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator`
echo -e "pa" | bin/init-store.sh # This script initializes the HugeGraph store and sets default user credentials, including the password for authentication tests
334
+
echo -e "pa" | bin/init-store.sh # This script initializes the HugeGraph store and sets default user credentials, including the password for authentication testing
318
335
bin/start-hugegraph.sh
319
336
```
320
337
321
338
#### 4.1.3 Run Tests
322
339
323
340
Go to the `hugegraph-client` module directory and run the tests:
324
341
342
+
**Pre-condition Check**:
343
+
```bash
344
+
# 1. Confirm that you are in the hugegraph-toolchain root directory
345
+
pwd# Should display .../hugegraph-toolchain
346
+
347
+
# 2. Confirm that HugeGraph Server has been started
348
+
curl -s http://localhost:8080/graphs
349
+
350
+
# 3. If authentication is used, confirm the configuration is correct
351
+
curl -u admin:pa http://localhost:8080/graphs
352
+
```
353
+
325
354
```bash
326
355
cd hugegraph-client
327
356
mvn test -Dtest=UnitTestSuite -ntp
@@ -331,6 +360,7 @@ mvn test -Dtest=FuncTestSuite -ntp
331
360
332
361
* The unit test mainly depends on the compilation of `hugegraph-client` itself and is used to test the internal logic of the client.
333
362
* Other test modules require a running HugeGraph-Server service.
363
+
* Please check server log if tests failed: logs/hugegraph-server.log
Follow the instructions in [Deploying the Test Environment](#3-deploying-the-test-environment) to start `hugegraph-server`, `Hadoop (HDFS)` (only required when running HDFS tests), and `MySQL` (only required when running JDBC tests).
**4. Verify Hubble Executability (Optional, for confirming environment correctness)**
452
+
453
+
```bash
454
+
# When version is 1.5.0
455
+
cd apache-hugegraph-hubble-incubating-1.5.0/bin
456
+
./start-hubble.sh -d
457
+
sleep 10
458
+
curl http://localhost:8088/api/health # Check Hubble health status
459
+
./stop-hubble.sh
460
+
```
411
461
412
462
#### 4.3.3 Run Tests
413
463
414
464
Go to the `hugegraph-hubble` module directory and run the tests:
415
465
416
466
```bash
417
467
mvn test -P unit-test -pl hugegraph-hubble/hubble-be -ntp # Unit Test
418
-
hubble-dist/assembly/travis/run-api-test.sh # API Test
468
+
469
+
# API tests require both HugeGraph Server and Hubble services to be running.
470
+
471
+
# 1. Confirm Server is running on port 8080
472
+
curl http://localhost:8080/graphs
473
+
474
+
# 2. Confirm Hubble is running on port 8088
475
+
curl http://localhost:8088/api/health
476
+
477
+
# 3. Execute API tests
478
+
cd hugegraph-hubble/hubble-dist
479
+
hubble-dist/assembly/travis/run-api-test.sh #API Test
419
480
```
420
481
421
-
* The unit test mainly depends on the compilation of `hubble-be` itself and runs the unit tests for the Hubble backend (Java part).
422
-
* `run-api-test` requires a running HugeGraph-Server service, as well as the proper functioning of the client and loader.
482
+
* unit test mainly depends on the compilation of `hubble-be` itself, running Hubble backend (Java part) unit tests.
483
+
* run-api-test requires a running HugeGraph-Server service, as well as normal operation of client and loader.
423
484
424
-
**Important Note**: Before running API tests, make sure to install the client and loader, and ensure that both HugeGraph Server and HugeGraph-Hubble services are started and accessible.
485
+
**Important Note**: Before running API tests, be sure to complete client and loader installation, and ensure that both HugeGraph Server and HugeGraph-Hubble services are started and accessible.
425
486
426
487
### 4.4 hugegraph-spark-connector Local Testing
427
488
@@ -462,7 +523,7 @@ Compile the `hugegraph-client` and `hugegraph-tools` modules:
0 commit comments