pack/acceptance
Juan Bustamante 812530673f
chore: migrate from docker/docker to moby/moby client (#2512)
* chore: migrate from docker/docker to moby/moby client

Migrates all Docker client usage from github.com/docker/docker to
github.com/moby/moby/client following imgutil's PR #299 migration.

Key changes:
- Updated all DockerClient interfaces to use moby Result types
  (ImageHistoryResult, ContainerInspectResult, etc.)
- Migrated to Options pattern for API calls (ImagePullOptions,
  ContainerInspectOptions, etc.)
- Updated Result field access patterns (result.Items, result.Info, etc.)
- Fixed platform validation by passing dist.Target directly to
  ImagePull instead of string conversion
- Regenerated mocks for moby's APIClient interface
- Updated test assertions for moby's type system changes
- Fixed go.mod dependencies (moby packages now direct)

All tests passing (304 tests across pkg/client, pkg/image, internal/build).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* chore: migrate acceptance test manager to moby client

Updated acceptance/managers/image_manager.go to use the new moby client API.

Key changes:
- Updated imports from github.com/docker/docker to github.com/moby/moby
- Changed dockerCli type from client.APIClient to *client.Client
- Updated method signatures to use Options pattern:
  - Info() now requires client.InfoOptions{} and accesses .Info.OSType
  - ImageTag() uses client.ImageTagOptions with Source/Target fields
  - ImageInspect() returns Result type, access .InspectResponse field
  - ContainerCreate() uses client.ContainerCreateOptions struct
  - ContainerStart() uses client.ContainerStartOptions{}
  - ContainerKill() uses client.ContainerKillOptions{Signal: "SIGKILL"}
  - ContainerRemove() uses client.ContainerRemoveOptions{Force: true}
  - ContainerInspect() requires client.ContainerInspectOptions{} and returns Result
- Updated network port types:
  - Use network.MustParsePort() to create network.Port values
  - Changed from nat.PortSet/PortMap to network.PortSet/PortMap
  - Updated PortBinding from nat.PortBinding to network.PortBinding
- Fixed Result type accesses:
  - ContainerInspect: access result.Container instead of result directly
  - ImageInspect: access result.InspectResponse
  - Info: access result.Info.OSType

This completes the migration from docker/docker to moby/moby client across all test code.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* fix: use concrete Client type in acceptance tests

Changed all dockerCli parameter and variable types from client.APIClient
interface to *client.Client concrete type to match the updated helper
functions and managers that now require the concrete type.

Changes:
- Updated global dockerCli variable type
- Updated createStack() and createStackImage() parameter types
- Changed dockertypes.ImageBuildOptions to client.ImageBuildOptions
- Removed unused github.com/docker/docker/api/types import

This fixes compilation errors where the interface type couldn't be
used as the concrete type without type assertion.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* fixing format issues

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* fix: migrate to client.New() and remove deprecated APIs

Updated all docker client initialization to use the new client.New()
function instead of the deprecated NewClientWithOpts(). The new API
enables API version negotiation by default, so WithAPIVersionNegotiation()
is no longer needed.

Changes:
- Replaced all NewClientWithOpts() calls with New()
- Removed WithAPIVersionNegotiation() option (now default behavior)
- Updated cmd/docker_init.go, pkg/client/client.go, and all test files
- Ran go mod tidy to clean up dependencies

Note: internal/build/testdata/fake-lifecycle/phase.go still uses the old
API since it references the legacy github.com/docker/docker/client package
and is built in a separate container context during tests.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* test: skip report tests for pack versions < v0.40.0

The report tests expect the fixture to show Platform API 0.14 and 0.15,
which are only supported in lifecycle 0.21.0+. Pack versions before
v0.40.0 use lifecycle 0.20.x which only supports Platform APIs up to 0.13.

Added PlatformAPI_0_14 feature flag that checks if pack >= v0.40.0.
The report tests now skip when testing with older pack versions that
don't support Platform APIs 0.14, 0.15.

This fixes the acceptance-combo (current, current, previous) test failure
where current pack (with lifecycle 0.21.0) outputs Platform APIs 0.3-0.15,
but the test was incorrectly expecting 0.3-0.13 due to the fixture override
file that was being picked up.

Removed the pack_previous_fixtures_overrides/report_output.txt file as
the override directory approach didn't work correctly for this test case.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

* fix: add Platform API 0.14 and 0.15 support

When we updated to lifecycle 0.21.0, we updated the fixture file to
expect Platform APIs 0.14 and 0.15, but forgot to update the
SupportedPlatformAPIVersions in the code.

The pack report command reads from build.SupportedPlatformAPIVersions
to display which Platform APIs are supported, so this was causing a
mismatch between the fixture expectation and the actual output.

Changes:
- Added api.MustParse("0.14") and api.MustParse("0.15") to
  SupportedPlatformAPIVersions in internal/build/lifecycle_executor.go
- Removed the PlatformAPI_0_14 feature flag and skip logic from
  acceptance tests (no longer needed)

This fixes the acceptance test failures where the fixture expected
Platform APIs up to 0.15 but pack was only reporting up to 0.13.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>

---------

Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-20 07:20:36 -05:00
..
assertions
buildpacks
config
invoke
managers chore: migrate from docker/docker to moby/moby client (#2512) 2026-01-20 07:20:36 -05:00
os
testconfig
testdata chore: migrate from docker/docker to moby/moby client (#2512) 2026-01-20 07:20:36 -05:00
acceptance_test.go chore: migrate from docker/docker to moby/moby client (#2512) 2026-01-20 07:20:36 -05:00
suite_manager.go