feat: expand vehicle data platform capabilities
This commit is contained in:
48
vehicle-data-platform/deploy/install-open-platform-release.test.sh
Executable file
48
vehicle-data-platform/deploy/install-open-platform-release.test.sh
Executable 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'
|
||||
Reference in New Issue
Block a user