refactor: split agent-service.test.ts by concern into three focused files#5573
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the agent service unit tests by splitting previously co-located suites into smaller, concern-focused test files, making security-critical coverage (e.g., buildAgentSecurityConfig) easier to find and maintain.
Changes:
- Extract
resolveAgentImageConfigtests intoagent-service-image.test.ts. - Extract
buildAgentSecurityConfigtests intoagent-security-config.test.ts. - Remove the extracted suites from
agent-service-build.test.ts, leaving it focused on compose/service build behaviors.
Show a summary per file
| File | Description |
|---|---|
src/services/agent-service-build.test.ts |
Removes the image-resolution and security-config suites, keeping the file focused on docker-compose/service build expectations. |
src/services/agent-service-image.test.ts |
New focused suite for resolveAgentImageConfig (preset vs custom image behavior, GHCR vs local build). |
src/services/agent-security-config.test.ts |
New focused suite for buildAgentSecurityConfig (capabilities, seccomp/security_opt, tmpfs overlays, resource limits). |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
src/services/agent-service-build.test.ts:1
- PR description references splitting
src/services/agent-service.test.ts, but this PR's changes are toagent-service-build.test.tsand new filesagent-service-image.test.ts/agent-security-config.test.ts. Ifagent-service.test.tswas already renamed/removed earlier, consider updating the PR description to match the actual source file being split to avoid confusion for reviewers.
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Low
|
✅ Copilot review passed with no inline comments. @copilot Add the |
|
✅ Smoke Gemini completed. All facets verified. 💎 |
|
✅ Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓 |
|
🚀 Security Guard has started processing this pull request |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅ |
|
🔌 Smoke Services — All services reachable! ✅ |
|
✅ Contribution Check completed successfully! Contribution check complete for PR #5573: the changes are a test-only refactor, include/retain relevant tests, are organized under src/services, and the PR description is clear. No guideline issues requiring a PR comment were found. |
|
✅ Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓 |
|
✅ Build Test Suite completed successfully! |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
✅ Smoke Claude passed |
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. |
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
Smoke Test: Copilot BYOK (Direct) Mode ✅
Running in direct BYOK mode via
|
Smoke Test: Claude Engine Validation
Overall result: PASS
|
🔍 Smoke Test ResultsPR: refactor: split agent-service.test.ts by concern into three focused files
Overall: FAIL — pre-step template variables (
|
Smoke Test Results — Auth mode: PAT (COPILOT_GITHUB_TOKEN)
Overall: PASS — PAT auth confirmed via MCP. PR: "refactor: split agent-service.test.ts by concern into three focused files" — author
|
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.
|
|
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 Status: PASS
|
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 scenarios pass. OTEL tracing integration is in place and functional.
|
Chroot Version Comparison Results
Overall: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environment.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test Results
Overall: FAIL
|
|
"refactor: split agent-service.test.ts by concern into three focused files"
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) Overall: PASS
|
src/services/agent-service.test.ts(644 lines) mixed three independent test suites under one file, making the security-criticalbuildAgentSecurityConfigtests buried 500+ lines deep.Split
agent-service-build.test.tsbuildAgentService— volumes, env, host-ports, GITHUB_PATH, toolchain vars (~35 tests)agent-service-image.test.tsresolveAgentImageConfig— preset/custom image resolution (~6 tests)agent-security-config.test.tsbuildAgentSecurityConfig— seccomp, capabilities, memory limits (~9 tests)No logic changes. Each file carries its own
jest.mock('execa', ...)declaration per the existing per-file hoisting requirement. Shared test utilities (service-test-setup.test-utils,agent-service.test-utils) are imported as-is.