[19.03 backport] Bump Golang 1.12.5
| ... | ... |
@@ -1,5 +1,4 @@ |
| 1 |
-## Step 1: Build tests |
|
| 2 |
-FROM golang:1.12.4-alpine as builder |
|
| 1 |
+FROM golang:1.12.5-alpine as base |
|
| 3 | 2 |
|
| 4 | 3 |
RUN apk --no-cache add \ |
| 5 | 4 |
bash \ |
| ... | ... |
@@ -9,37 +8,55 @@ RUN apk --no-cache add \ |
| 9 | 9 |
lvm2-dev \ |
| 10 | 10 |
jq |
| 11 | 11 |
|
| 12 |
+RUN mkdir -p /build/ |
|
| 12 | 13 |
RUN mkdir -p /go/src/github.com/docker/docker/ |
| 13 | 14 |
WORKDIR /go/src/github.com/docker/docker/ |
| 14 | 15 |
|
| 15 |
-# Generate frozen images |
|
| 16 |
-COPY contrib/download-frozen-image-v2.sh contrib/download-frozen-image-v2.sh |
|
| 17 |
-RUN contrib/download-frozen-image-v2.sh /output/docker-frozen-images \ |
|
| 16 |
+FROM base AS frozen-images |
|
| 17 |
+# Get useful and necessary Hub images so we can "docker load" locally instead of pulling |
|
| 18 |
+COPY contrib/download-frozen-image-v2.sh / |
|
| 19 |
+RUN /download-frozen-image-v2.sh /build \ |
|
| 18 | 20 |
buildpack-deps:jessie@sha256:dd86dced7c9cd2a724e779730f0a53f93b7ef42228d4344b25ce9a42a1486251 \ |
| 19 | 21 |
busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0 \ |
| 20 | 22 |
busybox:glibc@sha256:0b55a30394294ab23b9afd58fab94e61a923f5834fba7ddbae7f8e0c11ba85e6 \ |
| 21 | 23 |
debian:jessie@sha256:287a20c5f73087ab406e6b364833e3fb7b3ae63ca0eb3486555dc27ed32c6e60 \ |
| 22 | 24 |
hello-world:latest@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c |
| 25 |
+# See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list) |
|
| 23 | 26 |
|
| 24 |
-# Install dockercli |
|
| 25 |
-# Please edit hack/dockerfile/install/<name>.installer to update them. |
|
| 26 |
-COPY hack/dockerfile/install hack/dockerfile/install |
|
| 27 |
-RUN ./hack/dockerfile/install/install.sh dockercli |
|
| 28 |
- |
|
| 29 |
-# Set tag and add sources |
|
| 30 |
-ARG DOCKER_GITCOMMIT |
|
| 31 |
-ENV DOCKER_GITCOMMIT=${DOCKER_GITCOMMIT:-undefined}
|
|
| 32 |
-ADD . . |
|
| 27 |
+FROM base AS dockercli |
|
| 28 |
+ENV INSTALL_BINARY_NAME=dockercli |
|
| 29 |
+COPY hack/dockerfile/install/install.sh ./install.sh |
|
| 30 |
+COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./ |
|
| 31 |
+RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME |
|
| 33 | 32 |
|
| 34 | 33 |
# Build DockerSuite.TestBuild* dependency |
| 35 |
-RUN CGO_ENABLED=0 go build -buildmode=pie -o /output/httpserver github.com/docker/docker/contrib/httpserver |
|
| 34 |
+FROM base AS contrib |
|
| 35 |
+COPY contrib/syscall-test /build/syscall-test |
|
| 36 |
+COPY contrib/httpserver/Dockerfile /build/httpserver/Dockerfile |
|
| 37 |
+COPY contrib/httpserver contrib/httpserver |
|
| 38 |
+RUN CGO_ENABLED=0 go build -buildmode=pie -o /build/httpserver/httpserver github.com/docker/docker/contrib/httpserver |
|
| 36 | 39 |
|
| 37 |
-# Build the integration tests and copy the resulting binaries to /output/tests |
|
| 40 |
+# Build the integration tests and copy the resulting binaries to /build/tests |
|
| 41 |
+FROM base AS builder |
|
| 42 |
+ |
|
| 43 |
+# Set tag and add sources |
|
| 44 |
+COPY . . |
|
| 45 |
+# Copy test sources tests that use assert can print errors |
|
| 46 |
+RUN mkdir -p /build${PWD} && find integration integration-cli -name \*_test.go -exec cp --parents '{}' /build${PWD} \;
|
|
| 47 |
+# Build and install test binaries |
|
| 48 |
+ARG DOCKER_GITCOMMIT=undefined |
|
| 38 | 49 |
RUN hack/make.sh build-integration-test-binary |
| 39 |
-RUN mkdir -p /output/tests && find . -name test.main -exec cp --parents '{}' /output/tests \;
|
|
| 50 |
+RUN mkdir -p /build/tests && find . -name test.main -exec cp --parents '{}' /build/tests \;
|
|
| 40 | 51 |
|
| 41 |
-## Step 2: Generate testing image |
|
| 42 |
-FROM alpine:3.8 as runner |
|
| 52 |
+## Generate testing image |
|
| 53 |
+FROM alpine:3.9 as runner |
|
| 54 |
+ |
|
| 55 |
+ENV DOCKER_REMOTE_DAEMON=1 |
|
| 56 |
+ENV DOCKER_INTEGRATION_DAEMON_DEST=/ |
|
| 57 |
+ENTRYPOINT ["/scripts/run.sh"] |
|
| 58 |
+ |
|
| 59 |
+# Add an unprivileged user to be used for tests which need it |
|
| 60 |
+RUN addgroup docker && adduser -D -G docker unprivilegeduser -s /bin/ash |
|
| 43 | 61 |
|
| 44 | 62 |
# GNU tar is used for generating the emptyfs image |
| 45 | 63 |
RUN apk --no-cache add \ |
| ... | ... |
@@ -52,21 +69,14 @@ RUN apk --no-cache add \ |
| 52 | 52 |
tar \ |
| 53 | 53 |
xz |
| 54 | 54 |
|
| 55 |
-# Add an unprivileged user to be used for tests which need it |
|
| 56 |
-RUN addgroup docker && adduser -D -G docker unprivilegeduser -s /bin/ash |
|
| 57 |
- |
|
| 58 |
-COPY contrib/httpserver/Dockerfile /tests/contrib/httpserver/Dockerfile |
|
| 59 |
-COPY contrib/syscall-test /tests/contrib/syscall-test |
|
| 60 |
-COPY integration-cli/fixtures /tests/integration-cli/fixtures |
|
| 55 |
+COPY hack/test/e2e-run.sh /scripts/run.sh |
|
| 56 |
+COPY hack/make/.ensure-emptyfs /scripts/ensure-emptyfs.sh |
|
| 61 | 57 |
|
| 62 |
-COPY hack/test/e2e-run.sh /scripts/run.sh |
|
| 63 |
-COPY hack/make/.ensure-emptyfs /scripts/ensure-emptyfs.sh |
|
| 58 |
+COPY integration/testdata /tests/integration/testdata |
|
| 59 |
+COPY integration/build/testdata /tests/integration/build/testdata |
|
| 60 |
+COPY integration-cli/fixtures /tests/integration-cli/fixtures |
|
| 64 | 61 |
|
| 65 |
-COPY --from=builder /output/docker-frozen-images /docker-frozen-images |
|
| 66 |
-COPY --from=builder /output/httpserver /tests/contrib/httpserver/httpserver |
|
| 67 |
-COPY --from=builder /output/tests /tests |
|
| 68 |
-COPY --from=builder /usr/local/bin/docker /usr/bin/docker |
|
| 69 |
- |
|
| 70 |
-ENV DOCKER_REMOTE_DAEMON=1 DOCKER_INTEGRATION_DAEMON_DEST=/ |
|
| 71 |
- |
|
| 72 |
-ENTRYPOINT ["/scripts/run.sh"] |
|
| 62 |
+COPY --from=frozen-images /build/ /docker-frozen-images |
|
| 63 |
+COPY --from=dockercli /build/ /usr/bin/ |
|
| 64 |
+COPY --from=contrib /build/ /tests/contrib/ |
|
| 65 |
+COPY --from=builder /build/ / |
| ... | ... |
@@ -168,7 +168,7 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref |
| 168 | 168 |
# Environment variable notes: |
| 169 | 169 |
# - GO_VERSION must be consistent with 'Dockerfile' used by Linux. |
| 170 | 170 |
# - FROM_DOCKERFILE is used for detection of building within a container. |
| 171 |
-ENV GO_VERSION=1.12.4 ` |
|
| 171 |
+ENV GO_VERSION=1.12.5 ` |
|
| 172 | 172 |
GIT_VERSION=2.11.1 ` |
| 173 | 173 |
GOPATH=C:\go ` |
| 174 | 174 |
FROM_DOCKERFILE=1 |
| ... | ... |
@@ -623,29 +623,6 @@ func (s *DockerSuite) TestContainerAPICreateMultipleNetworksConfig(c *check.C) {
|
| 623 | 623 |
c.Assert(msg, checker.Contains, "net3") |
| 624 | 624 |
} |
| 625 | 625 |
|
| 626 |
-func (s *DockerSuite) TestContainerAPICreateWithHostName(c *check.C) {
|
|
| 627 |
- domainName := "test-domain" |
|
| 628 |
- hostName := "test-hostname" |
|
| 629 |
- config := containertypes.Config{
|
|
| 630 |
- Image: "busybox", |
|
| 631 |
- Hostname: hostName, |
|
| 632 |
- Domainname: domainName, |
|
| 633 |
- } |
|
| 634 |
- |
|
| 635 |
- cli, err := client.NewClientWithOpts(client.FromEnv) |
|
| 636 |
- assert.NilError(c, err) |
|
| 637 |
- defer cli.Close() |
|
| 638 |
- |
|
| 639 |
- container, err := cli.ContainerCreate(context.Background(), &config, &containertypes.HostConfig{}, &networktypes.NetworkingConfig{}, "")
|
|
| 640 |
- assert.NilError(c, err) |
|
| 641 |
- |
|
| 642 |
- containerJSON, err := cli.ContainerInspect(context.Background(), container.ID) |
|
| 643 |
- assert.NilError(c, err) |
|
| 644 |
- |
|
| 645 |
- c.Assert(containerJSON.Config.Hostname, checker.Equals, hostName, check.Commentf("Mismatched Hostname"))
|
|
| 646 |
- c.Assert(containerJSON.Config.Domainname, checker.Equals, domainName, check.Commentf("Mismatched Domainname"))
|
|
| 647 |
-} |
|
| 648 |
- |
|
| 649 | 626 |
func (s *DockerSuite) TestContainerAPICreateBridgeNetworkMode(c *check.C) {
|
| 650 | 627 |
// Windows does not support bridge |
| 651 | 628 |
testRequires(c, DaemonIsLinux) |
| ... | ... |
@@ -468,6 +468,7 @@ RUN for g in $(seq 0 8); do dd if=/dev/urandom of=rnd bs=1K count=1 seek=$((1024 |
| 468 | 468 |
} |
| 469 | 469 |
|
| 470 | 470 |
func TestBuildWithEmptyDockerfile(t *testing.T) {
|
| 471 |
+ skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"), "broken in earlier versions") |
|
| 471 | 472 |
ctx := context.TODO() |
| 472 | 473 |
defer setupTest(t)() |
| 473 | 474 |
|
| ... | ... |
@@ -300,12 +300,14 @@ func TestDaemonIpcModeShareableFromConfig(t *testing.T) {
|
| 300 | 300 |
// by default, even when the daemon default is private. |
| 301 | 301 |
func TestIpcModeOlderClient(t *testing.T) {
|
| 302 | 302 |
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"), "requires a daemon with DefaultIpcMode: private") |
| 303 |
+ c := testEnv.APIClient() |
|
| 304 |
+ skip.If(t, versions.LessThan(c.ClientVersion(), "1.40"), "requires client API >= 1.40") |
|
| 305 |
+ |
|
| 303 | 306 |
t.Parallel() |
| 304 | 307 |
|
| 305 | 308 |
ctx := context.Background() |
| 306 | 309 |
|
| 307 | 310 |
// pre-check: default ipc mode in daemon is private |
| 308 |
- c := testEnv.APIClient() |
|
| 309 | 311 |
cID := container.Create(t, ctx, c, container.WithAutoRemove) |
| 310 | 312 |
|
| 311 | 313 |
inspect, err := c.ContainerInspect(ctx, cID) |
| ... | ... |
@@ -50,6 +50,10 @@ func TestKernelTCPMemory(t *testing.T) {
|
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 | 52 |
func TestNISDomainname(t *testing.T) {
|
| 53 |
+ // Older versions of the daemon would concatenate hostname and domainname, |
|
| 54 |
+ // so hostname "foobar" and domainname "baz.cyphar.com" would produce |
|
| 55 |
+ // `foobar.baz.cyphar.com` as hostname. |
|
| 56 |
+ skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"), "skip test from new feature") |
|
| 53 | 57 |
skip.If(t, testEnv.DaemonInfo.OSType != "linux") |
| 54 | 58 |
|
| 55 | 59 |
defer setupTest(t)() |
| ... | ... |
@@ -6,12 +6,15 @@ import ( |
| 6 | 6 |
|
| 7 | 7 |
"github.com/docker/docker/api/types" |
| 8 | 8 |
"github.com/docker/docker/api/types/filters" |
| 9 |
+ "github.com/docker/docker/api/types/versions" |
|
| 9 | 10 |
"gotest.tools/assert" |
| 10 | 11 |
is "gotest.tools/assert/cmp" |
| 12 |
+ "gotest.tools/skip" |
|
| 11 | 13 |
) |
| 12 | 14 |
|
| 13 | 15 |
// Regression : #38171 |
| 14 | 16 |
func TestImagesFilterMultiReference(t *testing.T) {
|
| 17 |
+ skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"), "broken in earlier versions") |
|
| 15 | 18 |
defer setupTest(t)() |
| 16 | 19 |
client := testEnv.APIClient() |
| 17 | 20 |
ctx := context.Background() |
| ... | ... |
@@ -4,11 +4,14 @@ import ( |
| 4 | 4 |
"context" |
| 5 | 5 |
"testing" |
| 6 | 6 |
|
| 7 |
+ "github.com/docker/docker/api/types/versions" |
|
| 7 | 8 |
"github.com/google/uuid" |
| 8 | 9 |
"gotest.tools/assert" |
| 10 |
+ "gotest.tools/skip" |
|
| 9 | 11 |
) |
| 10 | 12 |
|
| 11 | 13 |
func TestUUIDGeneration(t *testing.T) {
|
| 14 |
+ skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"), "ID format changed") |
|
| 12 | 15 |
defer setupTest(t)() |
| 13 | 16 |
|
| 14 | 17 |
c := testEnv.APIClient() |
| ... | ... |
@@ -16,5 +19,5 @@ func TestUUIDGeneration(t *testing.T) {
|
| 16 | 16 |
assert.NilError(t, err) |
| 17 | 17 |
|
| 18 | 18 |
_, err = uuid.Parse(info.ID) |
| 19 |
- assert.NilError(t, err) |
|
| 19 |
+ assert.NilError(t, err, info.ID) |
|
| 20 | 20 |
} |
| ... | ... |
@@ -40,12 +40,20 @@ func TestVolumesCreateAndList(t *testing.T) {
|
| 40 | 40 |
} |
| 41 | 41 |
assert.Check(t, is.DeepEqual(vol, expected, cmpopts.EquateEmpty())) |
| 42 | 42 |
|
| 43 |
- volumes, err := client.VolumeList(ctx, filters.Args{})
|
|
| 43 |
+ volList, err := client.VolumeList(ctx, filters.Args{})
|
|
| 44 | 44 |
assert.NilError(t, err) |
| 45 |
+ assert.Assert(t, len(volList.Volumes) > 0) |
|
| 45 | 46 |
|
| 46 |
- assert.Check(t, is.Equal(len(volumes.Volumes), 1)) |
|
| 47 |
- assert.Check(t, volumes.Volumes[0] != nil) |
|
| 48 |
- assert.Check(t, is.DeepEqual(*volumes.Volumes[0], expected, cmpopts.EquateEmpty())) |
|
| 47 |
+ volumes := volList.Volumes[:0] |
|
| 48 |
+ for _, v := range volList.Volumes {
|
|
| 49 |
+ if v.Name == vol.Name {
|
|
| 50 |
+ volumes = append(volumes, v) |
|
| 51 |
+ } |
|
| 52 |
+ } |
|
| 53 |
+ |
|
| 54 |
+ assert.Check(t, is.Equal(len(volumes), 1)) |
|
| 55 |
+ assert.Check(t, volumes[0] != nil) |
|
| 56 |
+ assert.Check(t, is.DeepEqual(*volumes[0], expected, cmpopts.EquateEmpty())) |
|
| 49 | 57 |
} |
| 50 | 58 |
|
| 51 | 59 |
func TestVolumesRemove(t *testing.T) {
|