Refactor network setup tests to use a shared DNS/proxy mock fixture - #6179
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the resolveNetworkConfig unit tests to share a single, security-sensitive mocking fixture (DNS detection, upstream proxy detection, option parsing defaults, and process.exit interception) so both the main and branch-coverage suites run with identical baseline assumptions.
Changes:
- Added
setupNetworkConfigMocks(...)helper to centralizejest.clearAllMocks(),process.exitspy setup, and default mock return values. - Updated
network-setup.test.tsandnetwork-setup-branches.test.tsto use the shared helper inbeforeEach, keeping only per-test overrides inline.
Show a summary per file
| File | Description |
|---|---|
| src/test-helpers/network-setup-mocks.test-utils.ts | New shared fixture helper that standardizes DNS/proxy parsing defaults and process.exit behavior across suites. |
| src/commands/network-setup.test.ts | Replaces duplicated beforeEach mock wiring with the shared helper. |
| src/commands/network-setup-branches.test.ts | Replaces duplicated beforeEach mock wiring with the shared helper for branch-coverage tests. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Low
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. |
|
✅ Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓 |
|
🚀 Security Guard has started processing this pull request |
|
🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅ |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
|
🔌 Smoke Services — All services reachable! ✅ |
|
✅ Smoke Gemini completed. All facets verified. 💎 Testing safeoutputs |
|
✅ Smoke Claude passed |
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
|
📰 VERDICT: Smoke Docker Sbx has concluded. All systems operational. This is a developing story. 🎤 |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
✅ Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓 |
|
❌ Contribution Check failed. Please review the logs for details. |
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
✨ New Files (1 files)
Coverage comparison generated by |
Smoke Test: Copilot PAT Auth
Overall: PARTIAL — pre-step outputs unavailable (template vars not substituted). Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Smoke Test Results
Overall: FAIL — Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
🔍 Smoke Test Results
Overall: /cc Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
🔥 Smoke Test Results — Docker Sbx
Overall: PASS (MCP verified; pre-computed step outputs not expanded in prompt) cc
|
Smoke Test: Copilot BYOK (Direct) ✅ PASS
Running in direct BYOK mode via Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Smoke Test: API Proxy OpenTelemetry Tracing
All 6 scenarios passed. OTEL tracing integration is working correctly. Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Chroot Version Comparison
Not all versions matched — Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
|
Last merged PRs:\n- ✅ fix: add mode: gh-proxy to smoke-sink-visibility workflows\n- ✅ docs: add D5 failure mode — stale gVisor release pin returns 404\n- ✅ GitHub query\n- ✅ Browser check\n- ✅ File write\n- ✅ Discussion comment\n- ✅ Build\nOverall: PASS Warning Firewall blocked 2 domainsThe following domains were blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"
- "registry.npmjs.org"See Network Configuration for more information.
|
Smoke Test: Claude Engine Validation
Overall Result: PASS ✅ Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
|
Smoke Test Results
Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) authenticated via Microsoft Entra Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
|
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) Merged PRs:
Overall: PASS /cc Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Gemini Smoke Test Results
Overall status: 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.
|
network-setuptest coverage was split across two suites that duplicated the same security-sensitivebeforeEachpolicy fixture (process exit behavior, host DNS detection, upstream proxy detection, DNS option parsing). This change centralizes that setup so both suites inherit identical defaults and future policy changes are made in one place.What changed
src/test-helpers/network-setup-mocks.test-utils.ts:setupNetworkConfigMocks(...)jest.clearAllMocks(),process.exitspy wiring, and default mock return values for DNS/proxy parsing.src/commands/network-setup.test.tssrc/commands/network-setup-branches.test.tsbeforeEachand keep only test-specific overrides inline.Why this refactor matters
Example