From 397ed3ab6aa6c8d38dea02c5046637294fc80e89 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Thu, 16 Mar 2017 17:46:41 +0000 Subject: [PATCH] Add support for upper-constraints.txt ...and pin us to stable/newton. (I wanted stable/mitaka so it'd match Keystone, but apparently then pbr is too old for Keystone to install a keystone-wsgi-admin script.) This prevents various version conflicts; the most recent was from oslo.service blocking too-new eventlet. Change-Id: I115dc231a9156a5bceacaa21d6242bb934fbbd24 Related-Change: I3b2196fdef9936f1c7d468f9c7c9b9246d3d26fd Related-Change: I6cbbfd7260571f42ea65c6622aa6b410a0e43b28 --- test-requirements.txt | 2 -- tools/tox_install.sh | 38 ++++++++++++++++++++++++++++++++++++++ tox.ini | 34 +++++++++++++++++++--------------- 3 files changed, 57 insertions(+), 17 deletions(-) create mode 100755 tools/tox_install.sh diff --git a/test-requirements.txt b/test-requirements.txt index 906b9107..80f3d3e0 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -7,8 +7,6 @@ mock pylint python-openstackclient boto -requests!=2.12.2,!=2.13.0 requests-mock>=0.7.0 # Apache-2.0 fixtures<2.0,>=1.3.1 # Apache-2.0/BSD keystonemiddleware -babel!=2.4.0 diff --git a/tools/tox_install.sh b/tools/tox_install.sh new file mode 100755 index 00000000..6c90cd72 --- /dev/null +++ b/tools/tox_install.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +# Client constraint file contains this client version pin that is in conflict +# with installing the client from source. We should remove the version pin in +# the constraints file before applying it for from-source installation. + +set -e + +if [[ -z "$CONSTRAINTS_FILE" ]]; then + echo 'WARNING: expected $CONSTRAINTS_FILE to be set' >&2 + PIP_FLAGS=(-U) +else + # NOTE(tonyb): Place this in the tox enviroment's log dir so it will get + # published to logs.openstack.org for easy debugging. + localfile="$VIRTUAL_ENV/log/upper-constraints.txt" + + if [[ "$CONSTRAINTS_FILE" != http* ]]; then + CONSTRAINTS_FILE="file://$CONSTRAINTS_FILE" + fi + curl "$CONSTRAINTS_FILE" --insecure --progress-bar --output "$localfile" + + pip install -c"$localfile" openstack-requirements + + # This is the main purpose of the script: Allow local installation of + # the current repo. It is listed in constraints file and thus any + # install will be constrained and we need to unconstrain it. + edit-constraints "$localfile" -- "$CLIENT_NAME" + + # Also unconstrain eventlet, as our s3tests results rely on a more-recent + # version + edit-constraints "$localfile" -- eventlet + # Swift also hard-depends on a more-recent pyeclib + edit-constraints "$localfile" -- pyeclib + + PIP_FLAGS=(-c"$localfile" -U) +fi + +pip install "${PIP_FLAGS[@]}" "$@" diff --git a/tox.ini b/tox.ini index 93ca8681..a063b2e5 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,7 @@ skipsdist = True [testenv] whitelist_externals =/bin/bash usedevelop = True -install_command = pip install {opts} {packages} +install_command = {toxinidir}/tools/tox_install.sh {opts} {packages} # swift stable/ocata (about 2.13.0) from openstack.org deps = -r{toxinidir}/test-requirements.txt @@ -21,16 +21,18 @@ setenv = VIRTUAL_ENV={envdir} NOSE_OPENSTACK_STDOUT=1 NOSE_WITH_COVERAGE=1 NOSE_COVER_BRANCHES=1 + CONSTRAINTS_FILE=https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/newton + LOG_DEST={envdir}/log [testenv:tempauth] commands = /bin/bash {posargs:swift3/test/functional/run_test.sh} -setenv = AUTH=tempauth - LOG_DEST={envdir}/log +setenv = {[testenv]setenv} + AUTH=tempauth [testenv:keystone] commands = /bin/bash {posargs:swift3/test/functional/run_test.sh} -setenv = AUTH=keystone - LOG_DEST={envdir}/log +setenv = {[testenv]setenv} + AUTH=keystone # keystone 9.0.0 from github deps = {[testenv]deps} @@ -38,13 +40,14 @@ deps = [testenv:s3acl] commands = /bin/bash {posargs:swift3/test/functional/run_test.sh} -setenv = AUTH=tempauth - LOG_DEST={envdir}/log +setenv = {[testenv]setenv} + AUTH=tempauth S3ACL=true [testenv:s3acl_master] commands = /bin/bash {posargs:swift3/test/functional/run_test.sh} -setenv = AUTH=tempauth +setenv = {[testenv]setenv} + AUTH=tempauth S3ACL=true deps = -r{toxinidir}/test-requirements.txt @@ -52,27 +55,30 @@ deps = [testenv:s3tests_tempauth] commands = /bin/bash {posargs:swift3/test/functional/run_test.sh} -setenv = AUTH=tempauth +setenv = {[testenv]setenv} + AUTH=tempauth S3ACL=true DNS_BUCKET_NAMES=false CHECK_BUCKET_OWNER=true CEPH_TESTS=1 - LOG_DEST={envdir}/log [testenv:s3tests_keystone] commands = /bin/bash {posargs:swift3/test/functional/run_test.sh} -setenv = AUTH=keystone +setenv = {[testenv]setenv} + AUTH=keystone S3ACL=true DNS_BUCKET_NAMES=false CHECK_BUCKET_OWNER=true CEPH_TESTS=1 - LOG_DEST={envdir}/log deps = {[testenv:keystone]deps} [testenv:pylint] # Avoid to fail by checking members at lxml dynamically loaded module commands = pylint -E swift3 --ignored-modules=lxml.etree +setenv = {[testenv]setenv} + # bypass constraints; pylint requires a later astroid + CONSTRAINTS_FILE= [testenv:pep8] commands = flake8 @@ -81,9 +87,7 @@ commands = flake8 commands = {posargs} [testenv:cover] -setenv = VIRTUAL_ENV={envdir} - NOSE_WITH_COVERAGE=1 - NOSE_COVER_BRANCHES=1 +setenv = {[testenv]setenv} NOSE_COVER_HTML=1 NOSE_COVER_HTML_DIR={toxinidir}/cover