From c61f920f2a54fd829ee37484b3743ab77b909847 Mon Sep 17 00:00:00 2001 From: Doug Wiegley Date: Thu, 4 Jun 2015 17:09:23 -0600 Subject: [PATCH] Stop doing any magic cloning of neutron during CI Change-Id: Iee43c68b4cc954b9780de02625de7e053ebd27b3 --- tools/tox_install.sh | 41 +++++++++++++++++++++++++++++++++++++++++ tox.ini | 22 ++-------------------- 2 files changed, 43 insertions(+), 20 deletions(-) create mode 100755 tools/tox_install.sh diff --git a/tools/tox_install.sh b/tools/tox_install.sh new file mode 100755 index 000000000..3d96424a8 --- /dev/null +++ b/tools/tox_install.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +# Many of neutron's repos suffer from the problem of depending on neutron, +# but it not existing on pypi. + +# This wrapper for tox's package installer will use the existing package +# if it exists, else use zuul-cloner if that program exists, else grab it +# from neutron master via a hard-coded URL. That last case should only +# happen with devs running unit tests locally. + +# From the tox.ini config page: +# install_command=ARGV +# default: +# pip install {opts} {packages} + +ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner +neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?) + +set -e + +if [ $neutron_installed -eq 0 ]; then + echo "ALREADY INSTALLED" > /tmp/tox_install.txt + echo "Neutron already installed; using existing package" +elif [ -x "$ZUUL_CLONER" ]; then + echo "ZUUL CLONER" > /tmp/tox_install.txt + cwd=$(/bin/pwd) + cd /tmp + $ZUUL_CLONER --cache-dir \ + /opt/git \ + git://git.openstack.org \ + openstack/neutron + cd openstack/neutron + pip install -e . + cd "$cwd" +else + echo "PIP HARDCODE" > /tmp/tox_install.txt + pip install -U -egit+https://git.openstack.org/openstack/neutron#egg=neutron +fi + +pip install -U $* +exit $? diff --git a/tox.ini b/tox.ini index 088021f01..cb2abd36f 100644 --- a/tox.ini +++ b/tox.ini @@ -6,9 +6,8 @@ skipsdist = True [testenv] setenv = VIRTUAL_ENV={envdir} usedevelop = True -install_command = pip install -U {opts} {packages} -deps = -egit+https://git.openstack.org/openstack/neutron#egg=neutron - -r{toxinidir}/requirements.txt +install_command = {toxinidir}/tools/tox_install.sh {opts} {packages} +deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt whitelist_externals = sh commands = @@ -16,19 +15,6 @@ commands = # there is also secret magic in pretty_tox.sh which lets you run in a fail only # mode. To do this define the TRACE_FAILONLY environmental variable. -[testenv:functional] -setenv = OS_TEST_PATH=./neutron-lbaas/tests/functional -commands = - python setup.py testr --slowest --testr-args='{posargs}' - -[testenv:dsvm-functional] -setenv = OS_TEST_PATH=./neutron-lbaas/tests/functional - OS_SUDO_TESTING=1 - OS_ROOTWRAP_CMD=sudo {envdir}/bin/neutron-rootwrap {envdir}/etc/neutron/rootwrap.conf - OS_FAIL_ON_MISSING_DEPS=1 -sitepackages=True -commands = - python setup.py testr --slowest --testr-args='{posargs}' [tox:jenkins] sitepackages = True @@ -77,8 +63,6 @@ import_exceptions = neutron.i18n local-check-factory = neutron.hacking.checks.factory [testenv:apiv1] -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt sitepackages = True setenv = OS_TEST_PATH={toxinidir}/neutron_lbaas/tests/tempest/v1/api @@ -86,8 +70,6 @@ setenv = TEMPEST_CONFIG_DIR={toxinidir}/neutron_lbaas/tests/tempest/etc [testenv:apiv2] -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt sitepackages = True setenv = OS_TEST_PATH={toxinidir}/neutron_lbaas/tests/tempest/v2/api