This is an automated email from the ASF dual-hosted git repository.

imbajin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hugegraph.git


The following commit(s) were added to refs/heads/master by this push:
     new 86e0a66fd chore(ci): add gremlin-console smoke test (#3040)
86e0a66fd is described below

commit 86e0a66fd971d6b5a2f49bfdc1b187dded0c5e6b
Author: contrueCT <[email protected]>
AuthorDate: Tue Jun 23 19:44:53 2026 +0800

    chore(ci): add gremlin-console smoke test (#3040)
---
 .github/workflows/server-ci.yml                    |  8 ++-
 .../src/assembly/travis/run-api-test.sh            |  6 ++
 .../travis/run-gremlin-console-smoke-test.sh       | 83 ++++++++++++++++++++++
 3 files changed, 95 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/server-ci.yml b/.github/workflows/server-ci.yml
index 2eb313c97..586e36da4 100644
--- a/.github/workflows/server-ci.yml
+++ b/.github/workflows/server-ci.yml
@@ -106,7 +106,11 @@ jobs:
 
       - name: Run api test
         run: |
-          $TRAVIS_DIR/run-api-test.sh $BACKEND $REPORT_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
@@ -180,7 +184,7 @@ jobs:
 
       - name: Run RocksDB API test
         run: |
-          $TRAVIS_DIR/run-api-test.sh $BACKEND $REPORT_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 2edeb9ce6..a038370ad 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
+    bash "$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
new file mode 100644
index 000000000..c2b693aff
--- /dev/null
+++ 
b/hugegraph-server/hugegraph-dist/src/assembly/travis/run-gremlin-console-smoke-test.sh
@@ -0,0 +1,83 @@
+#!/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 <server-dir>}
+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"
+    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
+
+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")
+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" "$REMOTE_CONFIG_BACKUP"
+cat >> "$REMOTE_CONFIG" <<EOF
+
+username: admin
+password: pa
+EOF
+
+cat > "$SMOKE_SCRIPT" <<EOF
+import org.apache.tinkerpop.gremlin.driver.Cluster
+
+cluster = Cluster.open('conf/remote.yaml')
+client = cluster.connect().alias(['g': '__g_DEFAULT-hugegraph'])
+try {
+    remoteScript = "def count = g.V().count().next(); " +
+                   "if (count < 0L) " +
+                   "throw new IllegalStateException('Unexpected vertex count: 
' + count); " +
+                   "'${SMOKE_MARKER}-' + count"
+    results = client.submit(remoteScript).all().get()
+    println(results[0].object)
+} finally {
+    client.close()
+    cluster.close()
+}
+EOF
+
+(
+    cd "$SERVER_DIR"
+    bin/gremlin-console.sh -- -e "$SMOKE_SCRIPT"
+) | tee "$SMOKE_LOG"
+
+grep -q "$SMOKE_MARKER" "$SMOKE_LOG"

Reply via email to