Skip to content

test(e2e): cover matchIPv4 IP-selection helper - #961

Merged
skevetter merged 2 commits into
mainfrom
integration-test/matchipv4-coverage
Aug 9, 2026
Merged

skevetter merged 2 commits into
mainfrom
integration-test/matchipv4-coverage

Conversation

@devsy-app

@devsy-app devsy-app Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds unit test coverage for the previously-untested matchIPv4 helper in e2e/framework/server_utils.go.

Context

matchIPv4 is a pure helper used by getIP / ServeAgent (the test-only HTTP server that serves the locally-built devsy agent binary to non-Linux CI runners, setting DEVSY_AGENT_URL). It selects an IPv4 address whose classful default mask is /24 (class C, ffffff00) or /8 (class A, ff000000) — class B (/16) is deliberately skipped — so the agent server binds to a reachable LAN address. It had zero test coverage (no server_utils_test.go existed), and its subtle behavior (ignoring the configured subnet mask and using only the IP's classful default mask; returning the network address for *net.IPNet) is easy to regress.

Edge cases covered

  • *net.IPNet class C (192.168.1.0/24) → selected
  • *net.IPNet class A (10.0.0.0/8) → selected
  • *net.IPNet class B (172.16.0.0/16) → not selected (the gap the helper exists to enforce)
  • *net.IPAddr class C → selected
  • IPv6 (fd00::1/64) → not selected
  • Unknown net.Addr type (*net.UDPAddr) → not selected

Tests exercise the real matchIPv4 code path (no mocks).

Logs inspected

Reviewed CI runs for the up-workspaces suite. The failing up-workspaces run (#31305514055) was environmental (signal: killed / OOM), not a code bug, so this run instead closes a real test-coverage gap in the e2e framework rather than patching flakiness.

Verification

  • task cli:format — clean
  • task cli:lint:ci — 0 issues (new-from-patch against origin/main)
  • go test ./e2e/framework/... (incl. TestMatchIPv4*) — PASS
  • task cli:test — unit tests pass; the only failures are the known pre-existing pkg/git TestRepoClone* (stale assertion on origin/main, untouched by this change) and the Ginkgo e2e suites that require Docker/the devsy binary (environmental, not run as unit tests).

This PR was created by an AI agent as part of an automated daily e2e review job.

## Summary

Adds unit test coverage for the previously-untested `matchIPv4` helper in `e2e/framework/server_utils.go`.

## Context

`matchIPv4` is a pure helper used by `getIP` / `ServeAgent` (the test-only HTTP server that serves the locally-built devsy agent binary to non-Linux CI runners, setting `DEVSY_AGENT_URL`). It selects an IPv4 address whose classful default mask is `/24` (class C, `ffffff00`) or `/8` (class A, `ff000000`) — class B (`/16`) is deliberately skipped — so the agent server binds to a reachable LAN address. It had **zero** test coverage (no `server_utils_test.go` existed), and its subtle behavior (ignoring the configured subnet mask and using only the IP's classful default mask; returning the network address for `*net.IPNet`) is easy to regress.

## Edge cases covered

- `*net.IPNet` class C (`192.168.1.0/24`) → selected
- `*net.IPNet` class A (`10.0.0.0/8`) → selected
- `*net.IPNet` class B (`172.16.0.0/16`) → **not** selected (the gap the helper exists to enforce)
- `*net.IPAddr` class C → selected
- IPv6 (`fd00::1/64`) → not selected
- Unknown `net.Addr` type (`*net.UDPAddr`) → not selected

Tests exercise the real `matchIPv4` code path (no mocks).

## Logs inspected

Reviewed CI runs for the `up-workspaces` suite. The failing `up-workspaces` run (#31305514055) was environmental (`signal: killed` / OOM), not a code bug, so this run instead closes a real test-coverage gap in the e2e framework rather than patching flakiness.

## Verification

- `task cli:format` — clean
- `task cli:lint:ci` — `0 issues` (new-from-patch against origin/main)
- `go test ./e2e/framework/...` (incl. `TestMatchIPv4*`) — **PASS**
- `task cli:test` — unit tests pass; the only failures are the known pre-existing `pkg/git` `TestRepoClone*` (stale assertion on origin/main, untouched by this change) and the Ginkgo `e2e` suites that require Docker/the devsy binary (environmental, not run as unit tests).

This PR was created by an AI agent as part of an automated daily e2e review job.
@netlify

netlify Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 5fc174d
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a78b23606f07700088d4f3e

@netlify

netlify Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 5fc174d
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a78b236d649ba0008b3128f

@github-actions github-actions Bot added the size/s label Aug 9, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 6 complexity · 0 duplication

Metric Results
Complexity 6
Duplication 0

View in Codacy

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

Signed-off-by: GitHub <noreply@github.com>
@skevetter
skevetter marked this pull request as ready for review August 9, 2026 17:01
@skevetter
skevetter enabled auto-merge (squash) August 9, 2026 17:01
@skevetter
skevetter merged commit 6f6f417 into main Aug 9, 2026
67 checks passed
@skevetter
skevetter deleted the integration-test/matchipv4-coverage branch August 9, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant