Repository navigation
fix(tests): un-quarantine gateway proxy integration suites - #1654
Open
Mossad-esc wants to merge 1 commit into
Open
Mossad-esc wants to merge 1 commit into
Mossad-esc wants to merge 1 commit into
Conversation
Restore drainGuard and Idempotency-Key middleware on /v1/call proxy routes, align InMemoryUsageStore.getEvents with apiKeyId lookups, and update proxy/gateway integration tests for current error envelopes, allowlists, and async usage recording. Closes CalloraOrg#1563
|
@Mossad-esc 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
Repairs and un-quarantines the four gateway proxy integration suites (
proxy.integration.test.ts,proxy.drain.test.ts,hopByHopProxy.integration.test.ts, andgateway.integration.test.ts) so the/v1/calland/api/gatewayproxy paths run in CI.Root Causes & Changes
Production Bug Fixes
src/routes/proxyRoutes.ts:drainGuardmiddleware (usingdrainState?.isDraining()) ahead ofauthMiddlewareso draining instances immediately reject new requests with503 Service Unavailable,Connection: close, andRetry-After: 0without forwarding upstream or recording usage.idempotencyMiddlewareonPOSTandPATCH/v1/callroutes (settingres.locals.authenticatedUserfromreq.apiKeyRecord.userIdso idempotency scopes remain isolated per developer).src/services/usageStore.ts:InMemoryUsageStore.getEvents(apiKey)to matche.apiKey === apiKey || e.apiKeyId === apiKey(aligning withPostgresUsageStore.getEvents), since proxy routes recordapiKeyIdrather than plaintextapiKey.Test & Quarantine Updates
src/__tests__/proxy.integration.test.ts: Added an in-memoryidempotency_storepool mock, passed a sharedInMemoryCircuitBreakerStorereset inbeforeEach, flushed asyncsetImmediateusage recording before assertions, updated error assertions for the{ error: { code, message, details } }envelope, replacedPromise.withResolverswith a Node 20 helper, fixed the concurrentIDEMPOTENCY_IN_PROGRESSrace, and updated slow-header/timeout tests for the 3-attempt GET retry contract.src/__tests__/hopByHopProxy.integration.test.ts: AddedallowedHosts: ['localhost']anderrorHandler, and usednode:httpwithbuildHopByHopSetto verify dynamicConnection-listed header stripping.src/__tests__/gateway.integration.test.ts: RegisteredrequestIdMiddlewareanderrorHandler, updated 402/429/504 assertions to the JSON error envelope, and updated the 504 test to assert no usage event is recorded on upstream timeout.jest.quarantine.json: Removed the 4 suites (79/79 tests passing undernpm test -- --runInBand).Closes #1563