feat: expand vehicle data platform capabilities

This commit is contained in:
lingniu
2026-07-27 16:46:15 +08:00
parent e3a1f80f86
commit 3c4bece72c
650 changed files with 62155 additions and 2552 deletions

View File

@@ -0,0 +1,48 @@
#!/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' ;;
*/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'