learning_ai_common_plat/scripts/run-registry-tests.sh
2026-03-31 11:37:03 +00:00

39 lines
984 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
readonly BASEDIR="/opt/bytelyst/learning_ai_common_plat"
readonly TOKEN_FILE="${GITEA_NPM_TOKEN_FILE:-$HOME/.gitea_npm_token}"
if [[ -z "${GITEA_NPM_TOKEN:-}" ]]; then
if [[ -f "$TOKEN_FILE" ]]; then
export GITEA_NPM_TOKEN
GITEA_NPM_TOKEN="$(<"$TOKEN_FILE")"
else
echo "Need GITEA_NPM_TOKEN (file $TOKEN_FILE or env)."
exit 1
fi
fi
source "$BASEDIR/scripts/switch-network.sh" >/dev/null
export NETWORK="${NETWORK:-home}"
cd "$BASEDIR"
corepack pnpm install
corepack pnpm test
echo "Verifying HTTP responses..."
for url in \
https://api.bytelyst.com/platform/health \
https://gitea.bytelyst.com/api/packages/ByteLyst/npm/ \
https://ollama.bytelyst.com/api/version \
; do
if curl -sSfI "$url" >/tmp/last-curl.out; then
status=$(head -n1 /tmp/last-curl.out)
echo "$url -> $status"
else
echo "$url -> failed, see /tmp/last-curl.out"
fi
done
echo "Done. pnpm install/test + endpoint verification complete."