From 513bbd1a084b4b5ba8f45828466e013da481715b Mon Sep 17 00:00:00 2001 From: contrueCT Date: Tue, 26 May 2026 19:33:39 +0800 Subject: [PATCH 01/10] test(ci): add Gremlin Console smoke test --- .github/workflows/server-ci.yml | 13 +++++ .../travis/run-gremlin-console-smoke-test.sh | 55 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh diff --git a/.github/workflows/server-ci.yml b/.github/workflows/server-ci.yml index 266e70feb1..6da445a0f6 100644 --- a/.github/workflows/server-ci.yml +++ b/.github/workflows/server-ci.yml @@ -82,6 +82,13 @@ jobs: run: | $TRAVIS_DIR/run-api-test.sh $BACKEND $REPORT_DIR + - name: Run Gremlin Console smoke test + if: ${{ matrix.BACKEND == 'rocksdb' }} + run: | + VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + SERVER_DIR=hugegraph-server/apache-hugegraph-server-$VERSION/ + bash "$TRAVIS_DIR/run-gremlin-console-smoke-test.sh" "$SERVER_DIR" + # TODO: disable raft test in normal PR due to the always timeout problem - name: Run raft test if: ${{ env.RAFT_MODE == 'true' && env.BACKEND == 'rocksdb' }} @@ -156,6 +163,12 @@ jobs: run: | $TRAVIS_DIR/run-api-test.sh $BACKEND $REPORT_DIR + - name: Run Gremlin Console smoke test + run: | + VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + SERVER_DIR=hugegraph-server/apache-hugegraph-server-$VERSION/ + bash "$TRAVIS_DIR/run-gremlin-console-smoke-test.sh" "$SERVER_DIR" + - name: Show server log on failure if: failure() run: | diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh new file mode 100644 index 0000000000..68cfc8fd92 --- /dev/null +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# +# 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. +# +set -euo pipefail + +SERVER_DIR=${1:?Usage: run-gremlin-console-smoke-test.sh } +SMOKE_MARKER="gremlin-console-smoke-ok" + +if [ ! -d "$SERVER_DIR" ]; then + echo "Server directory does not exist: $SERVER_DIR" + exit 1 +fi + +if [ ! -x "$SERVER_DIR/bin/gremlin-console.sh" ]; then + echo "Gremlin Console script is not executable: $SERVER_DIR/bin/gremlin-console.sh" + exit 1 +fi + +TMP_DIR=${TMPDIR:-/tmp} +SMOKE_SCRIPT=$(mktemp "${TMP_DIR}/hugegraph-gremlin-console-smoke.XXXXXX.groovy") +SMOKE_LOG=$(mktemp "${TMP_DIR}/hugegraph-gremlin-console-smoke.XXXXXX.log") + +cleanup() { + rm -f "$SMOKE_SCRIPT" "$SMOKE_LOG" +} +trap cleanup EXIT + +cat > "$SMOKE_SCRIPT" < Date: Mon, 8 Jun 2026 21:28:42 +0800 Subject: [PATCH 02/10] fix(ci): make Gremlin Console smoke temp files portable --- .../src/assembly/travis/run-gremlin-console-smoke-test.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh index 68cfc8fd92..4a3811b3c1 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh @@ -31,11 +31,12 @@ if [ ! -x "$SERVER_DIR/bin/gremlin-console.sh" ]; then fi TMP_DIR=${TMPDIR:-/tmp} -SMOKE_SCRIPT=$(mktemp "${TMP_DIR}/hugegraph-gremlin-console-smoke.XXXXXX.groovy") -SMOKE_LOG=$(mktemp "${TMP_DIR}/hugegraph-gremlin-console-smoke.XXXXXX.log") +TMP_WORK_DIR=$(mktemp -d "${TMP_DIR}/hugegraph-gremlin-console-smoke.XXXXXX") +SMOKE_SCRIPT="${TMP_WORK_DIR}/smoke.groovy" +SMOKE_LOG="${TMP_WORK_DIR}/smoke.log" cleanup() { - rm -f "$SMOKE_SCRIPT" "$SMOKE_LOG" + rm -rf "$TMP_WORK_DIR" } trap cleanup EXIT From 8a74bb7fd1d86c557d7d795f9fc3aec943faf226 Mon Sep 17 00:00:00 2001 From: contrueCT Date: Sat, 13 Jun 2026 23:06:01 +0800 Subject: [PATCH 03/10] fix(ci): simplify Gremlin Console smoke script --- .../src/assembly/travis/run-gremlin-console-smoke-test.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh index 4a3811b3c1..335acf25f9 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh @@ -41,11 +41,7 @@ cleanup() { trap cleanup EXIT cat > "$SMOKE_SCRIPT" < Date: Sat, 13 Jun 2026 23:26:04 +0800 Subject: [PATCH 04/10] fix(ci): run Gremlin Console smoke remotely --- .github/workflows/server-ci.yml | 21 ++++++------------- .../src/assembly/travis/run-api-test.sh | 6 ++++++ .../travis/run-gremlin-console-smoke-test.sh | 16 +++++++++++++- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/.github/workflows/server-ci.yml b/.github/workflows/server-ci.yml index 6da445a0f6..4593857423 100644 --- a/.github/workflows/server-ci.yml +++ b/.github/workflows/server-ci.yml @@ -80,14 +80,11 @@ jobs: - name: Run api test run: | - $TRAVIS_DIR/run-api-test.sh $BACKEND $REPORT_DIR - - - name: Run Gremlin Console smoke test - if: ${{ matrix.BACKEND == 'rocksdb' }} - run: | - VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - SERVER_DIR=hugegraph-server/apache-hugegraph-server-$VERSION/ - bash "$TRAVIS_DIR/run-gremlin-console-smoke-test.sh" "$SERVER_DIR" + if [ "$BACKEND" = "rocksdb" ]; then + $TRAVIS_DIR/run-api-test.sh $BACKEND $REPORT_DIR true + else + $TRAVIS_DIR/run-api-test.sh $BACKEND $REPORT_DIR + fi # TODO: disable raft test in normal PR due to the always timeout problem - name: Run raft test @@ -161,13 +158,7 @@ jobs: - name: Run RocksDB API test run: | - $TRAVIS_DIR/run-api-test.sh $BACKEND $REPORT_DIR - - - name: Run Gremlin Console smoke test - run: | - VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - SERVER_DIR=hugegraph-server/apache-hugegraph-server-$VERSION/ - bash "$TRAVIS_DIR/run-gremlin-console-smoke-test.sh" "$SERVER_DIR" + $TRAVIS_DIR/run-api-test.sh $BACKEND $REPORT_DIR true - name: Show server log on failure if: failure() diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh index 2edeb9ce6c..7ed95e753b 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh @@ -20,6 +20,7 @@ set -ev BACKEND=$1 REPORT_DIR=$2 REPORT_FILE=$REPORT_DIR/jacoco-api-test-for-raft.xml +RUN_GREMLIN_CONSOLE_SMOKE_TEST=${3:-false} TRAVIS_DIR=$(cd "$(dirname "$0")" && pwd) REPO_ROOT=$(cd "$TRAVIS_DIR/../../../../.." && pwd) @@ -98,6 +99,11 @@ $TRAVIS_DIR/start-server.sh $SERVER_DIR $BACKEND $JACOCO_PORT || (cat $SERVER_DI # run api-test mvn test -pl hugegraph-server/hugegraph-test -am -P api-test,$BACKEND || (cat $SERVER_DIR/logs/hugegraph-server.log && exit 1) +if [ "$RUN_GREMLIN_CONSOLE_SMOKE_TEST" == "true" ]; then + $TRAVIS_DIR/run-gremlin-console-smoke-test.sh "$SERVER_DIR" || \ + (cat "$SERVER_DIR/logs/hugegraph-server.log" && exit 1) +fi + $TRAVIS_DIR/build-report.sh $BACKEND $JACOCO_PORT $REPORT_FILE # stop server diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh index 335acf25f9..7640a3759a 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh @@ -19,6 +19,7 @@ set -euo pipefail SERVER_DIR=${1:?Usage: run-gremlin-console-smoke-test.sh } SMOKE_MARKER="gremlin-console-smoke-ok" +REMOTE_CONFIG="$SERVER_DIR/conf/remote.yaml" if [ ! -d "$SERVER_DIR" ]; then echo "Server directory does not exist: $SERVER_DIR" @@ -30,8 +31,14 @@ if [ ! -x "$SERVER_DIR/bin/gremlin-console.sh" ]; then exit 1 fi +if [ ! -f "$REMOTE_CONFIG" ]; then + echo "Gremlin Console remote config does not exist: $REMOTE_CONFIG" + exit 1 +fi + TMP_DIR=${TMPDIR:-/tmp} TMP_WORK_DIR=$(mktemp -d "${TMP_DIR}/hugegraph-gremlin-console-smoke.XXXXXX") +SMOKE_REMOTE_CONFIG="${TMP_WORK_DIR}/remote.yaml" SMOKE_SCRIPT="${TMP_WORK_DIR}/smoke.groovy" SMOKE_LOG="${TMP_WORK_DIR}/smoke.log" @@ -40,8 +47,15 @@ cleanup() { } trap cleanup EXIT +cp "$REMOTE_CONFIG" "$SMOKE_REMOTE_CONFIG" +cat >> "$SMOKE_REMOTE_CONFIG" < "$SMOKE_SCRIPT" < def count = g.V().count().next(); if (count < 0L) throw new IllegalStateException("Unexpected vertex count: " + count); "${SMOKE_MARKER}-" + count EOF ( From ab162f80e158f16aa8183e8d2f06ed2c8d4ba6c6 Mon Sep 17 00:00:00 2001 From: contrueCT Date: Sun, 14 Jun 2026 21:04:07 +0800 Subject: [PATCH 05/10] fix(ci): stabilize Gremlin Console smoke test --- .../src/assembly/travis/run-api-test.sh | 2 +- .../travis/run-gremlin-console-smoke-test.sh | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh index 7ed95e753b..a038370ad7 100755 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh @@ -100,7 +100,7 @@ $TRAVIS_DIR/start-server.sh $SERVER_DIR $BACKEND $JACOCO_PORT || (cat $SERVER_DI mvn test -pl hugegraph-server/hugegraph-test -am -P api-test,$BACKEND || (cat $SERVER_DIR/logs/hugegraph-server.log && exit 1) if [ "$RUN_GREMLIN_CONSOLE_SMOKE_TEST" == "true" ]; then - $TRAVIS_DIR/run-gremlin-console-smoke-test.sh "$SERVER_DIR" || \ + bash "$TRAVIS_DIR/run-gremlin-console-smoke-test.sh" "$SERVER_DIR" || \ (cat "$SERVER_DIR/logs/hugegraph-server.log" && exit 1) fi diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh index 7640a3759a..5f8d242a52 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh @@ -38,23 +38,27 @@ fi TMP_DIR=${TMPDIR:-/tmp} TMP_WORK_DIR=$(mktemp -d "${TMP_DIR}/hugegraph-gremlin-console-smoke.XXXXXX") -SMOKE_REMOTE_CONFIG="${TMP_WORK_DIR}/remote.yaml" +REMOTE_CONFIG_BACKUP="${TMP_WORK_DIR}/remote.yaml.orig" SMOKE_SCRIPT="${TMP_WORK_DIR}/smoke.groovy" SMOKE_LOG="${TMP_WORK_DIR}/smoke.log" cleanup() { + if [ -f "$REMOTE_CONFIG_BACKUP" ]; then + cp "$REMOTE_CONFIG_BACKUP" "$REMOTE_CONFIG" + fi rm -rf "$TMP_WORK_DIR" } trap cleanup EXIT -cp "$REMOTE_CONFIG" "$SMOKE_REMOTE_CONFIG" -cat >> "$SMOKE_REMOTE_CONFIG" <> "$REMOTE_CONFIG" < "$SMOKE_SCRIPT" < def count = g.V().count().next(); if (count < 0L) throw new IllegalStateException("Unexpected vertex count: " + count); "${SMOKE_MARKER}-" + count EOF From 825727777f3d87bb05c2164606c99b9b421aa631 Mon Sep 17 00:00:00 2001 From: contrueCT Date: Sun, 14 Jun 2026 21:25:11 +0800 Subject: [PATCH 06/10] fix(ci): use HugeGraph traversal in console smoke --- .../src/assembly/travis/run-gremlin-console-smoke-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh index 5f8d242a52..2a1a7a9e13 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh @@ -59,7 +59,7 @@ EOF cat > "$SMOKE_SCRIPT" < def count = g.V().count().next(); if (count < 0L) throw new IllegalStateException("Unexpected vertex count: " + count); "${SMOKE_MARKER}-" + count +:> def count = hugegraph.traversal().V().count().next(); if (count < 0L) throw new IllegalStateException("Unexpected vertex count: " + count); "${SMOKE_MARKER}-" + count EOF ( From 1d7dab43e6a99728f3853080bd4ec42a3d740ca1 Mon Sep 17 00:00:00 2001 From: contrueCT Date: Sun, 14 Jun 2026 21:50:35 +0800 Subject: [PATCH 07/10] fix(ci): add Gremlin Console traversal alias --- .../src/assembly/travis/run-gremlin-console-smoke-test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh index 2a1a7a9e13..325e99d4c8 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh @@ -55,11 +55,13 @@ cat >> "$REMOTE_CONFIG" < "$SMOKE_SCRIPT" < def count = hugegraph.traversal().V().count().next(); if (count < 0L) throw new IllegalStateException("Unexpected vertex count: " + count); "${SMOKE_MARKER}-" + count +:> def count = g.V().count().next(); if (count < 0L) throw new IllegalStateException("Unexpected vertex count: " + count); "${SMOKE_MARKER}-" + count EOF ( From 5a33dc7643e31413110dc64d4e5b9b896ffa11cd Mon Sep 17 00:00:00 2001 From: contrueCT Date: Sun, 14 Jun 2026 22:14:28 +0800 Subject: [PATCH 08/10] fix(ci): print Gremlin Console smoke result --- .../src/assembly/travis/run-gremlin-console-smoke-test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh index 325e99d4c8..b5a28b8833 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh @@ -62,6 +62,7 @@ EOF cat > "$SMOKE_SCRIPT" < def count = g.V().count().next(); if (count < 0L) throw new IllegalStateException("Unexpected vertex count: " + count); "${SMOKE_MARKER}-" + count +println(result[0].object) EOF ( From dfe06f29dd7d3758229d0abc6ea77768c8a2e125 Mon Sep 17 00:00:00 2001 From: contrueCT Date: Sun, 14 Jun 2026 22:42:00 +0800 Subject: [PATCH 09/10] fix(ci): submit Gremlin Console smoke via driver --- .../travis/run-gremlin-console-smoke-test.sh | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh index b5a28b8833..2856fdfebb 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh @@ -55,14 +55,27 @@ cat >> "$REMOTE_CONFIG" < "$SMOKE_SCRIPT" < def count = g.V().count().next(); if (count < 0L) throw new IllegalStateException("Unexpected vertex count: " + count); "${SMOKE_MARKER}-" + count -println(result[0].object) +import org.apache.tinkerpop.gremlin.driver.Cluster + +def cluster = Cluster.open('conf/remote.yaml') +def client = cluster.connect().alias(['g': '__g_DEFAULT-hugegraph']) +try { + def remoteScript = ''' + def count = g.V().count().next() + if (count < 0L) { + throw new IllegalStateException('Unexpected vertex count: ' + count) + } + '${SMOKE_MARKER}-' + count + ''' + def results = client.submit(remoteScript).all().get() + println(results[0].object) +} finally { + client.close() + cluster.close() +} EOF ( From 3dfde9b67b9323987df2832c80831072488ec668 Mon Sep 17 00:00:00 2001 From: contrueCT Date: Sun, 14 Jun 2026 23:08:31 +0800 Subject: [PATCH 10/10] fix(ci): keep console smoke variables in shell binding --- .../travis/run-gremlin-console-smoke-test.sh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh index 2856fdfebb..c2b693aff5 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh @@ -60,17 +60,14 @@ EOF cat > "$SMOKE_SCRIPT" <