From a660b01efa769d678a098d17c89d139c46582f9a Mon Sep 17 00:00:00 2001 From: Lemon-miaow Date: Fri, 25 Sep 2026 02:15:11 +0800 Subject: [PATCH] =?UTF-8?q?ci(e2e):=20=E4=BB=A3=E7=90=86=E7=8A=B6=E6=80=81?= =?UTF-8?q?=20ping=20=E7=AD=89=E5=BE=85=20Velocity=20=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=EF=BC=8C=E6=97=A7=20release=20=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E6=A3=80=E6=9F=A5=E8=B7=B3=E8=BF=87=E5=85=B6=E5=90=8E?= =?UTF-8?q?=E6=89=8D=E6=9C=89=E7=9A=84=20timer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/e2e.yml | 2 +- deploy/e2e_check.sh | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index df45ab9..596afc0 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -125,7 +125,7 @@ jobs: - name: Check the release install if: steps.release.outputs.tag != '' - run: sudo bash deploy/e2e_check.sh install + run: sudo bash deploy/e2e_check.sh release - name: Upgrade to this commit if: steps.release.outputs.tag != '' diff --git a/deploy/e2e_check.sh b/deploy/e2e_check.sh index f40395a..80fd8bf 100644 --- a/deploy/e2e_check.sh +++ b/deploy/e2e_check.sh @@ -4,6 +4,7 @@ # # sudo bash deploy/e2e_check.sh install # after the first run # sudo bash deploy/e2e_check.sh rerun # after the same commit ran again +# sudo bash deploy/e2e_check.sh release # after the newest release installed # sudo bash deploy/e2e_check.sh upgrade # after this commit ran over a release # # It asks what an operator's first minutes ask: the binary runs, the control plane is @@ -12,7 +13,7 @@ # (it restarts only when what it runs changed) and keep every earlier answer. set -euo pipefail -phase="${1:?usage: e2e_check.sh install|rerun|upgrade}" +phase="${1:?usage: e2e_check.sh install|rerun|release|upgrade}" export KUBECONFIG=/etc/rancher/k3s/k3s.yaml KUBECTL=(/usr/local/bin/k3s kubectl) PID_FILE=/var/tmp/felis-e2e-velocity.pid @@ -43,9 +44,12 @@ check "felis-api is ready (database and cluster reachable)" \ for unit in k3s postgresql felis-velocity; do check "${unit} is active" systemctl is-active --quiet "$unit" done -for timer in felis-db-backup.timer felis-watchdog.timer; do - check "${timer} is scheduled" systemctl is-enabled --quiet "$timer" -done +# A release may predate a timer; what this commit installs has them all. +if [ "$phase" != release ]; then + for timer in felis-db-backup.timer felis-watchdog.timer; do + check "${timer} is scheduled" systemctl is-enabled --quiet "$timer" + done +fi # A status ping is the proxy's own answer (ping passthrough is off), so it proves the JRE, # Velocity and its config without a login gate or a Mojang account. @@ -90,6 +94,14 @@ while len(data) < size: print(json.loads(data)["version"]["name"]) EOF } +# The installer returns once the unit is started; the JVM binds the port a few +# seconds later. +for _ in $(seq 30); do + if version="$(ping_proxy 2>&1)"; then + break + fi + sleep 2 +done if version="$(ping_proxy 2>&1)"; then pass "the proxy answers a status ping (${version})" else @@ -98,7 +110,7 @@ fi pid="$(systemctl show -p MainPID --value felis-velocity)" case "$phase" in - install) printf '%s\n' "$pid" > "$PID_FILE" ;; + install | release) printf '%s\n' "$pid" > "$PID_FILE" ;; rerun) if [ "$pid" = "$(cat "$PID_FILE" 2>/dev/null)" ]; then pass "the rerun left the proxy running (pid ${pid})"