veza/tmt/tests/backend/unit.sh
senke a3f4ac6b70 fix: sync E2E tests with seed data + i18n fix
- Update E2E test credentials to match actual seed users
  (user@veza.music, artist@veza.music, admin@veza.music, mod@veza.music)
- Fix hardcoded "Suggested Accounts" in SuggestionsWidget with i18n key
- Replace hardcoded amelie_dubois references with CONFIG.users.creator
- Refactor auth, player, upload E2E tests for reliability
- Add tmt test plans and scripts for CI integration
- Simplify CI workflow

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 19:42:03 +02:00

30 lines
831 B
Bash
Executable file

#!/bin/bash
set -e
# CONTRACT: GOMAXPROCS=1 (Frugality Manifesto)
COVERAGE_THRESHOLD=60
REPO_ROOT=$(git rev-parse --show-toplevel)
BACKEND_DIR="$REPO_ROOT/veza-backend-api"
echo "Backend Unit Tests (Low Power Mode)"
cd "$BACKEND_DIR"
export GOMAXPROCS=1
echo "Constraint: GOMAXPROCS=1"
echo "Running Unit Tests with coverage..."
go test ./internal/handlers/... ./internal/services/... -short -coverprofile=coverage.out -covermode=atomic
COVERAGE=$(go tool cover -func=coverage.out | tail -1 | awk '{print $3}' | tr -d '%')
echo "Coverage: ${COVERAGE}%"
if awk -v c="$COVERAGE" -v t="$COVERAGE_THRESHOLD" 'BEGIN {exit !(c+0>=t)}'; then
echo "Coverage gate passed (>= ${COVERAGE_THRESHOLD}%)"
else
echo "FATAL: Coverage ${COVERAGE}% is below threshold ${COVERAGE_THRESHOLD}%"
exit 1
fi
echo "Unit tests passed."