Use host IP for e2e test API in CI
Some checks failed
CI / backend-tests (push) Failing after 26s
CI / frontend-tests (push) Successful in 29s
CI / e2e-tests (push) Successful in 5m37s

The act runner executes steps inside a container where localhost does
not reach the Docker host. Use E2E_API_URL env var (set to the host IP
192.168.1.10:8100 in CI) so both the global setup and Vite proxy can
reach the test API container.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-21 16:38:29 +01:00
parent b50e9160ba
commit 00734ee233
3 changed files with 6 additions and 3 deletions

View File

@@ -4,7 +4,8 @@ import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
const __dirname = dirname(fileURLToPath(import.meta.url))
const API_BASE = 'http://localhost:8100/api/v1'
const API_HOST = process.env.E2E_API_URL || 'http://localhost:8100'
const API_BASE = `${API_HOST}/api/v1`
const COMPOSE_FILE = resolve(__dirname, '../../docker-compose.test.yml')
const COMPOSE = `docker compose -p nuzlocke-test -f ${COMPOSE_FILE}`
const FIXTURES_PATH = resolve(__dirname, '.fixtures.json')
@@ -48,7 +49,7 @@ export default async function globalSetup() {
// 2. Wait for API to be healthy
console.log('[setup] Waiting for API to be ready...')
await waitForApi('http://localhost:8100/')
await waitForApi(`${API_HOST}/`)
// 3. Run migrations
run(`${COMPOSE} exec -T test-api alembic -c /app/alembic.ini upgrade head`)