test: allow disabling rate limiting for e2e runs
The full Playwright suite authenticates ~100 times in a few minutes, far over the login endpoint's 5/minute limit, so most specs failed at the beforeEach login with 429s. Add an OIDC_OP_RATE_LIMIT_ENABLED setting (default True) wired to the slowapi limiter's enabled flag, and set it to false in tests/e2e/run.sh. Production behavior is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
bcfe3a2a15
commit
2fc2bdcabb
3 changed files with 5 additions and 0 deletions
|
|
@ -128,6 +128,7 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
||||||
)
|
)
|
||||||
|
|
||||||
# Rate limiting
|
# Rate limiting
|
||||||
|
limiter.enabled = settings.rate_limit_enabled
|
||||||
app.state.limiter = limiter
|
app.state.limiter = limiter
|
||||||
|
|
||||||
@app.exception_handler(RateLimitExceeded)
|
@app.exception_handler(RateLimitExceeded)
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,9 @@ class Settings(BaseSettings):
|
||||||
# Magic links
|
# Magic links
|
||||||
invite_ttl: int = 86400 # seconds
|
invite_ttl: int = 86400 # seconds
|
||||||
|
|
||||||
|
# Rate limiting (disable for e2e/load tests that authenticate repeatedly)
|
||||||
|
rate_limit_enabled: bool = True
|
||||||
|
|
||||||
# Signing keys
|
# Signing keys
|
||||||
signing_key_path: str = "data/keys"
|
signing_key_path: str = "data/keys"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ echo "Starting Porchlight on port ${PORT}..."
|
||||||
echo " DB: ${OIDC_OP_SQLITE_PATH}"
|
echo " DB: ${OIDC_OP_SQLITE_PATH}"
|
||||||
OIDC_OP_ISSUER="${TARGET_URL}" \
|
OIDC_OP_ISSUER="${TARGET_URL}" \
|
||||||
OIDC_OP_DEBUG=true \
|
OIDC_OP_DEBUG=true \
|
||||||
|
OIDC_OP_RATE_LIMIT_ENABLED=false \
|
||||||
uv run --directory "$PROJECT_ROOT" \
|
uv run --directory "$PROJECT_ROOT" \
|
||||||
uvicorn porchlight.app:create_app \
|
uvicorn porchlight.app:create_app \
|
||||||
--factory --host 127.0.0.1 --port "$PORT" \
|
--factory --host 127.0.0.1 --port "$PORT" \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue