Skip to content

fix: address CI failures and FIXMEs in moby migration#2

Closed
aausch wants to merge 15 commits intothaJeztah:migrate_mobyfrom
aausch:aausch/fix/moby-migration-fixes
Closed

fix: address CI failures and FIXMEs in moby migration#2
aausch wants to merge 15 commits intothaJeztah:migrate_mobyfrom
aausch:aausch/fix/moby-migration-fixes

Conversation

@aausch
Copy link
Copy Markdown

@aausch aausch commented Mar 30, 2026

What does this PR do?

Addresses the CI failures and unresolved FIXMEs from the moby modules migration (testcontainers#3591). Each fix is an independent commit:

  1. fix: correct inverted port condition in HTTP wait strategywait/http.go:194 had !ws.Port.IsZero() instead of ws.Port.IsZero(), causing the HTTP wait strategy to take the wrong code path (inspect vs MappedPort)
  2. fix: re-enable build log streaming with moby jsonmessage APIjsonmessage.DisplayJSONMessagesStream was commented out during migration; without consuming the build response stream, images were never built, causing "No such image: UUID" errors across many tests
  3. fix(ollama): restore stdcopy multiplexing for local processstdcopy.NewStdWriter is no longer exported from moby; added a local stdWriter that produces the same Docker-multiplexed frame format so stdcopy.StdCopy can still demux stdout/stderr
  4. chore: resolve FIXME comment on MappedPort empty string handling — documented that the old nat.Port type accepted empty strings (verified via SplitProtoPort), added TestMappedPortEmptyString
  5. deps: go mod tidy across modules for moby/term — propagated moby/term dependency to all modules
  6. fix: restore correct container state in HTTP wait strategy tests — migration changed Status: "dead" to container.StateRunning instead of container.StateDead
  7. fix: use network.List.Items in network test assertionNetworkList now returns network.List (struct), not a slice
  8. fix: make MergeCustomLabels validate all keys before merging — Go map iteration order made the old single-pass validate+merge flaky; split into validate-then-merge
  9. fix(nebulagraph): retry network removal on active endpoints race — containers not fully disconnected before network removal; retry up to 3x with 500ms delay
  10. fix(ollama): correct local process Inspect and test type mismatchesNetworks should be empty map, Proto() returns network.IPProtocol not string, HostIP is netip.Addr not string
  11. fix: skip host network tests on colimaSkipIfDockerDesktop didn't account for colima (also a VM-based Docker environment where host networking doesn't work)

Related issues

🤖 Generated with Claude Code

thaJeztah and others added 15 commits March 30, 2026 15:26
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The IsZero() branch was inverted during the moby migration, causing the
HTTP wait strategy to inspect the container when a specific port was
requested and vice versa.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The jsonmessage.DisplayJSONMessagesStream and term.GetFdInfo calls were
commented out during the moby migration. The equivalent APIs exist at
github.com/moby/moby/client/pkg/jsonmessage and github.com/moby/term.
Without this, build errors are silently swallowed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
stdcopy.NewStdWriter is no longer exported from moby. Add a local
stdWriter that produces the same Docker-multiplexed frame format
(8-byte header + payload), so that stdcopy.StdCopy can still demux
stdout/stderr when reading logs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The old nat.Port type (a plain string) accepted empty strings:
SplitProtoPort("") returns ("", ""), so Port() == "" and no container
port matches, yielding "not found". The empty-string guard preserves
that behavior while avoiding a ParsePort error.

Add a test to verify MappedPort("") returns ErrNotFound.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Commit 05e8f91 added github.com/moby/term as a direct dependency in
the root go.mod. All modules that depend on the core need their go.sum
updated to include the transitive moby/term and Azure/go-ansiterm
checksums, otherwise they fail at build time with:
  missing go.sum entry for module providing package github.com/moby/term

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
During the moby migration, two test mocks were incorrectly updated:

1. TestHttpStrategyFailsWhileGettingPortDueToUnexpectedContainerStatus:
   Status was changed from "dead" to container.StateRunning. The test
   intent is to simulate a dead container — fixed to container.StateDead.

2. TestHttpStrategyFailsWhileRequestSendingDueToUnexpectedContainerStatus:
   Status was correctly set to container.StateDead, but the expected
   error message was changed from "dead" to "running" — reverted.

Both tests originally used Status: "dead" (bare string). The old
docker/docker container.State.Status was a plain string field; the new
moby type uses the ContainerState enum. The migration should have used
container.StateDead ("dead"), not container.StateRunning ("running").

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The moby migration changed client.NetworkList() return type from
[]network.Inspect (a slice) to network.List (a struct). The test
called require.Len() on the struct, which fails because len() can't
be applied to a struct. The .Items field (already used on the next
line) holds the actual slice.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
MergeCustomLabels previously validated and merged in a single pass. If
a reserved-prefix key was encountered partway through iteration, some
keys would already be merged while others would not. Since Go map
iteration order is non-deterministic, this produced flaky test results
— the test assumed "B" was always merged before the invalid LabelLang
key was encountered.

Split into two passes: validate all keys first, then merge with
maps.Copy. On error, dst is now guaranteed to be unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
After container termination, Docker may not have fully disconnected
endpoints from the network yet. The moby client surfaces this as
"has active endpoints" on NetworkRemove. This race was latent with
the old docker/docker client but is now consistently triggered.

Retry up to 3 times with a 500ms delay when the error indicates
active endpoints remain.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three issues from the moby migration in the ollama local process:

1. Inspect() populated Networks with a "bridge" entry, but the old code
   used an empty map (bridge info was in the deprecated
   NetworkSettingsBase.Bridge field). Restored empty map.

2. Tests compared port.Proto() (network.IPProtocol) to "tcp" (string).
   The old nat.Port.Proto() returned string; the new network.Port.Proto()
   returns network.IPProtocol. Fixed to compare against network.TCP.

3. Tests compared port[0].HostIP (netip.Addr) to "127.0.0.1" (string).
   The old PortBinding.HostIP was string; the new one is netip.Addr.
   Fixed to compare against netip.MustParseAddr(testHost).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
SkipIfDockerDesktop only checked for Docker Desktop by OS name, but
colima also runs Docker inside a Linux VM where host networking doesn't
work. Detect colima via DOCKER_HOST containing "colima" and skip early.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aausch aausch force-pushed the aausch/fix/moby-migration-fixes branch from 26376eb to ab76469 Compare March 30, 2026 17:06
@thaJeztah
Copy link
Copy Markdown
Owner

Thanks! My branch needed a rebase, and I had some pending changes, so I rebased your branch and added it in my PR (probably the PR will need some squashing / cleaning up, but let's see what CI says now 😄)

@thaJeztah thaJeztah closed this Mar 31, 2026
@aausch
Copy link
Copy Markdown
Author

aausch commented Mar 31, 2026

Thanks! My branch needed a rebase, and I had some pending changes, so I rebased your branch and added it in my PR (probably the PR will need some squashing / cleaning up, but let's see what CI says now 😄)

🤦 I think my linters misfired

@aausch
Copy link
Copy Markdown
Author

aausch commented Mar 31, 2026

#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants