6224ef5980
- Implemented a new Growth page to track practice time and trends. - Added API integration for fetching review data. - Created components for displaying practice statistics and trends. - Updated navigation titles for the main index and growth pages. - Removed unused styles from the index page. - Introduced a Projects management page for adding and editing practice projects. - Developed a Record form for logging practice sessions with validation. - Added utility functions for date manipulation and duration formatting. - Implemented error handling and session management in the practice service. - Created unit tests for the practice service to ensure reliability.
28 lines
1.2 KiB
Bash
Executable File
28 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
backend_dir=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
cd "$backend_dir"
|
|
|
|
# A supplied test database must permit isolated CREATE SCHEMA. Tests never use
|
|
# PG* application settings or touch existing tables; every test owns its schema.
|
|
if [ -n "${TEST_DATABASE_URL:-}" ]; then
|
|
REQUIRE_TEST_DATABASE=1 go test -race ./...
|
|
exit
|
|
fi
|
|
|
|
# Disposable memory-backed database, loopback only, no existing Compose volumes.
|
|
test_container=$(docker run --detach --rm --publish 127.0.0.1::5432 \
|
|
--env POSTGRES_USER=ballet_test --env POSTGRES_PASSWORD=local-isolated-test \
|
|
--env POSTGRES_DB=ballet_test --tmpfs /var/lib/postgresql postgres:18-alpine)
|
|
trap 'docker stop "$test_container" >/dev/null' EXIT HUP INT TERM
|
|
attempt=0
|
|
until docker exec "$test_container" pg_isready -U ballet_test -d ballet_test >/dev/null 2>&1; do
|
|
attempt=$((attempt + 1))
|
|
if [ "$attempt" -ge 30 ]; then printf '%s\n' 'Test PostgreSQL did not become ready.' >&2; exit 1; fi
|
|
sleep 1
|
|
done
|
|
test_port=$(docker port "$test_container" 5432 | sed 's/.*://')
|
|
TEST_DATABASE_URL="postgres://ballet_test:local-isolated-test@127.0.0.1:$test_port/ballet_test?sslmode=disable" \
|
|
REQUIRE_TEST_DATABASE=1 go test -race ./...
|