mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 21:08:00 +00:00
fix(installer): harden release asset resolution (#1258)
Co-authored-by: Jwalin Shah <jshah1331@gmail.com>
This commit is contained in:
co-authored by
Jwalin Shah
parent
c4d93f6981
commit
073c46d3c6
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# scripts/test_install.sh — smoke-tests the install.sh resolver in isolation.
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
|
||||
# Use a fixture latest.json that mirrors what the real release publishes.
|
||||
FIXTURE="$REPO_ROOT/scripts/fixtures/latest.json"
|
||||
|
||||
# The resolver function should be sourced, not invoked end-to-end (no curl).
|
||||
if ! source "$REPO_ROOT/scripts/install.sh" --source-only 2>/dev/null; then
|
||||
echo "FAIL: scripts/install.sh does not support --source-only mode"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
resolved=$(resolve_asset_url "$FIXTURE" "linux" "x86_64")
|
||||
expected="https://example.invalid/openhuman_0.0.0-test_amd64.AppImage"
|
||||
if [[ "$resolved" != "$expected" ]]; then
|
||||
echo "FAIL: expected $expected, got $resolved"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Also test a missing platform produces exit code 3.
|
||||
set +e
|
||||
resolve_asset_url "$FIXTURE" "linux" "aarch64" >/dev/null 2>&1
|
||||
missing_platform_rc=$?
|
||||
set -e
|
||||
if [[ "$missing_platform_rc" -ne 3 ]]; then
|
||||
echo "FAIL: expected exit code 3 for missing platform linux-aarch64, got $missing_platform_rc"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "PASS"
|
||||
Reference in New Issue
Block a user