Skip to content

fix(localstack): correct gofumpt formatting in s3 test#3

Open
aausch wants to merge 18 commits intothaJeztah:migrate_mobyfrom
aausch:aausch/fix/moby-migration-linting
Open

fix(localstack): correct gofumpt formatting in s3 test#3
aausch wants to merge 18 commits intothaJeztah:migrate_mobyfrom
aausch:aausch/fix/moby-migration-linting

Conversation

@aausch
Copy link
Copy Markdown

@aausch aausch commented Mar 31, 2026

Summary

Test plan

  • golangci-lint run ./... passes in modules/localstack
  • All other changed modules pass linting

🤖 Generated with Claude Code

thaJeztah and others added 18 commits March 31, 2026 12:34
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>
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>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
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>
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>
Signed-off-by: Alex Ausch <alex@ausch.name>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@thaJeztah thaJeztah force-pushed the migrate_moby branch 5 times, most recently from d6c4a2d to bb76dfe Compare April 1, 2026 16:15
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