Parcourir la source

Fixes for dnephin review

Signed-off-by: Christopher Crone <christopher.crone@docker.com>
Christopher Crone il y a 7 ans
Parent
commit
86f9eb4a08

+ 21 - 13
Dockerfile.e2e

@@ -1,3 +1,4 @@
+## Step 1: Build tests
 FROM golang:1.8.3-alpine3.6 as builder
 FROM golang:1.8.3-alpine3.6 as builder
 
 
 RUN apk add --update \
 RUN apk add --update \
@@ -11,26 +12,31 @@ RUN apk add --update \
 RUN mkdir -p /go/src/github.com/docker/docker/
 RUN mkdir -p /go/src/github.com/docker/docker/
 WORKDIR /go/src/github.com/docker/docker/
 WORKDIR /go/src/github.com/docker/docker/
 
 
-COPY contrib contrib
+# Generate frozen images
+COPY contrib/download-frozen-image-v2.sh contrib/download-frozen-image-v2.sh
 RUN contrib/download-frozen-image-v2.sh /output/docker-frozen-images \
 RUN contrib/download-frozen-image-v2.sh /output/docker-frozen-images \
   buildpack-deps:jessie@sha256:85b379ec16065e4fe4127eb1c5fb1bcc03c559bd36dbb2e22ff496de55925fa6 \
   buildpack-deps:jessie@sha256:85b379ec16065e4fe4127eb1c5fb1bcc03c559bd36dbb2e22ff496de55925fa6 \
   busybox:latest@sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f \
   busybox:latest@sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f \
   debian:jessie@sha256:72f784399fd2719b4cb4e16ef8e369a39dc67f53d978cd3e2e7bf4e502c7b793 \
   debian:jessie@sha256:72f784399fd2719b4cb4e16ef8e369a39dc67f53d978cd3e2e7bf4e502c7b793 \
   hello-world:latest@sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
   hello-world:latest@sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
 
 
-ARG DOCKER_GITCOMMIT
+# Download Docker CLI binary
+COPY hack/dockerfile hack/dockerfile
+RUN hack/dockerfile/install-binaries.sh dockercli
 
 
+# Set tag and add sources
+ARG DOCKER_GITCOMMIT
 ENV DOCKER_GITCOMMIT=$DOCKER_GITCOMMIT
 ENV DOCKER_GITCOMMIT=$DOCKER_GITCOMMIT
-
-# integration-cli tests are frozen to 17.06
-# Newer CLI tests can be found in the docker/cli repository
-RUN curl https://download.docker.com/linux/static/stable/x86_64/docker-17.06.2-ce.tgz | tar  xzf - -C /output
-
 ADD . .
 ADD . .
 
 
+# Build DockerSuite.TestBuild* dependency
+RUN CGO_ENABLED=0 go build -o /output/httpserver github.com/docker/docker/contrib/httpserver
+
+# Build the integration tests and copy the resulting binaries to /output/tests
 RUN hack/make.sh build-integration-test-binary
 RUN hack/make.sh build-integration-test-binary
 RUN mkdir -p /output/tests && find . -name test.main -exec cp --parents '{}' /output/tests \;
 RUN mkdir -p /output/tests && find . -name test.main -exec cp --parents '{}' /output/tests \;
 
 
+## Step 2: Generate testing image
 FROM alpine:3.6 as runner
 FROM alpine:3.6 as runner
 
 
 # GNU tar is used for generating the emptyfs image
 # GNU tar is used for generating the emptyfs image
@@ -47,15 +53,17 @@ RUN apk add --update \
 # Add an unprivileged user to be used for tests which need it
 # Add an unprivileged user to be used for tests which need it
 RUN addgroup docker && adduser -D -G docker unprivilegeduser -s /bin/ash
 RUN addgroup docker && adduser -D -G docker unprivilegeduser -s /bin/ash
 
 
-ENV DOCKER_E2E=1 DOCKER_REMOTE_DAEMON=1 DOCKER_INTEGRATION_DAEMON_DEST=/
+COPY contrib/httpserver/Dockerfile /tests/contrib/httpserver/Dockerfile
+COPY contrib/syscall-test /tests/contrib/syscall-test
+COPY hack/test/e2e-run.sh /run.sh
+COPY hack/make/.ensure-emptyfs /ensure-emptyfs.sh
+COPY integration-cli/fixtures /tests/integration-cli/fixtures
 
 
-COPY --from=builder /output/docker/docker /usr/bin/docker
 COPY --from=builder /output/docker-frozen-images /docker-frozen-images
 COPY --from=builder /output/docker-frozen-images /docker-frozen-images
+COPY --from=builder /output/httpserver /tests/contrib/httpserver/httpserver
 COPY --from=builder /output/tests /tests
 COPY --from=builder /output/tests /tests
+COPY --from=builder /usr/local/bin/docker /usr/bin/docker
 
 
-COPY contrib /tests/contrib
-COPY hack/make/.ensure-emptyfs /ensure-emptyfs.sh
-COPY integration-cli/fixtures /tests/integration-cli/fixtures
-COPY internal/e2e/run.sh /run.sh
+ENV DOCKER_E2E=1 DOCKER_REMOTE_DAEMON=1 DOCKER_INTEGRATION_DAEMON_DEST=/
 
 
 ENTRYPOINT ["/run.sh"]
 ENTRYPOINT ["/run.sh"]

+ 2 - 0
internal/e2e/run.sh → hack/test/e2e-run.sh

@@ -1,6 +1,8 @@
 #!/usr/bin/env bash
 #!/usr/bin/env bash
 set -e
 set -e
 
 
+export DOCKER_ENGINE_GOARCH=${DOCKER_ENGINE_GOARCH:-amd64}
+
 echo "Ensure emptyfs image is loaded"
 echo "Ensure emptyfs image is loaded"
 bash /ensure-emptyfs.sh
 bash /ensure-emptyfs.sh
 
 

+ 22 - 15
integration-cli/cli/build/fakestorage/fixtures.go

@@ -39,27 +39,34 @@ func ensureHTTPServerImage(t testingT) {
 		goarch = "amd64"
 		goarch = "amd64"
 	}
 	}
 
 
-	goCmd, lookErr := exec.LookPath("go")
+	cpCmd, lookErr := exec.LookPath("cp")
 	if lookErr != nil {
 	if lookErr != nil {
 		t.Fatalf("could not build http server: %v", lookErr)
 		t.Fatalf("could not build http server: %v", lookErr)
 	}
 	}
 
 
-	cmd := exec.Command(goCmd, "build", "-o", filepath.Join(tmp, "httpserver"), "github.com/docker/docker/contrib/httpserver")
-	cmd.Env = append(os.Environ(), []string{
-		"CGO_ENABLED=0",
-		"GOOS=" + goos,
-		"GOARCH=" + goarch,
-	}...)
-	var out []byte
-	if out, err = cmd.CombinedOutput(); err != nil {
-		t.Fatalf("could not build http server: %s", string(out))
-	}
+	if _, err = os.Stat("../contrib/httpserver/httpserver"); os.IsNotExist(err) {
+		goCmd, lookErr := exec.LookPath("go")
+		if lookErr != nil {
+			t.Fatalf("could not build http server: %v", lookErr)
+		}
 
 
-	cpCmd, lookErr := exec.LookPath("cp")
-	if lookErr != nil {
-		t.Fatalf("could not build http server: %v", lookErr)
+		cmd := exec.Command(goCmd, "build", "-o", filepath.Join(tmp, "httpserver"), "github.com/docker/docker/contrib/httpserver")
+		cmd.Env = append(os.Environ(), []string{
+			"CGO_ENABLED=0",
+			"GOOS=" + goos,
+			"GOARCH=" + goarch,
+		}...)
+		var out []byte
+		if out, err = cmd.CombinedOutput(); err != nil {
+			t.Fatalf("could not build http server: %s", string(out))
+		}
+	} else {
+		if out, err := exec.Command(cpCmd, "../contrib/httpserver/httpserver", filepath.Join(tmp, "httpserver")).CombinedOutput(); err != nil {
+			t.Fatalf("could not copy http server: %v", string(out))
+		}
 	}
 	}
-	if out, err = exec.Command(cpCmd, "../contrib/httpserver/Dockerfile", filepath.Join(tmp, "Dockerfile")).CombinedOutput(); err != nil {
+
+	if out, err := exec.Command(cpCmd, "../contrib/httpserver/Dockerfile", filepath.Join(tmp, "Dockerfile")).CombinedOutput(); err != nil {
 		t.Fatalf("could not build http server: %v", string(out))
 		t.Fatalf("could not build http server: %v", string(out))
 	}
 	}
 
 

+ 2 - 18
integration-cli/docker_api_build_test.go

@@ -27,8 +27,7 @@ import (
 )
 )
 
 
 func (s *DockerSuite) TestBuildAPIDockerFileRemote(c *check.C) {
 func (s *DockerSuite) TestBuildAPIDockerFileRemote(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, NotUserNamespace, NotE2E)
+	testRequires(c, NotUserNamespace)
 
 
 	var testD string
 	var testD string
 	if testEnv.DaemonPlatform() == "windows" {
 	if testEnv.DaemonPlatform() == "windows" {
@@ -59,9 +58,6 @@ RUN find /tmp/`
 }
 }
 
 
 func (s *DockerSuite) TestBuildAPIRemoteTarballContext(c *check.C) {
 func (s *DockerSuite) TestBuildAPIRemoteTarballContext(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, NotE2E)
-
 	buffer := new(bytes.Buffer)
 	buffer := new(bytes.Buffer)
 	tw := tar.NewWriter(buffer)
 	tw := tar.NewWriter(buffer)
 	defer tw.Close()
 	defer tw.Close()
@@ -93,9 +89,6 @@ func (s *DockerSuite) TestBuildAPIRemoteTarballContext(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestBuildAPIRemoteTarballContextWithCustomDockerfile(c *check.C) {
 func (s *DockerSuite) TestBuildAPIRemoteTarballContextWithCustomDockerfile(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, NotE2E)
-
 	buffer := new(bytes.Buffer)
 	buffer := new(bytes.Buffer)
 	tw := tar.NewWriter(buffer)
 	tw := tar.NewWriter(buffer)
 	defer tw.Close()
 	defer tw.Close()
@@ -150,8 +143,6 @@ RUN echo 'right'
 }
 }
 
 
 func (s *DockerSuite) TestBuildAPILowerDockerfile(c *check.C) {
 func (s *DockerSuite) TestBuildAPILowerDockerfile(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, NotE2E)
 	git := fakegit.New(c, "repo", map[string]string{
 	git := fakegit.New(c, "repo", map[string]string{
 		"dockerfile": `FROM busybox
 		"dockerfile": `FROM busybox
 RUN echo from dockerfile`,
 RUN echo from dockerfile`,
@@ -170,9 +161,6 @@ RUN echo from dockerfile`,
 }
 }
 
 
 func (s *DockerSuite) TestBuildAPIBuildGitWithF(c *check.C) {
 func (s *DockerSuite) TestBuildAPIBuildGitWithF(c *check.C) {
-	// E2E: Test requires go and contrib source.
-	testRequires(c, NotE2E)
-
 	git := fakegit.New(c, "repo", map[string]string{
 	git := fakegit.New(c, "repo", map[string]string{
 		"baz": `FROM busybox
 		"baz": `FROM busybox
 RUN echo from baz`,
 RUN echo from baz`,
@@ -194,8 +182,7 @@ RUN echo from Dockerfile`,
 }
 }
 
 
 func (s *DockerSuite) TestBuildAPIDoubleDockerfile(c *check.C) {
 func (s *DockerSuite) TestBuildAPIDoubleDockerfile(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, UnixCli, NotE2E) // dockerfile overwrites Dockerfile on Windows
+	testRequires(c, UnixCli) // dockerfile overwrites Dockerfile on Windows
 	git := fakegit.New(c, "repo", map[string]string{
 	git := fakegit.New(c, "repo", map[string]string{
 		"Dockerfile": `FROM busybox
 		"Dockerfile": `FROM busybox
 RUN echo from Dockerfile`,
 RUN echo from Dockerfile`,
@@ -380,9 +367,6 @@ func (s *DockerRegistrySuite) TestBuildCopyFromForcePull(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestBuildAddRemoteNoDecompress(c *check.C) {
 func (s *DockerSuite) TestBuildAddRemoteNoDecompress(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, NotE2E)
-
 	buffer := new(bytes.Buffer)
 	buffer := new(bytes.Buffer)
 	tw := tar.NewWriter(buffer)
 	tw := tar.NewWriter(buffer)
 	dt := []byte("contents")
 	dt := []byte("contents")

+ 1 - 1
integration-cli/docker_api_containers_test.go

@@ -1372,7 +1372,7 @@ func (s *DockerSuite) TestContainerAPICreateNoHostConfig118(c *check.C) {
 		Image: "busybox",
 		Image: "busybox",
 	}
 	}
 
 
-	cli, err := NewEnvClientWithVersion("v1.18")
+	cli, err := request.NewEnvClientWithVersion("v1.18")
 
 
 	_, err = cli.ContainerCreate(context.Background(), &config, &containertypes.HostConfig{}, &networktypes.NetworkingConfig{}, "")
 	_, err = cli.ContainerCreate(context.Background(), &config, &containertypes.HostConfig{}, &networktypes.NetworkingConfig{}, "")
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)

+ 1 - 1
integration-cli/docker_api_images_test.go

@@ -180,7 +180,7 @@ func (s *DockerSuite) TestAPIImagesSizeCompatibility(c *check.C) {
 		Labels      map[string]string
 		Labels      map[string]string
 	}
 	}
 
 
-	cli, err = NewEnvClientWithVersion("v1.24")
+	cli, err = request.NewEnvClientWithVersion("v1.24")
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)
 	defer cli.Close()
 	defer cli.Close()
 
 

+ 2 - 1
integration-cli/docker_api_inspect_unix_test.go

@@ -6,6 +6,7 @@ import (
 	"encoding/json"
 	"encoding/json"
 
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/checker"
+	"github.com/docker/docker/integration-cli/request"
 	"github.com/go-check/check"
 	"github.com/go-check/check"
 	"golang.org/x/net/context"
 	"golang.org/x/net/context"
 )
 )
@@ -17,7 +18,7 @@ func (s *DockerSuite) TestInspectAPICpusetInConfigPre120(c *check.C) {
 
 
 	name := "cpusetinconfig-pre120"
 	name := "cpusetinconfig-pre120"
 	dockerCmd(c, "run", "--name", name, "--cpuset-cpus", "0", "busybox", "true")
 	dockerCmd(c, "run", "--name", name, "--cpuset-cpus", "0", "busybox", "true")
-	cli, err := NewEnvClientWithVersion("v1.19")
+	cli, err := request.NewEnvClientWithVersion("v1.19")
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)
 	defer cli.Close()
 	defer cli.Close()
 	_, body, err := cli.ContainerInspectWithRaw(context.Background(), name, false)
 	_, body, err := cli.ContainerInspectWithRaw(context.Background(), name, false)

+ 1 - 10
integration-cli/docker_cli_authz_plugin_v2_test.go

@@ -4,7 +4,6 @@ package main
 
 
 import (
 import (
 	"fmt"
 	"fmt"
-	"strings"
 
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/daemon"
 	"github.com/docker/docker/integration-cli/daemon"
@@ -48,8 +47,6 @@ func (s *DockerAuthzV2Suite) TearDownTest(c *check.C) {
 func (s *DockerAuthzV2Suite) TestAuthZPluginAllowNonVolumeRequest(c *check.C) {
 func (s *DockerAuthzV2Suite) TestAuthZPluginAllowNonVolumeRequest(c *check.C) {
 	testRequires(c, DaemonIsLinux, IsAmd64, Network)
 	testRequires(c, DaemonIsLinux, IsAmd64, Network)
 
 
-	existingContainers := ExistingContainerIDs(c)
-
 	// Install authz plugin
 	// Install authz plugin
 	_, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", authzPluginNameWithTag)
 	_, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", authzPluginNameWithTag)
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)
@@ -68,14 +65,8 @@ func (s *DockerAuthzV2Suite) TestAuthZPluginAllowNonVolumeRequest(c *check.C) {
 	}()
 	}()
 
 
 	// Ensure docker run command and accompanying docker ps are successful
 	// Ensure docker run command and accompanying docker ps are successful
-	out, err := s.d.Cmd("run", "-d", "busybox", "top")
-	c.Assert(err, check.IsNil)
-
-	id := strings.TrimSpace(out)
-
-	out, err = s.d.Cmd("ps")
+	_, err = s.d.Cmd("run", "-d", "busybox", "top")
 	c.Assert(err, check.IsNil)
 	c.Assert(err, check.IsNil)
-	c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), []string{id}), check.Equals, true)
 }
 }
 
 
 func (s *DockerAuthzV2Suite) TestAuthZPluginDisable(c *check.C) {
 func (s *DockerAuthzV2Suite) TestAuthZPluginDisable(c *check.C) {

+ 0 - 8
integration-cli/docker_cli_authz_unix_test.go

@@ -204,8 +204,6 @@ func (s *DockerAuthzSuite) TearDownSuite(c *check.C) {
 }
 }
 
 
 func (s *DockerAuthzSuite) TestAuthZPluginAllowRequest(c *check.C) {
 func (s *DockerAuthzSuite) TestAuthZPluginAllowRequest(c *check.C) {
-	existingContainers := ExistingContainerIDs(c)
-
 	// start the daemon and load busybox, --net=none build fails otherwise
 	// start the daemon and load busybox, --net=none build fails otherwise
 	// cause it needs to pull busybox
 	// cause it needs to pull busybox
 	s.d.Start(c, "--authorization-plugin="+testAuthZPlugin)
 	s.d.Start(c, "--authorization-plugin="+testAuthZPlugin)
@@ -220,12 +218,6 @@ func (s *DockerAuthzSuite) TestAuthZPluginAllowRequest(c *check.C) {
 	id := strings.TrimSpace(out)
 	id := strings.TrimSpace(out)
 	assertURIRecorded(c, s.ctrl.requestsURIs, "/containers/create")
 	assertURIRecorded(c, s.ctrl.requestsURIs, "/containers/create")
 	assertURIRecorded(c, s.ctrl.requestsURIs, fmt.Sprintf("/containers/%s/start", id))
 	assertURIRecorded(c, s.ctrl.requestsURIs, fmt.Sprintf("/containers/%s/start", id))
-
-	out, err = s.d.Cmd("ps")
-	c.Assert(err, check.IsNil)
-	c.Assert(assertContainerList(RemoveOutputForExistingElements(out, existingContainers), []string{id}), check.Equals, true)
-	c.Assert(s.ctrl.psRequestCnt, check.Equals, 1)
-	c.Assert(s.ctrl.psResponseCnt, check.Equals, 1)
 }
 }
 
 
 func (s *DockerAuthzSuite) TestAuthZPluginTls(c *check.C) {
 func (s *DockerAuthzSuite) TestAuthZPluginTls(c *check.C) {

+ 2 - 25
integration-cli/docker_cli_build_test.go

@@ -368,8 +368,7 @@ ONBUILD ENTRYPOINT ["echo"]`))
 }
 }
 
 
 func (s *DockerSuite) TestBuildCacheAdd(c *check.C) {
 func (s *DockerSuite) TestBuildCacheAdd(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, DaemonIsLinux, NotE2E) // Windows doesn't have httpserver image yet
+	testRequires(c, DaemonIsLinux) // Windows doesn't have httpserver image yet
 	name := "testbuildtwoimageswithadd"
 	name := "testbuildtwoimageswithadd"
 	server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{
 	server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{
 		"robots.txt": "hello",
 		"robots.txt": "hello",
@@ -389,9 +388,6 @@ func (s *DockerSuite) TestBuildCacheAdd(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestBuildLastModified(c *check.C) {
 func (s *DockerSuite) TestBuildLastModified(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, NotE2E)
-
 	// Temporary fix for #30890. TODO @jhowardmsft figure out what
 	// Temporary fix for #30890. TODO @jhowardmsft figure out what
 	// has changed in the master busybox image.
 	// has changed in the master busybox image.
 	testRequires(c, DaemonIsLinux)
 	testRequires(c, DaemonIsLinux)
@@ -521,8 +517,7 @@ RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio'
 }
 }
 
 
 func (s *DockerSuite) TestBuildCopyAddMultipleFiles(c *check.C) {
 func (s *DockerSuite) TestBuildCopyAddMultipleFiles(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, DaemonIsLinux, NotE2E) // Linux specific test
+	testRequires(c, DaemonIsLinux) // Linux specific test
 	server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{
 	server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{
 		"robots.txt": "hello",
 		"robots.txt": "hello",
 	}))
 	}))
@@ -637,9 +632,6 @@ RUN find "test6" "C:/test dir/test_file6"`
 }
 }
 
 
 func (s *DockerSuite) TestBuildCopyWildcard(c *check.C) {
 func (s *DockerSuite) TestBuildCopyWildcard(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, NotE2E)
-
 	name := "testcopywildcard"
 	name := "testcopywildcard"
 	server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{
 	server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{
 		"robots.txt": "hello",
 		"robots.txt": "hello",
@@ -1935,9 +1927,6 @@ func (s *DockerSuite) TestBuildAddCurrentDirWithoutCache(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestBuildAddRemoteFileWithAndWithoutCache(c *check.C) {
 func (s *DockerSuite) TestBuildAddRemoteFileWithAndWithoutCache(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, NotE2E)
-
 	name := "testbuildaddremotefilewithcache"
 	name := "testbuildaddremotefilewithcache"
 	server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{
 	server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{
 		"baz": "hello",
 		"baz": "hello",
@@ -1963,9 +1952,6 @@ func (s *DockerSuite) TestBuildAddRemoteFileWithAndWithoutCache(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestBuildAddRemoteFileMTime(c *check.C) {
 func (s *DockerSuite) TestBuildAddRemoteFileMTime(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, NotE2E)
-
 	name := "testbuildaddremotefilemtime"
 	name := "testbuildaddremotefilemtime"
 	name2 := name + "2"
 	name2 := name + "2"
 	name3 := name + "3"
 	name3 := name + "3"
@@ -2009,9 +1995,6 @@ func (s *DockerSuite) TestBuildAddRemoteFileMTime(c *check.C) {
 
 
 // FIXME(vdemeester) this really seems to test the same thing as before (combined)
 // FIXME(vdemeester) this really seems to test the same thing as before (combined)
 func (s *DockerSuite) TestBuildAddLocalAndRemoteFilesWithAndWithoutCache(c *check.C) {
 func (s *DockerSuite) TestBuildAddLocalAndRemoteFilesWithAndWithoutCache(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, NotE2E)
-
 	name := "testbuildaddlocalandremotefilewithcache"
 	name := "testbuildaddlocalandremotefilewithcache"
 	server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{
 	server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{
 		"baz": "hello",
 		"baz": "hello",
@@ -3112,9 +3095,6 @@ func (s *DockerSuite) TestBuildFromGitWithF(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestBuildFromRemoteTarball(c *check.C) {
 func (s *DockerSuite) TestBuildFromRemoteTarball(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, NotE2E)
-
 	name := "testbuildfromremotetarball"
 	name := "testbuildfromremotetarball"
 
 
 	buffer := new(bytes.Buffer)
 	buffer := new(bytes.Buffer)
@@ -3781,9 +3761,6 @@ func (s *DockerSuite) TestBuildFromMixedcaseDockerfile(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestBuildFromURLWithF(c *check.C) {
 func (s *DockerSuite) TestBuildFromURLWithF(c *check.C) {
-	// E2E: Requires built httpserver.
-	testRequires(c, NotE2E)
-
 	server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{"baz": `FROM busybox
 	server := fakestorage.New(c, "", fakecontext.WithFiles(map[string]string{"baz": `FROM busybox
 RUN echo from baz
 RUN echo from baz
 COPY * /tmp/
 COPY * /tmp/

+ 4 - 4
integration-cli/docker_cli_health_test.go

@@ -39,7 +39,7 @@ func getHealth(c *check.C, name string) *types.Health {
 func (s *DockerSuite) TestHealth(c *check.C) {
 func (s *DockerSuite) TestHealth(c *check.C) {
 	testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows
 	testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows
 
 
-	existingContainers := ExistingContainerNames(c)
+	existingContainers := ExistingContainerIDs(c)
 
 
 	imageName := "testhealth"
 	imageName := "testhealth"
 	buildImageSuccessfully(c, imageName, build.WithDockerfile(`FROM busybox
 	buildImageSuccessfully(c, imageName, build.WithDockerfile(`FROM busybox
@@ -51,10 +51,10 @@ func (s *DockerSuite) TestHealth(c *check.C) {
 
 
 	// No health status before starting
 	// No health status before starting
 	name := "test_health"
 	name := "test_health"
-	dockerCmd(c, "create", "--name", name, imageName)
-	out, _ := dockerCmd(c, "ps", "-a", "--format={{.Status}}")
+	cid, _ := dockerCmd(c, "create", "--name", name, imageName)
+	out, _ := dockerCmd(c, "ps", "-a", "--format={{.ID}} {{.Status}}")
 	out = RemoveOutputForExistingElements(out, existingContainers)
 	out = RemoveOutputForExistingElements(out, existingContainers)
-	c.Check(out, checker.Equals, "Created\n")
+	c.Check(out, checker.Equals, cid[:12]+" Created\n")
 
 
 	// Inspect the options
 	// Inspect the options
 	out, _ = dockerCmd(c, "inspect",
 	out, _ = dockerCmd(c, "inspect",

+ 2 - 1
integration-cli/docker_cli_kill_test.go

@@ -6,6 +6,7 @@ import (
 
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/cli"
+	"github.com/docker/docker/integration-cli/request"
 	"github.com/go-check/check"
 	"github.com/go-check/check"
 	"github.com/gotestyourself/gotestyourself/icmd"
 	"github.com/gotestyourself/gotestyourself/icmd"
 	"golang.org/x/net/context"
 	"golang.org/x/net/context"
@@ -129,7 +130,7 @@ func (s *DockerSuite) TestKillStoppedContainerAPIPre120(c *check.C) {
 	testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
 	testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
 	runSleepingContainer(c, "--name", "docker-kill-test-api", "-d")
 	runSleepingContainer(c, "--name", "docker-kill-test-api", "-d")
 	dockerCmd(c, "stop", "docker-kill-test-api")
 	dockerCmd(c, "stop", "docker-kill-test-api")
-	cli, err := NewEnvClientWithVersion("v1.19")
+	cli, err := request.NewEnvClientWithVersion("v1.19")
 	c.Assert(err, check.IsNil)
 	c.Assert(err, check.IsNil)
 	defer cli.Close()
 	defer cli.Close()
 	err = cli.ContainerKill(context.Background(), "docker-kill-test-api", "SIGKILL")
 	err = cli.ContainerKill(context.Background(), "docker-kill-test-api", "SIGKILL")

+ 1 - 0
integration-cli/docker_cli_port_test.go

@@ -149,6 +149,7 @@ func (s *DockerSuite) TestPortList(c *check.C) {
 
 
 	out, _ = dockerCmd(c, "port", ID)
 	out, _ = dockerCmd(c, "port", ID)
 
 
+	// Running this test multiple times causes the TCP port to increment.
 	err = assertPortRange(c, out, []int{8000, 8080}, []int{8000, 8080})
 	err = assertPortRange(c, out, []int{8000, 8080}, []int{8000, 8080})
 	// Port list is not correct
 	// Port list is not correct
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)

+ 1 - 1
integration-cli/docker_utils_test.go

@@ -372,7 +372,7 @@ func waitInspectWithArgs(name, expr, expected string, timeout time.Duration, arg
 }
 }
 
 
 func getInspectBody(c *check.C, version, id string) []byte {
 func getInspectBody(c *check.C, version, id string) []byte {
-	cli, err := NewEnvClientWithVersion(version)
+	cli, err := request.NewEnvClientWithVersion(version)
 	c.Assert(err, check.IsNil)
 	c.Assert(err, check.IsNil)
 	defer cli.Close()
 	defer cli.Close()
 	_, body, err := cli.ContainerInspectWithRaw(context.Background(), id, false)
 	_, body, err := cli.ContainerInspectWithRaw(context.Background(), id, false)

+ 12 - 0
integration-cli/request/request.go

@@ -18,6 +18,7 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/docker/docker/api"
 	"github.com/docker/docker/api"
+	"github.com/docker/docker/api/types"
 	dclient "github.com/docker/docker/client"
 	dclient "github.com/docker/docker/client"
 	"github.com/docker/docker/opts"
 	"github.com/docker/docker/opts"
 	"github.com/docker/docker/pkg/ioutils"
 	"github.com/docker/docker/pkg/ioutils"
@@ -323,3 +324,14 @@ func DaemonHost() string {
 	}
 	}
 	return daemonURLStr
 	return daemonURLStr
 }
 }
+
+// NewEnvClientWithVersion returns a docker client with a specified version.
+// See: github.com/docker/docker/client `NewEnvClient()`
+func NewEnvClientWithVersion(version string) (*dclient.Client, error) {
+	cli, err := dclient.NewEnvClient()
+	if err != nil {
+		return nil, err
+	}
+	cli.NegotiateAPIVersionPing(types.Ping{APIVersion: version})
+	return cli, nil
+}

+ 1 - 18
integration-cli/utils_test.go

@@ -7,8 +7,6 @@ import (
 	"path/filepath"
 	"path/filepath"
 	"strings"
 	"strings"
 
 
-	"github.com/docker/docker/api/types"
-	"github.com/docker/docker/client"
 	"github.com/docker/docker/pkg/parsers/kernel"
 	"github.com/docker/docker/pkg/parsers/kernel"
 	"github.com/docker/docker/pkg/stringutils"
 	"github.com/docker/docker/pkg/stringutils"
 	"github.com/go-check/check"
 	"github.com/go-check/check"
@@ -185,17 +183,6 @@ func RemoveOutputForExistingElements(output string, existing []string) string {
 	return strings.Join(res, "\n")
 	return strings.Join(res, "\n")
 }
 }
 
 
-// NewEnvClientWithVersion returns a docker client with a specified version.
-// See: github.com/docker/docker/client `NewEnvClient()`
-func NewEnvClientWithVersion(version string) (*client.Client, error) {
-	cli, err := client.NewEnvClient()
-	if err != nil {
-		return nil, err
-	}
-	cli.NegotiateAPIVersionPing(types.Ping{APIVersion: version})
-	return cli, nil
-}
-
 // GetKernelVersion gets the current kernel version.
 // GetKernelVersion gets the current kernel version.
 func GetKernelVersion() *kernel.VersionInfo {
 func GetKernelVersion() *kernel.VersionInfo {
 	v, _ := kernel.ParseRelease(testEnv.DaemonInfo.KernelVersion)
 	v, _ := kernel.ParseRelease(testEnv.DaemonInfo.KernelVersion)
@@ -205,9 +192,5 @@ func GetKernelVersion() *kernel.VersionInfo {
 // CheckKernelVersion checks if current kernel is newer than (or equal to)
 // CheckKernelVersion checks if current kernel is newer than (or equal to)
 // the given version.
 // the given version.
 func CheckKernelVersion(k, major, minor int) bool {
 func CheckKernelVersion(k, major, minor int) bool {
-	v := GetKernelVersion()
-	if kernel.CompareKernelVersion(*v, kernel.VersionInfo{Kernel: k, Major: major, Minor: minor}) < 0 {
-		return false
-	}
-	return true
+	return kernel.CompareKernelVersion(*GetKernelVersion(), kernel.VersionInfo{Kernel: k, Major: major, Minor: minor}) > 0
 }
 }