Browse code

Dockerfile.e2e: copy test sources

Package "gotest.tools/assert" uses source introspection to
print more info in case of assertion failure. When source code
is not available, it prints an error instead.

In other words, before this commit:

> --- SKIP: TestCgroupDriverSystemdMemoryLimit (0.00s)
> cgroupdriver_systemd_test.go:32: failed to parse source file: /go/src/github.com/docker/docker/integration/system/cgroupdriver_systemd_test.go: open /go/src/github.com/docker/docker/integration/system/cgroupdriver_systemd_test.go: no such file or directory
> cgroupdriver_systemd_test.go:32:

and after:

> --- SKIP: TestCgroupDriverSystemdMemoryLimit (0.09s)
> cgroupdriver_systemd_test.go:32: !hasSystemd()

This increases the resulting image size by about 2 MB
on my system (from 758 to 760 MB).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 0deb18ab42094f897d9996aa23fabe3c6a76a67f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Kir Kolyshkin authored on 2019/04/27 13:38:55
Showing 1 changed files
... ...
@@ -43,8 +43,11 @@ FROM base AS builder
43 43
 ARG DOCKER_GITCOMMIT
44 44
 ENV DOCKER_GITCOMMIT=${DOCKER_GITCOMMIT:-undefined}
45 45
 COPY . .
46
+# Copy test sources tests that use assert can print errors
47
+RUN mkdir -p /build${PWD} && find integration integration-cli -name \*_test.go -exec cp --parents '{}' /build${PWD} \;
48
+# Build and install test binaries
46 49
 RUN hack/make.sh build-integration-test-binary
47
-RUN mkdir -p /build/ && find . -name test.main -exec cp --parents '{}' /build \;
50
+RUN mkdir -p /build/tests && find . -name test.main -exec cp --parents '{}' /build/tests \;
48 51
 
49 52
 ## Generate testing image
50 53
 FROM alpine:3.9 as runner
... ...
@@ -77,4 +80,4 @@ COPY integration-cli/fixtures   /tests/integration-cli/fixtures
77 77
 COPY --from=frozen-images /build/ /docker-frozen-images
78 78
 COPY --from=dockercli     /build/ /usr/bin/
79 79
 COPY --from=contrib       /build/ /tests/contrib/
80
-COPY --from=builder       /build/ /tests/
80
+COPY --from=builder       /build/ /