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 0b16b58eb4 Stabilize HTTP E2E compose startup readiness (#6363)
0b16b58eb4 is described below
commit 0b16b58eb4bb1bbfd5e1182468f3fc87538d1c98
Author: aias00 <[email protected]>
AuthorDate: Tue Jun 9 12:08:54 2026 +0800
Stabilize HTTP E2E compose startup readiness (#6363)
* Stabilize HTTP E2E compose startup readiness
The HTTP compose E2E job could continue after docker compose returned from
a transient dependency-health failure, leaving shenyu-bootstrap unavailable and
surfacing the problem later as gateway test failures. The startup script now
performs explicit admin and bootstrap readiness checks, restarts bootstrap
after admin is confirmed, and prints focused compose logs on startup or test
failure. MySQL healthchecks now verify TCP readiness on the same transport
class used by admin JDBC connections.
Constraint: The failing CI log showed shenyu-admin briefly failed JDBC
startup even after the MySQL container healthcheck reported healthy.
Rejected: Only increasing sleep durations | fixed delays keep the race and
make failures slower.
Confidence: medium
Scope-risk: narrow
Directive: Keep E2E startup gated on service readiness rather than fixed
sleeps.
Tested: bash -n on e2e-http-sync-compose.sh and healthcheck.sh; docker
compose config for websocket/http/zookeeper sync compose files; git diff
--check.
Not-tested: Full local E2E run, because Docker image pulls stayed in
pulling state for over six minutes and never reached container startup.
* Remove local progress notes from PR
The progress file was useful during local work but should not be part of
the project diff. Removing it keeps the PR focused on E2E startup readiness
changes only.
Rejected: Keep progress.md for context | PR reviewers should get context
from the PR body and commit history, not workspace-local notes.
Confidence: high
Scope-risk: narrow
Tested: git status
---------
Co-authored-by: xiaoyu <[email protected]>
---
.../compose/sync/shenyu-sync-http.yml | 2 +-
.../compose/sync/shenyu-sync-websocket.yml | 2 +-
.../compose/sync/shenyu-sync-zookeeper.yml | 2 +-
.../compose/script/e2e-http-sync-compose.sh | 73 +++++++++++++++-------
4 files changed, 55 insertions(+), 24 deletions(-)
diff --git a/shenyu-e2e/shenyu-e2e-case/compose/sync/shenyu-sync-http.yml
b/shenyu-e2e/shenyu-e2e-case/compose/sync/shenyu-sync-http.yml
index 6d31e5b979..d3899f5384 100644
--- a/shenyu-e2e/shenyu-e2e-case/compose/sync/shenyu-sync-http.yml
+++ b/shenyu-e2e/shenyu-e2e-case/compose/sync/shenyu-sync-http.yml
@@ -29,7 +29,7 @@ services:
volumes:
-
/tmp/shenyu-e2e/mysql/schema/schema.sql:/docker-entrypoint-initdb.d/schema.sql
healthcheck:
- test: [ "CMD", "mysql", "-u", "root", "-pshenyue2e", "-e", "SELECT 1" ]
+ test: [ "CMD", "mysql", "-h", "127.0.0.1", "-P", "3306", "-u", "root",
"-pshenyue2e", "-e", "SELECT 1" ]
interval: 10s
timeout: 5s
retries: 10
diff --git a/shenyu-e2e/shenyu-e2e-case/compose/sync/shenyu-sync-websocket.yml
b/shenyu-e2e/shenyu-e2e-case/compose/sync/shenyu-sync-websocket.yml
index 6f797f2530..6982c110f7 100644
--- a/shenyu-e2e/shenyu-e2e-case/compose/sync/shenyu-sync-websocket.yml
+++ b/shenyu-e2e/shenyu-e2e-case/compose/sync/shenyu-sync-websocket.yml
@@ -29,7 +29,7 @@ services:
volumes:
-
/tmp/shenyu-e2e/mysql/schema/schema.sql:/docker-entrypoint-initdb.d/schema.sql
healthcheck:
- test: [ "CMD", "mysql", "-u", "root", "-pshenyue2e", "-e", "SELECT 1" ]
+ test: [ "CMD", "mysql", "-h", "127.0.0.1", "-P", "3306", "-u", "root",
"-pshenyue2e", "-e", "SELECT 1" ]
interval: 10s
timeout: 5s
retries: 10
diff --git a/shenyu-e2e/shenyu-e2e-case/compose/sync/shenyu-sync-zookeeper.yml
b/shenyu-e2e/shenyu-e2e-case/compose/sync/shenyu-sync-zookeeper.yml
index 58b8b625fb..5e5c9722e0 100644
--- a/shenyu-e2e/shenyu-e2e-case/compose/sync/shenyu-sync-zookeeper.yml
+++ b/shenyu-e2e/shenyu-e2e-case/compose/sync/shenyu-sync-zookeeper.yml
@@ -51,7 +51,7 @@ services:
volumes:
-
/tmp/shenyu-e2e/mysql/schema/schema.sql:/docker-entrypoint-initdb.d/schema.sql
healthcheck:
- test: [ "CMD", "mysql", "-u", "root", "-pshenyue2e", "-e", "SELECT 1" ]
+ test: [ "CMD", "mysql", "-h", "127.0.0.1", "-P", "3306", "-u", "root",
"-pshenyue2e", "-e", "SELECT 1" ]
interval: 10s
timeout: 5s
retries: 10
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-http/compose/script/e2e-http-sync-compose.sh
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-http/compose/script/e2e-http-sync-compose.sh
index daf35da41f..790884fdf9 100644
---
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-http/compose/script/e2e-http-sync-compose.sh
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-http/compose/script/e2e-http-sync-compose.sh
@@ -16,6 +16,8 @@
# limitations under the License.
#
+set -euo pipefail
+
# init kubernetes for mysql
SHENYU_TESTCASE_DIR=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")")
bash "${SHENYU_TESTCASE_DIR}"/k8s/script/storage/storage_init_mysql.sh
@@ -23,40 +25,69 @@ bash
"${SHENYU_TESTCASE_DIR}"/k8s/script/storage/storage_init_mysql.sh
# init register center
CUR_PATH=$(readlink -f "$(dirname "$0")")
PRGDIR=$(dirname "$CUR_PATH")
+HEALTHCHECK_SCRIPT="${SHENYU_TESTCASE_DIR}/k8s/script/healthcheck.sh"
+
+log_compose() {
+ local sync=$1
+ local
sync_compose_file="${SHENYU_TESTCASE_DIR}/compose/sync/shenyu-sync-${sync}.yml"
+
+ echo "------------------"
+ echo "shenyu-admin log:"
+ echo "------------------"
+ docker compose -f "$sync_compose_file" logs shenyu-admin || true
+ echo "shenyu-bootstrap log:"
+ echo "------------------"
+ docker compose -f "$sync_compose_file" logs shenyu-bootstrap || true
+ echo "shenyu-examples-http log:"
+ echo "------------------"
+ docker compose -f "${PRGDIR}"/shenyu-examples-http-compose.yml logs
shenyu-examples-http || true
+}
+
+start_sync_compose() {
+ local sync=$1
+ local
sync_compose_file="${SHENYU_TESTCASE_DIR}/compose/sync/shenyu-sync-${sync}.yml"
+
+ if ! docker compose -f "$sync_compose_file" up -d --quiet-pull; then
+ echo "docker compose returned before all services became healthy;
continuing with explicit readiness checks"
+ docker compose -f "$sync_compose_file" ps || true
+ fi
+
+ sh "$HEALTHCHECK_SCRIPT" http://localhost:31095/actuator/health
+ docker compose -f "$sync_compose_file" up -d --quiet-pull shenyu-bootstrap
+ sh "$HEALTHCHECK_SCRIPT" http://localhost:31195/actuator/health
+}
+
+start_examples() {
+ docker compose -f "${PRGDIR}"/shenyu-examples-http-compose.yml up -d
--quiet-pull
+ sh "$HEALTHCHECK_SCRIPT" http://localhost:31189/actuator/health
+}
+
# init shenyu sync
SYNC_ARRAY=("websocket" "http" "zookeeper")
#SYNC_ARRAY=("websocket" "nacos")
#MIDDLEWARE_SYNC_ARRAY=("zookeeper" "etcd" "nacos")
-docker network create -d bridge shenyu
+docker network create -d bridge shenyu || true
for sync in "${SYNC_ARRAY[@]}"; do
echo -e "------------------\n"
echo "[Start ${sync} synchronous] create shenyu-admin-${sync}.yml
shenyu-bootstrap-${sync}.yml "
- docker compose -f
"$SHENYU_TESTCASE_DIR"/compose/sync/shenyu-sync-"${sync}".yml up -d --quiet-pull
- sleep 30s
- sh "$SHENYU_TESTCASE_DIR"/k8s/script/healthcheck.sh
http://localhost:31095/actuator/health
- sh "$SHENYU_TESTCASE_DIR"/k8s/script/healthcheck.sh
http://localhost:31195/actuator/health
- docker compose -f "${PRGDIR}"/shenyu-examples-http-compose.yml up -d
--quiet-pull
- sleep 30s
- sh "$SHENYU_TESTCASE_DIR"/k8s/script/healthcheck.sh
http://localhost:31189/actuator/health
+ if ! start_sync_compose "$sync"; then
+ echo "${sync}-sync-compose startup failed"
+ log_compose "$sync"
+ exit 1
+ fi
+ if ! start_examples; then
+ echo "shenyu-examples-http startup failed"
+ log_compose "$sync"
+ exit 1
+ fi
sleep 10s
docker ps -a
## run e2e-test
- ./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-http
-am test
- # shellcheck disable=SC2181
- if (($?)); then
+ if ! ./mvnw -B -f ./shenyu-e2e/pom.xml -pl
shenyu-e2e-case/shenyu-e2e-case-http -am test; then
echo "${sync}-sync-e2e-test failed"
- echo "------------------"
- echo "shenyu-admin log:"
- echo "------------------"
- docker compose -f
"$SHENYU_TESTCASE_DIR"/compose/sync/shenyu-sync-"${sync}".yml logs shenyu-admin
- echo "shenyu-bootstrap log:"
- echo "------------------"
- docker compose -f
"$SHENYU_TESTCASE_DIR"/compose/sync/shenyu-sync-"${sync}".yml logs
shenyu-bootstrap
- echo "shenyu-examples-http log:"
- echo "------------------"
- docker compose -f "${PRGDIR}"/shenyu-examples-http-compose.yml logs
shenyu-examples-http
+ log_compose "$sync"
exit 1
fi
docker compose -f
"$SHENYU_TESTCASE_DIR"/compose/sync/shenyu-sync-"${sync}".yml down