compose/internal/e2e/multiplatform_test.go
Nicolas De Loof 8c67b155ea refactor(e2e): move the e2e framework and tests out of pkg/
The e2e framework (framework.go, scenario.go, checks.go, assert.go) and
the e2e tests lived under pkg/e2e, so the framework was published as part
of the public /v5 API although it is only test support code. Move it to
internal/e2e.

This is a pure move: the files keep their content, only the references to
the old path (Makefile, .golangci.yml, codecov.yml, .gitignore, AGENTS.md
and SCENARIO.md) are updated. internal/e2e is at the same depth as
pkg/e2e, so the relative paths to bin/, relay/ and testdata keep working.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-11-16 15:21:04 +01:00

54 lines
2.2 KiB
Go

//go:build e2e
/*
Copyright 2026 Docker Compose CLI authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package e2e
import (
"testing"
)
func TestCreateLocalMultiPlatformImage(t *testing.T) {
// Regression test for https://github.com/docker/compose/issues/14007
// With the containerd image store, a local multi-platform image holding the
// requested non-native variant satisfies the default "missing" pull policy:
// compose must use it and not try to pull the (unpublished) tag.
s := NewScenario(t, "a local multi-platform image must satisfy the default missing pull policy for a non-native platform").
Requires(ContainerdImageStore)
// request the non-native platform, so the requested variant can't be the
// one a platform-less image inspect reports; the tag deliberately doesn't
// exist on any registry: resolving the requested platform from the local
// image is the only way to succeed
requested := s.NonNativePlatform()
const image = "compose-e2e-multiplatform-local-only:v1"
// `create` exercises the same image-resolution/pull-policy path as `up`,
// without requiring emulation to actually run the non-native binary
s.Env("REQUESTED_PLATFORM="+requested).
Defer(DockerCmd("image", "rm", image)).
Step("store the amd64 variant in the local store",
DockerCmd("pull", "-q", "--platform", "linux/amd64", "alpine:3.22")).
Step("store the arm64 variant in the local store",
DockerCmd("pull", "-q", "--platform", "linux/arm64", "alpine:3.22")).
Step("tag both variants under a tag that exists on no registry",
DockerCmd("tag", "alpine:3.22", image)).
Step("create uses the local variant for the requested platform without pulling",
ComposeCmd("create"),
OutputNotContains("Pulling"),
RunsOnPlatform("repro", requested))
}