From d48a7903780bb577cbaeb89ca2eafbaa270a2dda Mon Sep 17 00:00:00 2001 From: Boden R Date: Wed, 21 Mar 2018 11:54:41 -0600 Subject: [PATCH] add py27-dev and pep8-dev tox targets This patch adds the py27-dev and pep8-dev tox targets that enable local (outside the gate) running of py27 and pep8 using master branches from our sub-project dependencies as discussed in [1] in editable mode. If additional local/dev targets are needed (ex functional) they can be added in the same fashion as shown herein. With this patch to run pep8 locally use: tox -e pep8-dev And to run py27 locally: tox -e py27-dev The editable projects will be under .tox/{env}/src/ This patch also adds to our devstack/lib scripts by cleaning out any existing (dependency git) projects and installing them in editable mode from git. Depends-On: https://review.openstack.org/552865 Depends-On: https://review.openstack.org/554297 [1] http://lists.openstack.org/pipermail/openstack-dev/2018-March/128328.html Change-Id: I4d0dcba15e5b30e4cfa7335edf9c2dd961530184 --- devstack/lib/nsx_common | 32 ++++++++++++++++++++++++ devstack/lib/vmware_nsx_tvd | 15 ++++++++++++ tox.ini | 49 ++++++++++++++++++++++++++++++++++--- 3 files changed, 93 insertions(+), 3 deletions(-) diff --git a/devstack/lib/nsx_common b/devstack/lib/nsx_common index ac63dd9ba9..0659d70b16 100644 --- a/devstack/lib/nsx_common +++ b/devstack/lib/nsx_common @@ -30,6 +30,22 @@ function _nsxv_ini_set { } function nsxv_configure_service { + # TODO(boden): find a better way to use master branch dependencies in devstack + sudo rm -rf /usr/local/lib/python2.7/dist-packages/networking_l2gw* + sudo pip install -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/networking_sfc* + sudo pip install -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_lbaas* + sudo pip install -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_fwaas* + sudo pip install -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_dynamic_routing* + sudo pip install -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_vpnaas* + sudo pip install -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/vmware_nsxlib* + sudo pip install -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib" + if [[ "$NSX_L2GW_DRIVER" != "" ]]; then iniset /$Q_PLUGIN_CONF_FILE DEFAULT nsx_l2gw_driver $NSX_L2GW_DRIVER fi @@ -92,6 +108,22 @@ function _nsxv3_ini_set { } function nsxv3_configure_service { + # TODO(boden): find a better way to use master branch dependencies in devstack + sudo rm -rf /usr/local/lib/python2.7/dist-packages/networking_l2gw* + sudo pip install -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/networking_sfc* + sudo pip install -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_lbaas* + sudo pip install -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_fwaas* + sudo pip install -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_dynamic_routing* + sudo pip install -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_vpnaas* + sudo pip install -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/vmware_nsxlib* + sudo pip install -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib" + if [[ $1 == "nsx_v3" ]]; then _nsxv3_ini_set default_overlay_tz $DEFAULT_OVERLAY_TZ_UUID "The VMware NSX plugin won't work without a default transport zone." else diff --git a/devstack/lib/vmware_nsx_tvd b/devstack/lib/vmware_nsx_tvd index 4818f6d820..3d3cd3586c 100644 --- a/devstack/lib/vmware_nsx_tvd +++ b/devstack/lib/vmware_nsx_tvd @@ -112,6 +112,21 @@ function neutron_plugin_create_nova_conf { function neutron_plugin_install_agent_packages { # VMware NSX Plugin does not run q-agt, but it currently needs dhcp and metadata agents _neutron_ovs_base_install_agent_packages + # TODO(boden): find a better way to use master branch dependencies in devstack + sudo rm -rf /usr/local/lib/python2.7/dist-packages/networking_l2gw* + sudo pip install -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/networking_sfc* + sudo pip install -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_lbaas* + sudo pip install -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_fwaas* + sudo pip install -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_dynamic_routing* + sudo pip install -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/neutron_vpnaas* + sudo pip install -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas" + sudo rm -rf /usr/local/lib/python2.7/dist-packages/vmware_nsxlib* + sudo pip install -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib" } function neutron_plugin_configure_common { diff --git a/tox.ini b/tox.ini index 5c0ca62801..94706cea20 100644 --- a/tox.ini +++ b/tox.ini @@ -11,12 +11,12 @@ usedevelop = True deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -whitelist_externals = sh +whitelist_externals = + sh + stestr commands = stestr run {posargs} stestr slowest -# there is also secret magic in ostestr which lets you run in a fail only -# mode. To do this define the TRACE_FAILONLY environmental variable. [testenv:common] # Fake job to define environment variables shared between dsvm/non-dsvm jobs @@ -56,6 +56,24 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen [testenv:py27] setenv = OS_FAIL_ON_MISSING_DEPS=1 +[testenv:py27-dev] +# run py27 locally (not in the gate) using editable mode +# https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs +# note that order is important to ensure dependencies don't override +commands = + pip install -q -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw" + pip install -q -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc" + pip install -q -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas" + pip install -q -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas" + pip install -q -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing" + pip install -q -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas" + pip install -q -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib" + pip install -q -e "git+https://git.openstack.org/openstack/neutron#egg=neutron" + pip freeze + stestr run {posargs} +whitelist_externals = + stestr + [testenv:pep8] basepython = python2.7 commands = @@ -70,6 +88,31 @@ whitelist_externals = sh bash +[testenv:pep8-dev] +# run pep8 locally (not in the gate) using editable mode +# https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs +# note that order is important to ensure dependencies don't override +basepython = python2.7 +commands = + pip install -q -e "git+https://git.openstack.org/openstack/networking-l2gw#egg=networking_l2gw" + pip install -q -e "git+https://git.openstack.org/openstack/networking-sfc#egg=networking_sfc" + pip install -q -e "git+https://git.openstack.org/openstack/neutron-lbaas#egg=neutron_lbaas" + pip install -q -e "git+https://git.openstack.org/openstack/neutron-fwaas#egg=neutron_fwaas" + pip install -q -e "git+https://git.openstack.org/openstack/neutron-dynamic-routing#egg=neutron_dynamic_routing" + pip install -q -e "git+https://git.openstack.org/openstack/neutron-vpnaas#egg=neutron_vpnaas" + pip install -q -e "git+https://git.openstack.org/openstack/vmware-nsxlib#egg=vmware_nsxlib" + pip install -q -e "git+https://git.openstack.org/openstack/neutron#egg=neutron" + pip freeze + # If it is easier to add a check via a shell script, consider adding it in this file + sh ./tools/misc-sanity-checks.sh + # Checks for coding and style guidelines + flake8 {toxinidir}/vmware_nsx + sh ./tools/coding-checks.sh --pylint '{posargs}' + neutron-db-manage --subproject vmware-nsx check_migration + {[testenv:genconfig]commands} +whitelist_externals = + sh + [testenv:bandit] commands = bandit -r vmware_nsx -n 5 -ll