Skip to content

Commit

Permalink
Containerize integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Crone <[email protected]>
  • Loading branch information
chris-crone committed Sep 14, 2017
1 parent 063c89c commit 07f10d8
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
61 changes: 61 additions & 0 deletions Dockerfile.e2e
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
FROM golang:1.8.3-alpine3.6 as builder

RUN apk add --update \
bash \
build-base \
curl \
lvm2-dev \
jq \
&& rm -rf /var/cache/apk/*

RUN mkdir -p /go/src/github.com/docker/docker/
WORKDIR /go/src/github.com/docker/docker/

COPY contrib contrib
RUN contrib/download-frozen-image-v2.sh /output/docker-frozen-images \
buildpack-deps:jessie@sha256:85b379ec16065e4fe4127eb1c5fb1bcc03c559bd36dbb2e22ff496de55925fa6 \
busybox:latest@sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f \
debian:jessie@sha256:72f784399fd2719b4cb4e16ef8e369a39dc67f53d978cd3e2e7bf4e502c7b793 \
hello-world:latest@sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7

ARG 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 . .

RUN hack/make.sh build-integration-test-binary
RUN mkdir -p /output/tests && find . -name test.main -exec cp --parents '{}' /output/tests \;

FROM alpine:3.6 as runner

# GNU tar is used for generating the emptyfs image
RUN apk add --update \
bash \
ca-certificates \
g++ \
git \
iptables \
tar \
xz \
&& rm -rf /var/cache/apk/*

# Add an unprivileged user to be used for tests which need it
RUN addgroup docker && adduser -D -G docker unprivilegeduser -s /bin/ash

ENV DOCKER_E2E=1 DOCKER_REMOTE_DAEMON=1 DOCKER_INTEGRATION_DAEMON_DEST=/

COPY --from=builder /output/docker/docker /usr/bin/docker
COPY --from=builder /output/docker-frozen-images /docker-frozen-images
COPY --from=builder /output/tests /tests

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

ENTRYPOINT ["/run.sh"]
13 changes: 13 additions & 0 deletions internal/e2e/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -e

echo "Ensure emptyfs image is loaded"
bash /ensure-emptyfs.sh

echo "Run integration/container tests"
cd /tests/integration/container
./test.main -test.v

echo "Run integration-cli DockerSuite tests"
cd /tests/integration-cli
./test.main -test.v -check.v -check.f DockerSuite

0 comments on commit 07f10d8

Please sign in to comment.