diff --git a/.github/workflows/server-ci.yml b/.github/workflows/server-ci.yml index 266e70feb1..4593857423 100644 --- a/.github/workflows/server-ci.yml +++ b/.github/workflows/server-ci.yml @@ -80,7 +80,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 @@ -154,7 +158,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 2edeb9ce6c..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 @@ -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 0000000000..c2b693aff5 --- /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 } +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" < "$SMOKE_SCRIPT" <