fix(installer): harden release asset resolution (#1258)

Co-authored-by: Jwalin Shah <jshah1331@gmail.com>
This commit is contained in:
Jwalin Shah
2026-05-05 16:38:22 -07:00
committed by GitHub
co-authored by Jwalin Shah
parent c4d93f6981
commit 073c46d3c6
3 changed files with 140 additions and 18 deletions
+33
View File
@@ -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"