feat: AMM Bot load tests, exchange rate caching, E2E tests, and service refactor#1266
Open
pre-cious-Igwealor wants to merge 1 commit into
Conversation
…ce refactor emdevelopa#1114 — backend/load-tests/amm-bot-load.test.js: autocannon-based load suite for the AMM Bot (path-payment-quote endpoint); covers 10/20-connection sustained polling, burst rate-limit enforcement (asserts 429), and p99 < 500ms threshold. emdevelopa#1115 — backend/src/lib/exchange-rate-cache.js: TTL-based LRU cache for Stellar path-payment exchange rate quotes; stale-while-revalidate tolerance, Prometheus metrics hooks, singleton accessor. Tests in exchange-rate-cache.test.js. emdevelopa#1116 — backend/tests/e2e/exchange-rate.e2e.test.js: end-to-end test suite driving the full HTTP stack with mocked Horizon; covers happy path, same-asset rejection, no-path 404, non-pending 409, invalid UUID, cache behaviour (Horizon called once for two identical requests), and rate limit 429. emdevelopa#1117 — backend/src/services/exchangeRateService.js: refactors the inline path-payment-quote handler logic into a dedicated service with cache-first lookup, NoPathFoundError/ExchangeRateError types, and invalidateExchangeRateQuote for cache invalidation on payment status change. Tests in exchangeRateService.test.js.
|
@pre-cious-Igwealor is attempting to deploy a commit to the Emmanuel's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@pre-cious-Igwealor 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
backend/load-tests/amm-bot-load.test.js: autocannon-based AMM Bot load suite targeting the path-payment-quote endpoint; covers 10/20-connection sustained polling, burst 250-request rate-limit enforcement (asserts 429 appears), and p99 latency < 500ms assertion.backend/src/lib/exchange-rate-cache.js: TTL-based LRU in-memory cache for multi-currency exchange rate quotes; stale-while-revalidate tolerance; Prometheus metrics hooks; singleton accessor; unit tests inexchange-rate-cache.test.js.backend/tests/e2e/exchange-rate.e2e.test.js: end-to-end test suite driving the full Express HTTP stack with mocked Horizon + Supabase; covers happy path, same-asset 400, payment not found 404, non-pending 409, invalid UUID, cache behaviour (Horizon called once for two identical requests), and rate limit 429 burst.backend/src/services/exchangeRateService.js: refactors the inlinepath-payment-quoteroute handler into a dedicated service with cache-first lookup,NoPathFoundError/ExchangeRateErrortyped errors, andinvalidateExchangeRateQuotefor cache invalidation on payment status changes. Unit tests inexchangeRateService.test.js.Test plan
npx vitest backend/src/lib/exchange-rate-cache.test.js— all unit tests passnpx vitest backend/src/services/exchangeRateService.test.js— cache hit/miss, NoPathFoundError, invalidationnpx vitest backend/tests/e2e/exchange-rate.e2e.test.js— full HTTP stack E2Enpx vitest backend/load-tests/amm-bot-load.test.js— load suite; verify 429 on burst, p99 < 500mscloses #1114
closes #1115
closes #1116
closes #1117