test(git): E2E-Skripte gegen Gitea/beliebiges Remote, Doku zu Abweichungen
CI / App (npm ci + Build, ESLint, Stylelint, Jest) (pull_request) Successful in 1m48s
CI / Storage (mongo) (pull_request) Successful in 1m10s
CI / Storage (postgres) (pull_request) Successful in 1m8s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
dev-bot BotandClaude Sonnet 5.5 committed 2026-11-25 14:42:06 +00:00
1 parent e40b4d1499
commit e8d6e215e8
3 files changed
+142 -1

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Startet eine Wegwerf-Gitea-Instanz (Docker, SQLite), legt Benutzer, Token und Repo an und führt
# scripts/git-e2e.mjs dagegen aus. Container wird am Ende gestoppt. Nur Dev-Zugangsdaten.
set -euo pipefail
cd "$(dirname "$0")/.."
NAME=hb-e2e-gitea
PORT=${GITEA_E2E_PORT:-3300}
IMAGE=${GITEA_IMAGE:-gitea/gitea:1.24}
PASS="e2e-$(openssl rand -hex 8)"
cleanup() { docker rm -f "$NAME" >/dev/null 2>&1 || true; }
trap cleanup EXIT
cleanup
docker run -d --name "$NAME" --memory 400m -p "127.0.0.1:${PORT}:3000" \
-e GITEA__database__DB_TYPE=sqlite3 -e GITEA__security__INSTALL_LOCK=true \
-e GITEA__server__ROOT_URL="http://127.0.0.1:${PORT}/" -e GITEA__service__DISABLE_REGISTRATION=true "$IMAGE" >/dev/null
for _ in $(seq 1 60); do curl -fs "http://127.0.0.1:${PORT}/api/healthz" >/dev/null && break; sleep 2; done
docker exec -u git "$NAME" gitea admin user create --admin --username tester --password "$PASS" --email tester@example.test --must-change-password=false >/dev/null
TOKEN=$(curl -fs -u "tester:$PASS" -H 'Content-Type: application/json' -X POST "http://127.0.0.1:${PORT}/api/v1/users/tester/tokens" \
-d '{"name":"e2e","scopes":["write:repository","write:user"]}' | sed -n 's/.*"sha1":"\([^"]*\)".*/\1/p')
curl -fs -u "tester:$PASS" -H 'Content-Type: application/json' -X POST "http://127.0.0.1:${PORT}/api/v1/user/repos" -d '{"name":"hb-e2e"}' >/dev/null
GIT_E2E_URL="http://127.0.0.1:${PORT}/tester/hb-e2e.git" GIT_E2E_USER=tester GIT_E2E_TOKEN="$TOKEN" \
GIT_E2E_ALLOW_HTTP=true GIT_E2E_ALLOW_PRIVATE=true node scripts/git-e2e.mjs