Skip to content
13 changes: 13 additions & 0 deletions .github/workflows/server-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down Expand Up @@ -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: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/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"

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}
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 -rf "$TMP_WORK_DIR"
}
trap cleanup EXIT

cat > "$SMOKE_SCRIPT" <<EOF
Comment thread
contrueCT marked this conversation as resolved.
def result = 1 + 1
if (result != 2) {
throw new IllegalStateException("Unexpected smoke result: " + result)
}
println("${SMOKE_MARKER}")
EOF

(
cd "$SERVER_DIR"
bin/gremlin-console.sh -- -e "$SMOKE_SCRIPT"
) | tee "$SMOKE_LOG"

grep -q "$SMOKE_MARKER" "$SMOKE_LOG"
Loading