Skip to content

chore(guardrails): speed up IGW middleware integration test fixtures#37

Draft
albcui wants to merge 1 commit into
mainfrom
albcui/AIRCORE-585/speed-up-igw-middleware-integration-test-fixtures-by-module-scoping
Draft

chore(guardrails): speed up IGW middleware integration test fixtures#37
albcui wants to merge 1 commit into
mainfrom
albcui/AIRCORE-585/speed-up-igw-middleware-integration-test-fixtures-by-module-scoping

Conversation

@albcui
Copy link
Copy Markdown

@albcui albcui commented May 25, 2026

Big idea: convert the heavy ASGI stack from function-scoped to module-scoped, so that they can be re-used across tests. The heavy stuff includes:

  • SQLite database initialization + migrations
  • 3 services: (Models, Entities, IGW)
  • FastAPI app
  • default workspace + project seeding
  • (for loopback) a fresh uvicorn thread per test

Results using time -p ...

Configuration main this branch
sequential ~26s ~19s
xdist --dist=loadfile -n 4 ~17s ~14s

The main speedup is experienced when you run the tests sequentially. This is often the case when you are in a dev loop and just running locally with pytest .... The change is less noticeable when you use xdist, which already parallelizes the per-test rebuild across workers, so module-scoping on top yields less benefits.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 25, 2026

Suite Lines Covered Line Rate Branch Rate
Unit Tests 18244/24193 75.4% 61.8%
Integration Tests 11666/22975 50.8% 25.9%

Signed-off-by: Albert Cui <contact@albertcui.dev>
@albcui albcui force-pushed the albcui/AIRCORE-585/speed-up-igw-middleware-integration-test-fixtures-by-module-scoping branch from ee440ae to 5487740 Compare May 25, 2026 17:23
@albcui albcui changed the title chore(guardrails): module-scope IGW + Models ASGI test stack chore(guardrails): speed up IGW middleware integration test fixtures May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant