Skip to content

[Test Coverage] Add tests for parseDifcProxyHost and preserveIptablesAudit - #2471

Merged
lpcox merged 1 commit into
mainfrom
test-coverage/parseDifcProxyHost-preserveIptablesAudit-22743bdddcdaff9a
May 4, 2026
Merged

[Test Coverage] Add tests for parseDifcProxyHost and preserveIptablesAudit#2471
lpcox merged 1 commit into
mainfrom
test-coverage/parseDifcProxyHost-preserveIptablesAudit-22743bdddcdaff9a

Conversation

@github-actions

@github-actions github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds unit tests for two exported but previously untested functions in src/docker-manager.ts.

What was covered

parseDifcProxyHost

This function parses --difc-proxy-host values (host:port strings) used to configure the DIFC proxy. Coverage added:

  • Empty / whitespace-only input → returns default host.docker.internal:18443
  • Bare host:port without a scheme
  • Host without a port → default port 18443
  • Scheme prefixes (tcp://, https://) stripped correctly
  • IPv6 bracketed notation [::1]:18443
  • Invalid format throws Invalid --difc-proxy-host
  • Port 0 fails the portNum < 1 guard (throws Invalid --difc-proxy-host port: 0)
  • Port > 65535 fails URL parsing (throws Invalid --difc-proxy-host)
  • Boundary ports 1 and 65535 are accepted

preserveIptablesAudit

This function copies the iptables audit file from workDir/init-signal/iptables-audit.txt to an audit directory. Coverage added:

  • Copies file when both source and target directory exist
  • No-op when source file does not exist
  • No-op when target audit directory does not exist (does not throw)
  • Uses default workDir/audit directory when auditDir is not specified

Before / After Coverage (docker-manager.ts)

Metric Before After (est.)
Statements 87.4% ~88%
Branches 84.4% ~85%
Functions 90.5% ~92%

Security relevance

parseDifcProxyHost is used to configure network routing for the DIFC proxy sidecar. The input validation (port range, format) is security-relevant — malformed values should fail clearly rather than silently falling through. The new tests confirm correct error paths.

Generated by Weekly Test Coverage Improver · ● 4.6M ·

Add unit tests for two exported but previously untested functions in
docker-manager.ts:

- parseDifcProxyHost: tests empty/whitespace input, host:port, host
  without port, scheme prefixes, IPv6 bracketed notation, invalid
  format, port 0, and boundary ports (1, 65535).

- preserveIptablesAudit: tests the copy-when-both-exist path, the
  no-op when source is missing, the no-op when target dir is missing,
  and the default audit dir (workDir/audit) behaviour.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox
lpcox marked this pull request as ready for review May 4, 2026 13:42
@lpcox
lpcox requested a review from Mossaka as a code owner May 4, 2026 13:42
Copilot AI review requested due to automatic review settings May 4, 2026 13:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds unit test coverage for two previously untested exported helpers in src/docker-manager.ts, improving confidence in DIFC proxy host parsing and iptables audit preservation behavior.

Changes:

  • Added unit tests for parseDifcProxyHost covering defaulting, scheme stripping, IPv6 bracket parsing, and invalid/edge port handling.
  • Added unit tests for preserveIptablesAudit covering copy/no-op behavior and default audit directory selection.
Show a summary per file
File Description
src/docker-manager.test.ts Adds new test suites validating parseDifcProxyHost parsing/error cases and preserveIptablesAudit file copy/no-op behavior.

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: 0

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Test Results

  • ✅ GitHub MCP: refactor: remove unused exports from internal modules, Mark DockerService and DockerNetwork interfaces as @internal
  • ✅ Playwright: Page navigation to github.com successful
  • ✅ File Writing: smoke-test-claude-25304467901.txt created
  • ✅ Bash Tool: File verification passed

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Smoke Test Results

Test Status
GitHub MCP connectivity
GitHub.com HTTP connectivity ❌ (pre-step data unavailable — template vars not expanded)
File write/read ❌ (pre-step data unavailable — template vars not expanded)

PR: [Test Coverage] Add tests for parseDifcProxyHost and preserveIptablesAudit
Author: @github-actions[bot] · Reviewers: @Mossaka, @Copilot

Overall: FAIL — pre-computed test data was not injected (workflow template variables were unexpanded).

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

🔥 Smoke Test: Copilot BYOK (Offline) Mode

Test Result
GitHub MCP connectivity ✅ Listed PRs successfully
GitHub.com HTTP ⚠️ Pre-step data unavailable (template vars not substituted)
File write/read ⚠️ Pre-step data unavailable (template vars not substituted)
BYOK inference (agent → api-proxy → api.githubcopilot.com) ✅ Responding now

Running in BYOK offline mode (COPILOT_OFFLINE=true) via api-proxy → api.githubcopilot.com.

Overall: PARTIAL — BYOK inference and MCP ✅; pre-step data tests skipped due to unresolved template variables.

PR by @github-actions[bot] | Reviewer: @Mossaka

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia N/A ❌ FAIL
Bun hono N/A ❌ FAIL
C++ fmt N/A ❌ FAIL
C++ json N/A ❌ FAIL
Deno oak N/A ❌ FAIL
Deno std N/A ❌ FAIL
.NET hello-world N/A ❌ FAIL
.NET json-parse N/A ❌ FAIL
Go color N/A ❌ FAIL
Go env N/A ❌ FAIL
Go uuid N/A ❌ FAIL
Java gson N/A ❌ FAIL
Java caffeine N/A ❌ FAIL
Node.js clsx N/A ❌ FAIL
Node.js execa N/A ❌ FAIL
Node.js p-limit N/A ❌ FAIL
Rust fd N/A ❌ FAIL
Rust zoxide N/A ❌ FAIL

Overall: 0/8 ecosystems passed — ❌ FAIL

❌ Error Details

All repository clones failed. The gh CLI is not authenticated (GH_TOKEN not set in environment).

Error for all ecosystems:

gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable.
EXIT:4

All 8 ecosystems (Bun, C++, Deno, .NET, Go, Java, Node.js, Rust) returned CLONE_FAILED — no tests could be executed.

Generated by Build Test Suite for issue #2471 · ● 142.9K ·

@github-actions github-actions Bot mentioned this pull request May 4, 2026
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

PR titles: unavailable
GitHub MCP review: ❌
safeinputs-gh PR query: ❌
Playwright GitHub title check: ✅
Tavily web search: ❌
Temp file write/read: ✅
Discussion query/comment: ❌
AWF build (npm ci + npm run build): ✅
Overall status: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

Chroot Runtime Version Comparison

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3
Node.js v24.14.1 v20.20.2
Go go1.22.12 go1.22.12

Result: ⚠️ Not all runtimes match. Python and Node.js versions differ between host and chroot. Go matches.

Tested by Smoke Chroot

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Test Results

  • Redis PING: ❌ (timeout — no response from host.docker.internal:6379)
  • PostgreSQL pg_isready: ❌ (no response from host.docker.internal:5432)
  • PostgreSQL SELECT 1: ❌ (skipped — pg unreachable)

Overall: FAIL — service containers unreachable from this runner.

🔌 Service connectivity validated by Smoke Services

@lpcox
lpcox merged commit 88b5e5f into main May 4, 2026
67 of 72 checks passed
@lpcox
lpcox deleted the test-coverage/parseDifcProxyHost-preserveIptablesAudit-22743bdddcdaff9a branch May 4, 2026 14:35
Copilot AI added a commit that referenced this pull request May 4, 2026
- Resolve rename conflict in docker-manager-compose.test.ts (keep split version)
- Remove unused imports from docker-manager-compose.test.ts
- Add parseDifcProxyHost tests to docker-manager-utils.test.ts (from #2471)
- Add preserveIptablesAudit tests to docker-manager-cleanup.test.ts (from #2471)
- Auto-merge log-streamer.ts refactor from #2495
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants