Update scriptests/test-versions to work with daemon args, and move docker version constants into tests-versions.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
Daniel Nephin 2015-08-31 17:29:25 -04:00 committed by Daniel Nephin
parent eb20590ca6
commit 9978c3ea52
3 changed files with 26 additions and 31 deletions

View File

@ -66,17 +66,6 @@ RUN set -ex; \
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
ENV ALL_DOCKER_VERSIONS 1.7.1 1.8.2-rc1
RUN set -ex; \
curl https://get.docker.com/builds/Linux/x86_64/docker-1.7.1 -o /usr/local/bin/docker-1.7.1; \
chmod +x /usr/local/bin/docker-1.7.1; \
curl https://test.docker.com/builds/Linux/x86_64/docker-1.8.2-rc1 -o /usr/local/bin/docker-1.8.2-rc1; \
chmod +x /usr/local/bin/docker-1.8.2-rc1
# Set the default Docker to be run
RUN ln -s /usr/local/bin/docker-1.7.1 /usr/local/bin/docker
RUN useradd -d /home/user -m -s /bin/bash user
WORKDIR /code/

View File

@ -10,36 +10,41 @@ docker run --rm \
--entrypoint="tox" \
"$TAG" -e pre-commit
ALL_DOCKER_VERSIONS="1.7.1 1.8.2"
DEFAULT_DOCKER_VERSION="1.8.2"
if [ "$DOCKER_VERSIONS" == "" ]; then
DOCKER_VERSIONS="$DEFAULT_DOCKER_VERSION"
elif [ "$DOCKER_VERSIONS" == "all" ]; then
DOCKER_VERSIONS="$ALL_DOCKER_VERSIONS"
fi
BUILD_NUMBER=${BUILD_NUMBER-$USER}
for version in $DOCKER_VERSIONS; do
>&2 echo "Running tests against Docker $version"
(
set -x
daemon_container="compose-dind-$version-$BUILD_NUMBER"
trap "docker rm -vf $daemon_container" EXIT
daemon_container_id=$(\
docker run \
-d \
--privileged \
--volume="/var/lib/docker" \
--expose="2375" \
dockerswarm/dind:$version \
docker -d -H tcp://0.0.0.0:2375 \
)
# TODO: remove when we stop testing against 1.7.x
daemon=$([[ "$version" == "1.7"* ]] && echo "-d" || echo "daemon")
docker run \
--rm \
--link="$daemon_container_id:docker" \
--env="DOCKER_HOST=tcp://docker:2375" \
--entrypoint="tox" \
"$TAG" \
-e py27,py34 -- "$@"
docker run \
-d \
--name "$daemon_container" \
--privileged \
--volume="/var/lib/docker" \
dockerswarm/dind:$version \
docker $daemon -H tcp://0.0.0.0:2375 $DOCKER_DAEMON_ARGS \
docker run \
--rm \
--link="$daemon_container:docker" \
--env="DOCKER_HOST=tcp://docker:2375" \
--entrypoint="tox" \
"$TAG" \
-e py27,py34 -- "$@"
docker rm -vf "$daemon_container_id"
)
done

View File

@ -5,6 +5,7 @@ envlist = py27,py34,pre-commit
usedevelop=True
passenv =
LD_LIBRARY_PATH
DOCKER_HOST
setenv =
HOME=/tmp
deps =