Ergaenze die Kansho-analoge Test-Suite gegen buyingagent_test.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
e1800e7b0f
commit
c9c0ff96fc
9 files changed
+138
-5
No files matched your search
@@ -9,6 +9,52 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
pytest-backend:
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: pytest against Dev Postgres (buyingagent_test)
|
||||
run: |
|
||||
set -e
|
||||
APP_DIR="$HOME/docker/buyingagent-dev"
|
||||
COMPOSE_FILE="docker-compose.dev-env.yml"
|
||||
echo "pytest uses Dev Postgres (${APP_DIR}); event=${{ github.event_name }}"
|
||||
cd "$APP_DIR"
|
||||
for i in $(seq 1 60); do
|
||||
if [ -f "$APP_DIR/pyproject.toml" ] && docker compose -f "$COMPOSE_FILE" exec -T api true 2>/dev/null; then
|
||||
echo "api and pyproject.toml ready (attempt $i)"
|
||||
break
|
||||
fi
|
||||
if [ "$i" -eq 60 ]; then
|
||||
echo "timeout waiting for Dev checkout/api"
|
||||
docker compose -f "$COMPOSE_FILE" ps || true
|
||||
ls -la "$APP_DIR" || true
|
||||
exit 1
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
PGUSER="$(docker compose -f "$COMPOSE_FILE" exec -T postgres printenv POSTGRES_USER | tr -d '\r')"
|
||||
echo "test database buyingagent_test on the existing Dev Postgres (owner ${PGUSER})"
|
||||
docker compose -f "$COMPOSE_FILE" exec -T postgres \
|
||||
psql -U "$PGUSER" -d postgres -v ON_ERROR_STOP=1 \
|
||||
-c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'buyingagent_test' AND pid <> pg_backend_pid();"
|
||||
docker compose -f "$COMPOSE_FILE" exec -T postgres \
|
||||
psql -U "$PGUSER" -d postgres -v ON_ERROR_STOP=1 \
|
||||
-c "DROP DATABASE IF EXISTS buyingagent_test;"
|
||||
docker compose -f "$COMPOSE_FILE" exec -T postgres \
|
||||
psql -U "$PGUSER" -d postgres -v ON_ERROR_STOP=1 \
|
||||
-c "CREATE DATABASE buyingagent_test OWNER ${PGUSER};"
|
||||
docker compose -f "$COMPOSE_FILE" --profile test build --pull=false api-test
|
||||
docker compose -f "$COMPOSE_FILE" --profile test run --rm --no-deps \
|
||||
-v "${APP_DIR}:/src:ro" \
|
||||
-w /src \
|
||||
-e PYTHONPATH=/src \
|
||||
-e DB_NAME=buyingagent_test \
|
||||
-e ENVIRONMENT=test \
|
||||
-e ENGINE_BUILD=test \
|
||||
api-test \
|
||||
sh -lc 'set -e; alembic upgrade head; pytest tests -m "not slow" -ra --tb=short'
|
||||
|
||||
smoke-dev:
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
@@ -16,7 +62,7 @@ jobs:
|
||||
- name: Non-destructive smoke against the running Dev API
|
||||
run: |
|
||||
set -e
|
||||
echo "wait for live Dev API (buyingagent-dev)"
|
||||
echo "live Dev API (buyingagent-dev), read-only health"
|
||||
for i in $(seq 1 60); do
|
||||
if curl -sf http://localhost:8095/health/live >/dev/null; then
|
||||
echo "DEV /health/live ready (attempt $i)"
|
||||
|
||||
Reference in new issue
Block a user