Refactor retry-logic tests to centralize shared HTTPS/stdout mocks#4046
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors two retry-logic Jest test files in the API proxy to lift duplicated per-test mock setup (stdoutWriteSpy, responseHandlers, capturedOptions, and the https.request spy) into shared describe-scope state initialized in beforeEach. Pure test cleanup with no production-code changes.
Changes:
- Hoist shared
stdoutWriteSpy/responseHandlers/capturedOptionsand thehttps.requestmock into abeforeEachfor the Anthropic deprecated-beta test suite. - Apply the same shared-setup pattern to the Copilot model-not-supported retry suite, removing per-test duplication.
- Preserve a per-test
https.requestoverride in the "sends an identical request body on retry" case for body capture.
Show a summary per file
| File | Description |
|---|---|
| containers/api-proxy/server.anthropic-beta.test.js | Centralizes mock setup in beforeEach; removes duplicated spy/array initialization from each it. |
| containers/api-proxy/server.model-not-supported.test.js | Same beforeEach consolidation; one test still overrides https.request to capture bodies. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Smoke Test: Claude Engine
Total: PASS
|
🔬 Smoke Test Results
Overall: PARTIAL — MCP confirmed working; pre-step template vars were not substituted. PR by
|
🔍 Smoke Test: API Proxy OpenTelemetry Tracing
All scenarios pass. ✅
|
Smoke Test: Copilot BYOK (Offline) Mode
Running in BYOK offline mode ( Overall: PASS (3/3 functional tests passed; file test skipped due to unexpanded template vars) PR author:
|
|
Smoke test results: Gemini. GitHub MCP: FAIL, Connectivity: FAIL, File Write: PASS, Bash: PASS. Overall: FAIL. Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
🧪 Chroot Runtime Version Comparison
Result: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environments.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test Results: FAIL
|
|
fix: synthesize identity files for ARC-DinD environments — ✅ Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
|
@copilot address review feedback |
The retry-logic test suites for Anthropics deprecated beta handling and Copilot
model not supportedhandling repeated the same spy/mock setup in each test body, creating high-maintenance duplication. This change consolidates that setup into shareddescribe-level state initialized inbeforeEach.containers/api-proxy/server.anthropic-beta.test.jsdescribescope:stdoutWriteSpyresponseHandlerscapturedOptionshttps.requestmock implementationit(...)cases while preserving existing assertions and flow.containers/api-proxy/server.model-not-supported.test.jsdescribe-level shared setup pattern for retry tests.Resulting test structure