Skip to content

Feature/issue 738 proxy test - #1048

Merged
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
Immaculate0606:feature/issue-738-proxy-test
Jul 29, 2026
Merged

Feature/issue 738 proxy test#1048
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
Immaculate0606:feature/issue-738-proxy-test

Conversation

@Immaculate0606

Copy link
Copy Markdown
Contributor

Description:

Closes #738

Description

This PR upgrades the tests/integration/proxy.test.ts suite to utilize a real PostgreSQL database via testcontainers, enabling end-to-end testing of the proxy's idempotencyMiddleware which previously skipped its assertions when a database connection was unavailable.

Changes

  • Testcontainers Integration: Added GenericContainer('postgres:16-alpine') configuration within the beforeAll block to spin up a fully isolated PostgreSQL container on a dynamic port during testing.
  • Database Schema & Migrations: Added a runAllMigrations helper to dynamically apply all .sql schema definitions from the migrations/ directory to the test container before any requests are handled.
  • Dependency Injection: Updated the buildProxyApp test harness to accept the actual Pool instance from the testcontainers context and properly bind it to app.locals.dbPool, ensuring the idempotency layer hooks into the container instead of failing.
  • Idempotency Coverage: Removed the PG may be unavailable bypass in the idempotency POST test. It now strictly validates that Idempotency-Key correctly deduplicates matching requests and serves the cached response accurately.

Testing Instructions

  1. Run npm test tests/integration/proxy.test.ts locally with a running Docker daemon.
  2. Observe that the "Idempotency test skipped" warning is gone, and the tests execute correctly against the temporary database container.

@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@Immaculate0606 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@greatest0fallt1me
greatest0fallt1me merged commit b470217 into CalloraOrg:main Jul 29, 2026
@greatest0fallt1me

Copy link
Copy Markdown
Contributor

Nice work, everything checks out. Merged 🎉

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.

Add integration test for /api/proxy

2 participants