[Test Coverage] Add comprehensive tests for image-tag module#2232
[Test Coverage] Add comprehensive tests for image-tag module#2232
Conversation
Cover all previously-uncovered lines in src/image-tag.ts: - Empty/whitespace tag validation (lines 18, 24) - Empty digest entry skip (line 33) - Malformed digest entry errors (line 38) - Invalid digest key validation (line 47) - Invalid runtime image name in buildRuntimeImageRef (line 70) Also adds positive tests for valid inputs, multiple digests, whitespace trimming, and all supported image keys. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Adds missing unit test coverage for the src/image-tag.ts parsing/validation logic used to process --image-tag values (including digest pinning for runtime image references).
Changes:
- Added a new Jest test suite covering
parseImageTagsuccess cases and validation/error branches. - Added tests for
buildRuntimeImageRefto verify digest selection behavior and invalid image-name handling.
Show a summary per file
| File | Description |
|---|---|
src/image-tag.test.ts |
New comprehensive tests for parseImageTag and buildRuntimeImageRef, including digest allowlisting and sha256 format validation. |
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: 1
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Tests expected generateDockerCompose to auto-create ~/.copilot and mount it, but #2114 changed behavior to skip when dir doesn't exist. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (2 files)
Coverage comparison generated by |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The agent was hitting the 6-turn limit when tool calls returned unexpected results, leaving no turns for recovery. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Smoke Test: Copilot BYOK (Offline) Mode
Running in BYOK offline mode ( PR: [Test Coverage] Add comprehensive tests for image-tag module · author: Overall: PARTIAL PASS (MCP + BYOK inference confirmed; pre-step outputs not injected into prompt)
|
|
Smoke Test Results Status: PASS
|
🔬 Smoke Test Results
PR: [Test Coverage] Add comprehensive tests for image-tag module Overall: PARTIAL — MCP ✅, pre-step outputs not injected into prompt.
|
Smoke Test
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.
|
🔍 Chroot Version Comparison Results
Overall: ❌ Not all versions match — Python and Node.js differ between host and chroot environments.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test: GitHub Actions Services Connectivity
Overall: FAIL —
|
Summary
Adds a new test file
src/image-tag.test.tscovering the previously-untestedimage-tag.tsmodule. This module validates and parses--image-tagCLI argument values, including digest pinning for supply-chain security.Coverage Improvement
Before:
image-tag.ts— 80.64% statements, 66.66% branches, 100% functionsAfter:
image-tag.ts— 100% statements, 100% branches, 100% functionsPreviously uncovered lines:
throwwhen raw tag is empty string/whitespacethrowwhen tag portion before first comma is emptycontinuefor empty digest entry (e.g. trailing comma)throwfor malformed entry (no=, empty key, empty value)throwfor unrecognized digest keythrowinbuildRuntimeImageReffor invalid image nameSecurity-Critical Paths Covered
The
image-tagmodule is security-relevant because it validates digest pinning for container images. The new tests verify:sha256:<64-hex>digests accepted; uppercase hex, wrong lengths, and non-sha256 schemes all rejectedsquid,agent,agent-act,api-proxy,cli-proxy) accepted as digest keyskey=valueentries throw with clear error messagesbuildRuntimeImageRefname validation — invalid image names rejected with the list of supported namesTests Added (24 tests)
parseImageTagerror pathsbuildRuntimeImageRef(with/without digests, per-image selection, error cases)Validation