[Test Coverage] container-lifecycle.ts and compose-generator.ts - #6322
Conversation
- container-lifecycle.ts: cover onNetworkReady topology path (lines 58-72, skipPull in topology mode, handleRetryStartupFailure return at line 175, and runAgentCommand error rethrow path (lines 313-314) - compose-generator.ts: cover buildLocal missing containers/ guard (lines 30-32) and api-proxy port publishing + awf-ext network attachment for microVM/sbx runtime mode (lines 144-158) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds targeted Jest coverage for container lifecycle and Compose generation branches.
Changes:
- Tests phased container startup, retries, and command errors.
- Tests local-build validation and sbx API-proxy networking.
Show a summary per file
| File | Description |
|---|---|
src/coverage-lifecycle-compose-gaps.test.ts |
Adds lifecycle branch tests. |
src/compose-generator-gaps.test.ts |
Adds Compose-generation branch tests. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 4
- Review effort level: Medium
| describe('startContainers – onNetworkReady topology path', () => { | ||
| const { getDir } = useTempDir(); | ||
|
|
||
| it('invokes onNetworkReady callback after squid-proxy starts (no skipPull)', async () => { |
| it('returns after retry succeeds (handleRetryStartupFailure return path)', async () => { | ||
| const { didContainerFailStartup, logContainerLogsToStderr } = | ||
| jest.requireMock('./container-startup-diagnostics'); | ||
|
|
||
| // First attempt: api-proxy fails | ||
| didContainerFailStartup | ||
| .mockResolvedValueOnce(true) // first call: api-proxy (handleStartupFailure) | ||
| .mockResolvedValueOnce(false) // squid check skipped | ||
| .mockResolvedValueOnce(false) // cli-proxy check skipped | ||
| .mockResolvedValueOnce(false); // retry: api-proxy check (handleRetryStartupFailure) | ||
|
|
||
| // docker rm | ||
| mockExecaFn.mockResolvedValueOnce({ stdout: '', stderr: '', exitCode: 0 } as any); | ||
| // docker compose up (first attempt — fails) | ||
| mockExecaFn.mockRejectedValueOnce(new Error('awf-api-proxy exited with code 1')); | ||
| // docker compose up (retry — succeeds) | ||
| mockExecaFn.mockResolvedValueOnce({ stdout: '', stderr: '', exitCode: 0 } as any); |
| it('rethrows when docker wait throws an unexpected error', async () => { | ||
| const fatalError = new Error('docker daemon connection refused'); | ||
|
|
||
| // docker logs -f (resolves immediately with reject:false) | ||
| mockExecaFn.mockResolvedValueOnce({ stdout: '', stderr: '', exitCode: 0 } as any); | ||
| // docker wait — throws | ||
| mockExecaFn.mockRejectedValueOnce(fatalError); | ||
|
|
||
| await expect(runAgentCommand(getDir(), ['github.com'])).rejects.toThrow( | ||
| 'docker daemon connection refused' | ||
| ); | ||
| }); |
| * Coverage tests for uncovered branches in compose-generator.ts: | ||
| * - buildLocal guard: throws when containers/ directory is missing (lines 30-32) | ||
| * - api-proxy port publishing + awf-ext network attachment for microVM mode (lines 144-158) |
|
@copilot address review feedback |
- Remove duplicate topology tests (already in container-start.test.ts:390-461) - Fix retry path: retry rejects, diagnostics return false, exercising line 175 - Add logger.error spy assertion to runAgentCommand test - Delete compose-generator-gaps.test.ts (duplicates existing test files)
Addressed all four review threads in commit
|
|
✅ Copilot review passed with no inline comments. @github-actions[bot] Add the |
…le-compose-gaps-e20079d4b0c84bf8
The doc-maintainer workflow was changed to weekly schedule with 30 max-turns in #6316 on main. Update the test assertions to match. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (2 files)
Coverage comparison generated by |
|
🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅ |
|
✅ Smoke Gemini completed. All facets verified. 💎 |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
|
❌ Smoke Copilot BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed... |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
✅ Smoke Claude passed |
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. |
|
📰 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. 🎤 |
|
🚀 Security Guard has started processing this pull request |
|
✅ Contribution Check completed successfully! PR #6322 follows the applicable CONTRIBUTING.md guidelines: it includes tests for the covered behavior, uses the expected test file locations, and provides a clear description. No documentation update is needed for test-only changes, and no related issue is identified to reference. |
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
|
✅ Build Test Suite completed successfully! |
|
🔌 Smoke Services — All services reachable! ✅ |
|
❌ Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed... |
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
Overall: PASS (core connectivity verified) Author: 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: PAT Auth Validation
Overall: PASS (core connectivity OK; pre-step template substitution issue) Author: 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: Copilot BYOK (Direct) Mode
Running in direct BYOK mode ( Overall: PASS (BYOK inference confirmed ✅) 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 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.
|
Smoke Test: Services Connectivity
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.
|
Chroot Version Comparison
Go versions match, but Python and Node.js differ between host and chroot environment. 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: Docker Sbx — Results
Overall: PARTIAL — MCP ✅, but pre-step outputs were not passed to the agent (unresolved cc
|
|
Smoke test results:\n- chore: upgrade gh-aw extension to latest pre-release ✅\n- doc-maintainer: increase max-turns to 30, switch to weekly schedule ✅\n- GitHub title check ❌\n- file write/read ✅\n- discussion comment ✅\n- npm ci && npm run build ❌\nOverall status: FAIL 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.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ 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: API Proxy OpenTelemetry Tracing
Overall: ✅ All completed validations pass. Pending items are expected during development. 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.
|
Summary
Adds Jest unit tests covering previously uncovered branches in two security-critical files.
src/container-lifecycle.ts(new:coverage-lifecycle-compose-gaps.test.ts)onNetworkReadytopology path (lines 58-72): tests the three-phase startup (squid-only →onNetworkReadycallback → full bring-up), both with and withoutskipPullhandleRetryStartupFailurereturn path (line 175): verifies that when the retry succeeds after an api-proxy first-attempt failure, the function returns cleanlyrunAgentCommanderror rethrow (lines 313-314): verifies that an unexpected error fromdocker waitis caught, logged, and rethrownsrc/compose-generator.ts(new:compose-generator-gaps.test.ts)buildLocalcontainers-dir guard (lines 30-32): verifies the helpful error is thrown when--build-localis used without a full repo checkoutawf-extattachment (lines 144-158): verifies that in microVM (sbx) mode, api-proxy ports are published and, whennetworkIsolationis set, theawf-extnetwork is attachedTests added: 7 (all passing)
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
awmgmcpgSee Network Configuration for more information.