From 9978c3ea52edbc99f2e293e98c4db5196972d655 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Mon, 31 Aug 2015 17:29:25 -0400 Subject: [PATCH] Update scriptests/test-versions to work with daemon args, and move docker version constants into tests-versions. Signed-off-by: Daniel Nephin --- Dockerfile | 11 ----------- script/test-versions | 45 ++++++++++++++++++++++++-------------------- tox.ini | 1 + 3 files changed, 26 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index ba508742d..354ba00a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/ diff --git a/script/test-versions b/script/test-versions index 577cf67e1..bebc55672 100755 --- a/script/test-versions +++ b/script/test-versions @@ -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 diff --git a/tox.ini b/tox.ini index 4cb933dd7..901c18517 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,7 @@ envlist = py27,py34,pre-commit usedevelop=True passenv = LD_LIBRARY_PATH + DOCKER_HOST setenv = HOME=/tmp deps =