mirror of
https://github.com/docker/compose.git
synced 2026-09-22 05:24:22 +00:00
Each scenario resolves its project files from testdata/<TestName>/ by convention: standalone compose files in their native format, directly runnable with docker compose -f, copied to a temporary directory so the committed files are never mutated. Subtests map to nested directories. Ownership is strictly one test per directory: a check fails the suite on any testdata directory no test owns, which is what keeps this from degrading into a catch-all fixtures directory — no sharing, no leftovers after a rename. The inline Compose() declaration is removed; the demonstrator scenarios move their models to testdata, including the multi-file build context of TestUpBuildUnchangedContext (compose.yaml + Dockerfile + marker). Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
52 lines
2.2 KiB
Go
52 lines
2.2 KiB
Go
/*
|
|
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))
|
|
}
|