From c08e111af2b989c29675ac5d9d6709bd714f7a1e Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 9 Jun 2021 14:02:19 +0200 Subject: [PATCH] e2e: use docker:dind image as default, as docker:stable-dind is EOL The stable-dind image was stuck on Docker 19.03. Updating to "dind" now gives us docker 20.10. Docker 20.10 fixed an issue with the "docker pull" response previously not including the image name of the image that was pulled. This caused the test to fail, as the .golden file no longer matched. Signed-off-by: Sebastiaan van Stijn --- .github/workflows/e2e.yml | 3 +-- e2e/compose-env.yaml | 2 +- e2e/image/pull_test.go | 2 ++ e2e/image/testdata/pull-with-content-trust.golden | 2 +- internal/test/environment/testenv.go | 6 ++++++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 64b0ac755b1e..af37a4bef41b 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -24,8 +24,7 @@ jobs: - alpine - bullseye engine-version: -# - 20.10-dind # FIXME: Fails on 20.10 - - stable-dind # TODO: Use 20.10-dind, stable-dind is deprecated + - 20.10-dind include: - target: non-experimental engine-version: 19.03-dind diff --git a/e2e/compose-env.yaml b/e2e/compose-env.yaml index a4c700c4654c..bd7616d86620 100644 --- a/e2e/compose-env.yaml +++ b/e2e/compose-env.yaml @@ -5,7 +5,7 @@ services: image: 'registry:2' engine: - image: 'docker:${TEST_ENGINE_VERSION:-stable-dind}' + image: 'docker:${TEST_ENGINE_VERSION:-dind}' privileged: true command: ['--insecure-registry=registry:5000'] environment: diff --git a/e2e/image/pull_test.go b/e2e/image/pull_test.go index 0d12fe68fa57..d94a1d374ea5 100644 --- a/e2e/image/pull_test.go +++ b/e2e/image/pull_test.go @@ -1,6 +1,7 @@ package image import ( + "strings" "testing" "github.com/docker/cli/e2e/internal/fixtures" @@ -16,6 +17,7 @@ const registryPrefix = "registry:5000" func TestPullWithContentTrust(t *testing.T) { skip.If(t, environment.RemoteDaemon()) + skip.If(t, strings.HasPrefix(environment.DaemonVersion(), "19.03"), "skipping on 19.03 daemon, as output format differs") dir := fixtures.SetupConfigFile(t) defer dir.Remove() diff --git a/e2e/image/testdata/pull-with-content-trust.golden b/e2e/image/testdata/pull-with-content-trust.golden index 9cb9a92a1714..12412cb9dec3 100644 --- a/e2e/image/testdata/pull-with-content-trust.golden +++ b/e2e/image/testdata/pull-with-content-trust.golden @@ -1,5 +1,5 @@ Pull (1 of 1): registry:5000/trust-pull:latest@sha256:641b95ddb2ea9dc2af1a0113b6b348ebc20872ba615204fbe12148e98fd6f23d -sha256:641b95ddb2ea9dc2af1a0113b6b348ebc20872ba615204fbe12148e98fd6f23d: Pulling from trust-pull +registry:5000/trust-pull@sha256:641b95ddb2ea9dc2af1a0113b6b348ebc20872ba615204fbe12148e98fd6f23d: Pulling from trust-pull Digest: sha256:641b95ddb2ea9dc2af1a0113b6b348ebc20872ba615204fbe12148e98fd6f23d Status: Downloaded newer image for registry:5000/trust-pull@sha256:641b95ddb2ea9dc2af1a0113b6b348ebc20872ba615204fbe12148e98fd6f23d registry:5000/trust-pull:latest diff --git a/internal/test/environment/testenv.go b/internal/test/environment/testenv.go index a719c1b117df..46ee677a1e45 100644 --- a/internal/test/environment/testenv.go +++ b/internal/test/environment/testenv.go @@ -71,6 +71,12 @@ func boolFromString(val string) bool { // DefaultPollSettings used with gotestyourself/poll var DefaultPollSettings = poll.WithDelay(100 * time.Millisecond) +// DaemonVersion returns the version of the daemon +func DaemonVersion() string { + result := icmd.RunCmd(icmd.Command("docker", "info", "--format", "{{.ServerVersion}}")) + return strings.TrimSpace(result.Stdout()) +} + // SkipIfNotExperimentalDaemon returns whether the test docker daemon is in experimental mode func SkipIfNotExperimentalDaemon(t *testing.T) { t.Helper()