chore add core rust project files and diesel migrations
Track required workspace crates, scripts, and historical diesel migrations so the repository contains the complete runnable backend baseline. Made-with: Cursor
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# Start docker-compose for htyts e2e, run cargo integration tests, then stop containers.
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
COMPOSE=(docker compose -f docker-compose.ts-e2e.yml)
|
||||
|
||||
"${COMPOSE[@]}" up -d --wait
|
||||
|
||||
cleanup() {
|
||||
"${COMPOSE[@]}" down
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
export TS_DATABASE_URL="${TS_DATABASE_URL:-postgres://htyts_e2e:htyts_e2e@127.0.0.1:5436/htyts_e2e}"
|
||||
|
||||
if ! command -v diesel >/dev/null 2>&1; then
|
||||
echo "Installing diesel_cli (one-time) for migrations..."
|
||||
cargo install diesel_cli --no-default-features --features postgres --locked
|
||||
fi
|
||||
(
|
||||
cd "$ROOT/htyts_models"
|
||||
diesel migration run --database-url "$TS_DATABASE_URL"
|
||||
)
|
||||
|
||||
# Clean slate so repeated runs are deterministic (sudoer JWT is re-seeded in tests).
|
||||
docker compose -f docker-compose.ts-e2e.yml exec -T ts-e2e-db \
|
||||
psql -U htyts_e2e -d htyts_e2e -c "TRUNCATE TABLE dbtask;" || true
|
||||
docker compose -f docker-compose.ts-e2e.yml exec -T ts-e2e-redis redis-cli FLUSHDB || true
|
||||
|
||||
export JWT_KEY="${JWT_KEY:-e2e-jwt-secret-key-minimum-32-chars!!}"
|
||||
export REDIS_HOST="${REDIS_HOST:-127.0.0.1}"
|
||||
export REDIS_PORT="${REDIS_PORT:-6390}"
|
||||
export TS_DOMAIN="${TS_DOMAIN:-e2e.test.local}"
|
||||
export ZOMBIE_MIN="${ZOMBIE_MIN:-10}"
|
||||
export POOL_SIZE="${POOL_SIZE:-8}"
|
||||
|
||||
cargo test -p htyts --test ts_e2e_http -- --nocapture
|
||||
Reference in New Issue
Block a user