Files
lingniu-vehicle-ingest/vehicle-data-platform/deploy/install-open-platform-release.test.sh
T
lingniu d6b957dfc8 feat: sync vehicle monitoring and accumulated platform updates
Add monitoring metrics, numeric sorting, report-time display, vehicle number labels, and map layout fixes. Include accumulated mileage, hydrogen, OneOS authentication, open platform, ingestion, deployment, and UI updates.

Exclude temporary files, generated reports, and credentials. Validate frontend 632 tests and production build, API packages, vehicle-map tests, and release installer tests. Gateway suite has one pre-existing date-sensitive identity throttling test failure reproduced on the parent commit.
2026-10-26 18:05:59 +08:00

52 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
FIXTURE=$(mktemp -d)
trap 'rm -rf "$FIXTURE"' EXIT
ROOT="$FIXTURE/root"
mkdir -p "$FIXTURE/web" "$FIXTURE/bin" "$ROOT/env"
printf '<!doctype html><div id="root"></div>\n' > "$FIXTURE/web/index.html"
printf 'binary\n' > "$FIXTURE/open-platform-api"
tar -C "$FIXTURE/web" -czf "$FIXTURE/web.tar.gz" .
cat > "$ROOT/env/open-platform.env" <<'EOF'
OPEN_PLATFORM_HTTP_ADDR=:20310
EOF
cat > "$FIXTURE/bin/systemctl" <<'EOF'
#!/usr/bin/env bash
set -e
case "$1" in
restart|stop) exit 0 ;;
is-active) exit 0 ;;
esac
EOF
cat > "$FIXTURE/bin/curl" <<'EOF'
#!/usr/bin/env bash
set -e
url=${@: -1}
case "$url" in
*/healthz) printf '{"status":"ok"}\n' ;;
*/open-api/openapi.yaml)
printf 'openapi: 3.0.3\n'
python3 -c 'import sys; sys.stdout.write("schema-padding: " + "x" * 150000 + "\n")'
;;
*/portal-api/catalog) printf '{"data":[{"code":"daily_hydrogen"}]}\n' ;;
*) printf '<div id="root"></div>\n' ;;
esac
EOF
chmod +x "$FIXTURE/bin/systemctl" "$FIXTURE/bin/curl"
OPEN_PLATFORM_ROOT="$ROOT" \
SYSTEMCTL_BIN="$FIXTURE/bin/systemctl" \
CURL_BIN="$FIXTURE/bin/curl" \
"$SCRIPT_DIR/install-open-platform-release.sh" release-1 "$FIXTURE/web.tar.gz" "$FIXTURE/open-platform-api"
test "$(readlink "$ROOT/current")" = "$ROOT/releases/release-1"
test -x "$ROOT/current/open-platform-api"
test -f "$ROOT/current/web/index.html"
grep -q '^OPEN_PLATFORM_RELEASE=release-1$' "$ROOT/env/open-platform.env"
printf 'install_open_platform_release_test=ok\n'