From 5638895635a62cd6a3236ed24b977ae1e522ed17 Mon Sep 17 00:00:00 2001 From: Priyanshu-u07 Date: Mon, 28 Sep 2026 16:29:42 +0530 Subject: [PATCH] test: re-enable the OAuth router and rate limiter TTL suites Signed-off-by: Priyanshu-u07 --- .github/workflows/test.yml | 2 -- src/tests/api_gateway/test_oauth_router.py | 2 +- src/tests/api_gateway/test_rate_limiter_ttl.py | 8 +++++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2ad92bb6..1f01fa88 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -67,9 +67,7 @@ jobs: # Currently failing. --ignore=src/tests/api_gateway/test_app_startup_catalog.py --ignore=src/tests/api_gateway/test_config_modes.py - --ignore=src/tests/api_gateway/test_oauth_router.py --ignore=src/tests/api_gateway/test_oidc_role_mapping.py - --ignore=src/tests/api_gateway/test_rate_limiter_ttl.py --ignore=src/tests/cli/test_dashboard_config.py --ignore=src/tests/common/test_cli_providers.py --ignore=src/tests/common/test_cluster_naming.py diff --git a/src/tests/api_gateway/test_oauth_router.py b/src/tests/api_gateway/test_oauth_router.py index e871e898..c6313ed0 100644 --- a/src/tests/api_gateway/test_oauth_router.py +++ b/src/tests/api_gateway/test_oauth_router.py @@ -16,7 +16,7 @@ from httpx import ASGITransport, AsyncClient -def _build_app(monkeypatch, *, auth_provider="external", base="https://auth.example.test", +def _build_app(monkeypatch, *, auth_provider="oidc", base="https://auth.example.test", redirect_uri="https://app.example.test/auth/callback", client_id="inferiallm-dashboard") -> FastAPI: """Wire the oauth_router into a clean FastAPI app with patched settings.""" diff --git a/src/tests/api_gateway/test_rate_limiter_ttl.py b/src/tests/api_gateway/test_rate_limiter_ttl.py index a0449949..3c6e29d0 100644 --- a/src/tests/api_gateway/test_rate_limiter_ttl.py +++ b/src/tests/api_gateway/test_rate_limiter_ttl.py @@ -48,9 +48,15 @@ async def test_is_allowed_creates_bucket(self): @pytest.mark.asyncio async def test_rate_limit_exhaustion(self): limiter = InMemoryRateLimiter() - # Exhaust all tokens + # The defaults refill 166 tokens a second, which is faster than the + # loop below drains 1000 of them, so the bucket never empties. Both + # are set here to measure exhaustion rather than loop speed. + limiter.burst_size = 5 + limiter.requests_per_minute = 0 + for _ in range(limiter.burst_size): allowed, _ = await limiter.is_allowed("user:exhaust") + assert allowed is True # Next request should be denied allowed, metadata = await limiter.is_allowed("user:exhaust") assert allowed is False