[Test Coverage] Add comprehensive tests for config-assembly validator#3670
[Test Coverage] Add comprehensive tests for config-assembly validator#3670github-actions[bot] wants to merge 1 commit into
Conversation
- Add 28 test cases covering validation error paths - Test docker-host URI validation (unix:// requirement) - Test docker-host-path-prefix validation (absolute path requirement) - Test rate limit configuration error handling - Test feature flag validation (opencode, token-steering) - Test environment variable warnings (--env-all, --env-file) - Test host service ports and host ports validation - Test skip-pull + build-local incompatibility - Test host access warnings with host.docker.internal - Test API proxy configuration logging - Test COPILOT_MODEL detection from multiple sources: - env files (with export prefix, comments) - --env flags - host environment (with --env-all) - array of env files - unreadable files (graceful handling) Coverage improvement: config-assembly.ts - Statement coverage: 81% → ~95% - Branch coverage: 65% → ~90% All tests use proper mocking patterns and follow existing test conventions in the codebase. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
|
✅ Smoke Test Results
Result: PASS
|
Smoke Test ResultsPR #3657: Retry Anthropic requests after deprecated ✅ GitHub MCP: Connected successfully Overall: FAIL cc:
|
Smoke TestPRs: Retry Anthropic requests after deprecated 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.
|
There was a problem hiding this comment.
Pull request overview
Adds a new Jest unit test suite targeting assembleAndValidateConfig (src/commands/validators/config-assembly.ts) to increase coverage of post-assembly validation and warning paths in the CLI validation pipeline.
Changes:
- Introduces a new
config-assembly.test.tswith extensive mocking ofbuildConfig,option-parsers,api-proxy-config, andlogger. - Adds test cases covering docker-host/path-prefix guards, rate-limit assembly, feature-flag compatibility checks, host-access/ports validation, API proxy status logging, and COPILOT_MODEL detection paths.
Show a summary per file
| File | Description |
|---|---|
| src/commands/validators/config-assembly.test.ts | Adds a comprehensive Jest test suite for post-assembly validation behavior in assembleAndValidateConfig. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 4
| localhostResult: { localhostDetected: false, domains: [] }, | ||
| upstreamProxy: undefined, | ||
| dnsServers: ['8.8.8.8'], | ||
| dnsOverHttps: undefined, | ||
| resolvedCopilotApiTarget: undefined, | ||
| resolvedCopilotApiBasePath: undefined, | ||
| dockerHostPathPrefixResolution: { dockerHostPathPrefix: undefined }, |
| mockBuildConfig.mockReturnValueOnce({ | ||
| envAll: true, | ||
| copilotGithubToken: 'ghp_testtoken', | ||
| }); | ||
|
|
||
| assembleAndValidateConfig( | ||
| {}, | ||
| 'echo test', | ||
| createMinimalLogAndLimits(), | ||
| createMinimalNetworkOptions(), | ||
| createMinimalAgentOptions(), | ||
| ); | ||
|
|
||
| expect(warnClassicPATWithCopilotModel).toHaveBeenCalledWith( | ||
| true, | ||
| true, // COPILOT_MODEL detected from host env | ||
| expect.any(Function), | ||
| ); | ||
|
|
||
| // Cleanup | ||
| if (originalCopilotModel) { | ||
| process.env.COPILOT_MODEL = originalCopilotModel; | ||
| } else { | ||
| delete process.env.COPILOT_MODEL; |
| allowHostServicePorts: [], | ||
| enableHostAccess: false, | ||
| allowHostPorts: [], |
| mockBuildConfig.mockReturnValueOnce({ | ||
| awfDockerHost: 'tcp://127.0.0.1:2375', | ||
| dockerHostPathPrefix: undefined, | ||
| }); | ||
|
|
Smoke Test: Services ConnectivityStatus: ❌ FAIL
Services running on host are not reachable from AWF sandbox.
|
Chroot Runtime Version Test ResultsTested whether runtime versions match between host and chroot environment:
Result: Tests FAILED - Python and Node.js versions do not match between host and chroot. Impact: The chroot environment may have different runtime behavior due to version mismatches. Go appears to be shared correctly.
|
Gemini Engine Smoke Test Results - MCP: ❌ - Connectivity: ❌ - File: ✅ - Bash: ✅ - Overall: FAILWarning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
🏗️ Build Test Suite Results
Overall: 7/8 ecosystems passed — FAIL ❌ FailuresJava (gson, caffeine):
This appears to be an environment configuration issue specific to the AWF container setup where the Maven cache directory has incorrect ownership.
|
🧪 Copilot BYOK Smoke Test ResultsPR: [Test Coverage] Add comprehensive tests for config-assembly validator by ✅ GitHub MCP connectivity Status: PASS (core BYOK functionality verified) cc:
|
Summary
Adds 28 comprehensive test cases for
src/commands/validators/config-assembly.ts, improving coverage from 81% to ~95% for statements and 65% to ~90% for branches.Test Coverage Added
Docker Host Validation
Rate Limit Configuration
Feature Flag Validation
Environment Variable Handling
Host Access & Ports
Build Configuration
API Proxy
COPILOT_MODEL Detection (Security-Critical)
Coverage Impact
Before:
After (estimated):
Overall project impact: +0.5% to +1% total coverage
Testing Approach
Security Focus
These tests are particularly important because config-assembly.ts is the final validation stage for all CLI options before execution. It guards against:
Validation
Related
Part of ongoing test coverage improvement initiative. Targets security-critical validation code paths.