refactor: split agent-volumes-mounts.test.ts by feature area#5522
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the agent volume mount unit tests by splitting a single large agent-volumes-mounts.test.ts file into multiple smaller, feature-focused test files, improving scanability and making failures easier to localize within the AWF service layer.
Changes:
- Deleted the monolithic
src/services/agent-volumes-mounts.test.ts. - Added 6 feature-scoped test files covering basic mounts, ARC/DinD staging, DinD sockets, toolchain mounts, chroot/hosts behavior, and DNS pre-resolution.
- Preserved the existing set of test cases/assertions while reorganizing them into clearer groupings.
Show a summary per file
| File | Description |
|---|---|
| src/services/agent-volumes-basic.test.ts | Covers default/custom mounts, host path prefixing, trailing-slash normalization, and malformed mount fallback. |
| src/services/agent-volumes-arc-dind-staging.test.ts | Covers ARC/DinD staging behaviors (PATH candidate selection, explicit command path, staging pruning, escape guard). |
| src/services/agent-volumes-dind-socket.test.ts | Covers DinD socket exposure and API-proxy health-check mount behavior. |
| src/services/agent-volumes-toolchain.test.ts | Covers toolchain/cache mounts (Rust, npm/nvm), Gemini mount gating, and runner toolcache mounting rules. |
| src/services/agent-volumes-chroot-hosts.test.ts | Covers .copilot mount guards, session-state overrides, and chroot /etc/hosts behavior. |
| src/services/agent-volumes-dns-preresolution.test.ts | Covers allowlist domain pre-resolution behavior and dedup behavior for domains already present in /etc/hosts. |
| src/services/agent-volumes-mounts.test.ts | Removed (tests split into feature-focused replacements). |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 7/7 changed files
- Comments generated: 4
| // Count occurrences of 'localhost' - should only be the original entries, not duplicated | ||
| const localhostMatches = content.match(/localhost/g); | ||
| // /etc/hosts typically has multiple localhost entries (127.0.0.1 and ::1) | ||
| // The key assertion is that getent should NOT have been called for localhost | ||
| // since it's already in the hosts file | ||
| expect(localhostMatches).toBeDefined(); |
| function withEnv(envPatch: Record<string, string | undefined>, fn: () => void): void { | ||
| const saved: Record<string, string | undefined> = {}; | ||
|
|
||
| for (const [key, value] of Object.entries(envPatch)) { | ||
| saved[key] = process.env[key]; |
| function withEnv(envPatch: Record<string, string | undefined>, fn: () => void): void { | ||
| const saved: Record<string, string | undefined> = {}; | ||
|
|
||
| for (const [key, value] of Object.entries(envPatch)) { | ||
| saved[key] = process.env[key]; |
| function withEnv(envPatch: Record<string, string | undefined>, fn: () => void): void { | ||
| const saved: Record<string, string | undefined> = {}; | ||
|
|
||
| for (const [key, value] of Object.entries(envPatch)) { | ||
| saved[key] = process.env[key]; |
|
@copilot address review feedback |
|
✅ Copilot review passed with no inline comments. @copilot Add the |
Done in 3fd170a:
|
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
|
🔌 Smoke Services — All services reachable! ✅ |
|
✅ Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓 |
|
✅ Build Test Suite completed successfully! |
|
🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅ |
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. |
|
❌ Contribution Check failed. Please review the logs for details. |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
|
✅ Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓 |
|
✅ Smoke Gemini completed. All facets verified. 💎 Testing safeoutputs |
|
🚀 Security Guard has started processing this pull request |
|
✅ Smoke Claude passed |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
Smoke Test: Copilot BYOK ✅ PASSTests:
Running in direct BYOK mode (
|
Smoke Test: Claude Engine
Overall result: PASS
|
🔬 Smoke Test Results — Auth mode: PAT (COPILOT_GITHUB_TOKEN)
Overall: FAIL (unable to confirm all tests — pre-step data missing) PR: refactor: split agent-volumes-mounts.test.ts by feature area — author
|
|
|
🔬 Smoke Test ResultsPR: refactor: split agent-volumes-mounts.test.ts by feature area
Overall: FAIL — pre-computed step outputs were not substituted (template variables literal in prompt).
|
|
refactor(api-proxy): extract sliding-window data structure into rate-limiter-window.js ✅ 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.
|
Smoke Test: API Proxy OpenTelemetry Tracing ✅
All 5 scenarios pass. OTEL tracing is fully implemented and working correctly.
|
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.
|
Chroot Version Comparison Results
Overall: ❌ Not all versions match — Python and Node.js versions differ between host and chroot environments.
|
Smoke Test: Services Connectivity
Overall: FAIL — Service containers are not accessible.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
|
Overall: PASS
|
src/services/agent-volumes-mounts.test.tshad grown to 862 lines with 38 flatit()cases and zero sub-grouping across 6 distinct feature areas, making it hard to scan and slow to pinpoint failures.Changes
agent-volumes-mounts.test.ts(862 lines)agent-volumes-basic.test.tsagent-volumes-arc-dind-staging.test.ts/etc/passwd+/etc/groupnon-prefixing, stale dir pruning, path escape guardagent-volumes-dind-socket.test.tsenableDind,DOCKER_HOSTforwarding, invalid-socket fallbackagent-volumes-toolchain.test.tsrunnerToolCachePath,RUNNER_TOOL_CACHE, symlink exclusionagent-volumes-chroot-hosts.test.ts.copilotbind-mount guards,sessionStateDir,/tmp↔/host/tmp,/etclookup files,enableHostAccess,host.docker.internalinjectionagent-volumes-dns-preresolution.test.tsAll 38 tests are preserved with identical assertions. Each file follows the existing split-test convention: own
jest.mock('execa', …)(required due to Jest hoisting) and shared setup imported fromservice-test-setup.test-utils.