test(router): add dynamic agent test#1246
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded Node.js agent imports and a new E2E test that verifies the router dynamically assigns different HTTPS agents per request; the test spies on each agent's createConnection, routes requests to separate targets based on URL, and asserts each agent was used exactly once. ChangesDynamic Agent Selection E2E Test
Sequence Diagram(s)sequenceDiagram
participant Client
participant ProxyRouter
participant HttpsAgentA
participant HttpsAgentB
participant TargetA
participant TargetB
Client->>ProxyRouter: GET /api/a
ProxyRouter->>HttpsAgentA: set options.agent = agentA
ProxyRouter->>TargetA: proxy request (agentA)
HttpsAgentA->>TargetA: createConnection()
TargetA-->>Client: response A
Client->>ProxyRouter: GET /api/b
ProxyRouter->>HttpsAgentB: set options.agent = agentB
ProxyRouter->>TargetB: proxy request (agentB)
HttpsAgentB->>TargetB: createConnection()
TargetB-->>Client: response B
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
b452059 to
c2d7367
Compare
closes: #1123
Summary by CodeRabbit