feat: add signed PostgreSQL release updates

This commit is contained in:
Qiufeng
2026-08-03 23:45:32 +08:00
parent 2524a37a07
commit f6e22cb670
99 changed files with 44671 additions and 284 deletions
+47
View File
@@ -110,6 +110,51 @@ test_main_runs_steps_in_order() (
[ "$(tr '\n' ' ' < "$events")" = 'preflight backend ngrok public open monitor ' ]
)
test_postgres_profile_is_forwarded_to_backend() (
local tmp="${TMPDIR:-/tmp}/run-command-postgres-$$"
mkdir -p "$tmp/backend" "$tmp/log"
trap 'rm -rf "$tmp"' EXIT
: > "$tmp/backend/app.jar"
printf '%s\n' \
'#!/bin/bash' \
'if [ "${1:-}" = "-version" ]; then printf '\''openjdk version "17.0.12"\n'\'' >&2; exit 0; fi' \
'printf '\''%s\n'\'' "$@" > "$MOCK_JAVA_ARGS"' > "$tmp/java"
chmod +x "$tmp/java"
export MOCK_JAVA_ARGS="$tmp/args"
ERP_RUN_BACKEND_DIR="$tmp/backend" ERP_RUN_JAVA_BIN="$tmp/java" \
ERP_RUN_JAR_PATH="$tmp/backend/app.jar" ERP_RUN_LOG_DIR="$tmp/log" \
ERP_RUN_PROFILE=postgres source "$SCRIPT"
start_backend
wait "$BACKEND_PID"
grep -Fqx -- '--spring.profiles.active=postgres' "$tmp/args"
grep -Fqx -- '--server.port=8091' "$tmp/args"
)
test_ngrok_uses_configured_endpoint_and_api_port() (
source "$SCRIPT"
local tmp="${TMPDIR:-/tmp}/run-command-ngrok-config-$$"
mkdir -p "$tmp"
trap 'rm -rf "$tmp"' EXIT
printf '%s\n' \
'#!/bin/bash' \
'printf '\''%s\n'\'' "$@" > "$MOCK_NGROK_ARGS"' > "$tmp/ngrok"
chmod +x "$tmp/ngrok"
printf 'version: "3"\n' > "$tmp/base.yml"
export MOCK_NGROK_ARGS="$tmp/args"
NGROK_BIN="$tmp/ngrok"
NGROK_BASE_CONFIG="$tmp/base.yml"
NGROK_RUNTIME_CONFIG="$tmp/runtime.yml"
NGROK_LOG="$tmp/ngrok.log"
NGROK_API_PORT=4141
BACKEND_PORT=8191
PUBLIC_URL=https://example.ngrok.app
start_ngrok
wait "$NGROK_PID"
grep -Fqx -- '--url=https://example.ngrok.app' "$tmp/args" || return 1
grep -Fqx -- '8191' "$tmp/args" || return 1
grep -Fq -- ' web_addr: "127.0.0.1:4141"' "$tmp/runtime.yml"
)
run_test 'resolves project root when sourced elsewhere' test_resolves_root_when_sourced_elsewhere
run_test 'reuses a healthy backend' test_reuses_healthy_backend
run_test 'rejects a foreign 8091 listener without killing it' test_rejects_unhealthy_port_without_killing_owner
@@ -117,5 +162,7 @@ run_test 'cleanup stops owned PID only' test_cleanup_stops_owned_pid_only
run_test 'reuses a healthy ngrok tunnel' test_reuses_healthy_ngrok
run_test 'no-open mode skips browser launch' test_no_open_mode_skips_browser
run_test 'main orchestrates steps in order' test_main_runs_steps_in_order
run_test 'PostgreSQL profile is forwarded to the backend' test_postgres_profile_is_forwarded_to_backend
run_test 'ngrok uses the configured endpoint and API port' test_ngrok_uses_configured_endpoint_and_api_port
printf 'RESULT pass=%s fail=%s\n' "$PASS" "$FAIL"
[ "$FAIL" -eq 0 ]