This is an automated email from the ASF dual-hosted git repository.
Aias00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 213314f1f5 fix(e2e): resolve storage healthcheck paths and stop on
failures (#7240)
213314f1f5 is described below
commit 213314f1f5db7504aaac6205b2a342d80b6ebef5
Author: Liming Deng <[email protected]>
AuthorDate: Thu Oct 1 12:18:29 2026 +0800
fix(e2e): resolve storage healthcheck paths and stop on failures (#7240)
---
.github/workflows/ci.yml | 2 +
.../compose/script/compose-script-test.sh | 79 ++++++++++++++++++++++
.../compose/script/e2e-h2-compose.sh | 4 +-
.../compose/script/e2e-mysql-compose.sh | 4 +-
.../compose/script/e2e-opengauss-compose.sh | 4 +-
.../compose/script/e2e-postgres-compose.sh | 4 +-
.../compose/script/e2e-storage-compose.sh | 4 +-
.../k8s/script/services-opengauss.list | 20 ++++++
8 files changed, 116 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2c1db1990b..21e43284f0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -70,6 +70,8 @@ jobs:
- uses: actions/checkout@v3
- name: Test CI case resolver
run: bash .github/scripts/resolve-test-case-matrix-test.sh
+ - name: Test storage Compose healthchecks
+ run: bash
shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/compose-script-test.sh
- uses: ./actions/paths-filter
id: filter
with:
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/compose-script-test.sh
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/compose-script-test.sh
new file mode 100644
index 0000000000..16f753993e
--- /dev/null
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/compose-script-test.sh
@@ -0,0 +1,79 @@
+#!/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
+
+SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
+TEST_TMP=$(mktemp -d)
+trap 'rm -f "$TEST_TMP/mvnw" "$TEST_TMP/trace"; rmdir "$TEST_TMP"' EXIT
+export RUN_TRACE="$TEST_TMP/trace"
+printf '#!/bin/bash\necho maven >> "$RUN_TRACE"\n' > "$TEST_TMP/mvnw"
+chmod +x "$TEST_TMP/mvnw"
+cd "$TEST_TMP"
+
+sleep() { :; }
+docker() { return "${DOCKER_EXIT:-0}"; }
+bash() {
+ case "$1" in
+ */storage_init_*.sh) return "${INIT_EXIT:-0}" ;;
+ */healthcheck.sh)
+ test -f "$1" || return 99
+ test -f "$(dirname "$1")/services-$2.list" || return 98
+ printf 'health:%s\n' "$2" >> "$RUN_TRACE"
+ return "${HEALTH_EXIT:-0}"
+ ;;
+ *) command bash "$@" ;;
+ esac
+}
+export -f sleep docker bash
+
+for storage in h2 mysql postgres opengauss storage; do
+ script="$SCRIPT_DIR/e2e-$storage-compose.sh"
+ command bash -n "$script"
+ : > "$RUN_TRACE"
+ command bash "$script" > /dev/null
+ expected=1
+ if [ "$storage" = storage ]; then expected=4; fi
+ test "$(grep -c '^maven$' "$RUN_TRACE")" -eq "$expected"
+ if [ "$storage" != storage ]; then
+ grep -qx "health:$storage" "$RUN_TRACE"
+ fi
+
+ : > "$RUN_TRACE"
+ if HEALTH_EXIT=1 command bash "$script" > /dev/null 2>&1; then
+ echo "$storage continued after a failed healthcheck" >&2
+ exit 1
+ fi
+ if grep -q '^maven$' "$RUN_TRACE"; then exit 1; fi
+
+ : > "$RUN_TRACE"
+ if DOCKER_EXIT=1 command bash "$script" > /dev/null 2>&1; then
+ echo "$storage continued after a failed Compose command" >&2
+ exit 1
+ fi
+ test ! -s "$RUN_TRACE"
+
+ if [ "$storage" != h2 ] && [ "$storage" != storage ]; then
+ if INIT_EXIT=1 command bash "$script" > /dev/null 2>&1; then
+ echo "$storage continued after a failed storage initialization" >&2
+ exit 1
+ fi
+ fi
+done
+echo "All five Compose runners resolve their healthcheck and stop on failures."
+
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-h2-compose.sh
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-h2-compose.sh
index 6aabed43b1..eafc0c627b 100644
---
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-h2-compose.sh
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-h2-compose.sh
@@ -18,9 +18,10 @@
set -euo pipefail
-# init kubernetes for h2
+# Initialize the h2 storage Compose deployment.
SHENYU_TESTCASE_DIR=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")")
curPath=$(readlink -f "$(dirname "$0")")
+HEALTHCHECK_SCRIPT="${curPath}/../../k8s/script/healthcheck.sh"
PRGDIR=$(dirname "$curPath")
COMPOSE_FILE="$SHENYU_TESTCASE_DIR/compose/storage/shenyu-storage-h2.yml"
@@ -39,6 +40,7 @@ if ! docker compose -f "$COMPOSE_FILE" up -d --quiet-pull
--wait --wait-timeout
dump_logs
exit 1
fi
+bash "$HEALTHCHECK_SCRIPT" h2 http://localhost:31095/actuator/health
http://localhost:31195/actuator/health
## run e2e-test
if ! ./mvnw -B -f ./shenyu-e2e/pom.xml -pl
shenyu-e2e-case/shenyu-e2e-case-storage -am test; then
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-mysql-compose.sh
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-mysql-compose.sh
index c1f95f9526..5e9d117d8c 100644
---
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-mysql-compose.sh
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-mysql-compose.sh
@@ -18,10 +18,11 @@
set -euo pipefail
-# init kubernetes for h2
+# Initialize the mysql storage Compose deployment.
SHENYU_TESTCASE_DIR=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")")
bash "${SHENYU_TESTCASE_DIR}"/k8s/script/storage/storage_init_mysql.sh
curPath=$(readlink -f "$(dirname "$0")")
+HEALTHCHECK_SCRIPT="${curPath}/../../k8s/script/healthcheck.sh"
PRGDIR=$(dirname "$curPath")
COMPOSE_FILE="$SHENYU_TESTCASE_DIR/compose/storage/shenyu-storage-mysql.yml"
@@ -43,6 +44,7 @@ if ! docker compose -f "$COMPOSE_FILE" up -d --quiet-pull
--wait --wait-timeout
dump_logs
exit 1
fi
+bash "$HEALTHCHECK_SCRIPT" mysql http://localhost:31095/actuator/health
http://localhost:31195/actuator/health
## run e2e-test
if ! ./mvnw -B -f ./shenyu-e2e/pom.xml -pl
shenyu-e2e-case/shenyu-e2e-case-storage -am test; then
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-opengauss-compose.sh
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-opengauss-compose.sh
index 32d9c1a9ca..50ea22de2f 100644
---
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-opengauss-compose.sh
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-opengauss-compose.sh
@@ -18,10 +18,11 @@
set -euo pipefail
-# init kubernetes for h2
+# Initialize the opengauss storage Compose deployment.
SHENYU_TESTCASE_DIR=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")")
bash "${SHENYU_TESTCASE_DIR}"/k8s/script/storage/storage_init_opengauss.sh
curPath=$(readlink -f "$(dirname "$0")")
+HEALTHCHECK_SCRIPT="${curPath}/../../k8s/script/healthcheck.sh"
PRGDIR=$(dirname "$curPath")
COMPOSE_FILE="$SHENYU_TESTCASE_DIR/compose/storage/shenyu-storage-opengauss.yml"
@@ -44,6 +45,7 @@ if ! docker compose -f "$COMPOSE_FILE" up -d --quiet-pull
--wait --wait-timeout
dump_logs
exit 1
fi
+bash "$HEALTHCHECK_SCRIPT" opengauss http://localhost:31095/actuator/health
http://localhost:31195/actuator/health
## run e2e-test
if ! ./mvnw -B -f ./shenyu-e2e/pom.xml -pl
shenyu-e2e-case/shenyu-e2e-case-storage -am test; then
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-postgres-compose.sh
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-postgres-compose.sh
index a5fbdb49c9..ea2825420f 100644
---
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-postgres-compose.sh
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-postgres-compose.sh
@@ -18,10 +18,11 @@
set -euo pipefail
-# init kubernetes for h2
+# Initialize the postgres storage Compose deployment.
SHENYU_TESTCASE_DIR=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")")
bash "${SHENYU_TESTCASE_DIR}"/k8s/script/storage/storage_init_postgres.sh
curPath=$(readlink -f "$(dirname "$0")")
+HEALTHCHECK_SCRIPT="${curPath}/../../k8s/script/healthcheck.sh"
PRGDIR=$(dirname "$curPath")
COMPOSE_FILE="$SHENYU_TESTCASE_DIR/compose/storage/shenyu-storage-postgres.yml"
@@ -43,6 +44,7 @@ if ! docker compose -f "$COMPOSE_FILE" up -d --quiet-pull
--wait --wait-timeout
dump_logs
exit 1
fi
+bash "$HEALTHCHECK_SCRIPT" postgres http://localhost:31095/actuator/health
http://localhost:31195/actuator/health
## run e2e-test
if ! ./mvnw -B -f ./shenyu-e2e/pom.xml -pl
shenyu-e2e-case/shenyu-e2e-case-storage -am test; then
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-storage-compose.sh
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-storage-compose.sh
index 517a4f7736..147a242045 100644
---
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-storage-compose.sh
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/compose/script/e2e-storage-compose.sh
@@ -18,9 +18,10 @@
set -euo pipefail
-# init kubernetes for h2
+# Initialize each storage Compose deployment.
SHENYU_TESTCASE_DIR=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")")
curPath=$(readlink -f "$(dirname "$0")")
+HEALTHCHECK_SCRIPT="${curPath}/../../k8s/script/healthcheck.sh"
PRGDIR=$(dirname "$curPath")
docker network create -d bridge shenyu || true
@@ -49,6 +50,7 @@ for storage in "${STORAGE_ARRAY[@]}"; do
dump_logs
exit 1
fi
+ bash "$HEALTHCHECK_SCRIPT" "${storage}"
http://localhost:31095/actuator/health http://localhost:31195/actuator/health
## run e2e-test
if ! ./mvnw -B -f ./shenyu-e2e/pom.xml -pl
shenyu-e2e-case/shenyu-e2e-case-storage -am test; then
dump_logs
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/k8s/script/services-opengauss.list
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/k8s/script/services-opengauss.list
new file mode 100644
index 0000000000..e70fc5ecf4
--- /dev/null
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-storage/k8s/script/services-opengauss.list
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+http://localhost:31095/actuator/health
+http://localhost:31195/actuator/health
+