Update Neutron Classifier for Zuulv3

This patch updates the testing of the neutron classifier
repository to be zuulv3 compliant. Changes include:
 - Added lower-constraints.txt file.
 - Added clarifying comments to requirements.txt including
   neutron-lib-current update.
 - Removed playbooks/legacy yaml files.
 - Modified coverage package version.
 - Added to testenv, testenv:dev in tox.ini

 This patch is part of the neutron-sibling-setup
 as documented in [1]. Changes were also based on zuulv3
 opencontrail patch [2] as well as updates made to
 x/vmware-nsx project.[3]

[1] https://etherpad.openstack.org/p/neutron-sibling-setup
[2] https://review.opendev.org/#/c/624782/
[3] https://review.opendev.org/#/c/670134/

Change-Id: I46ac45d97a5af24ae234f11952d6883cd3088ff7
This commit is contained in:
Sara Nierodzik 2019-07-16 09:38:43 +00:00
parent f6ec19e018
commit 29a054811a
10 changed files with 195 additions and 281 deletions

27
lower-constraints.txt Normal file
View File

@ -0,0 +1,27 @@
Babel==2.3.4
coverage==4.0
flake8-import-order==0.12
flake8==2.6.2
hacking==1.1.0
keystoneauth1==3.4.0
neutron==14.0.0
neutron-lib==1.28.0
openstackdocstheme==1.18.1
os-client-config==1.28.0
oslo.config==5.2.0
oslo.utils==3.33.0
oslosphinx==4.7.0
oslotest==3.2.0
pbr==4.0.0
python-neutronclient==6.7.0
python-openstackclient==3.16.0
python-subunit==1.0.0
reno==2.5.0
SQLAlchemy==1.2.0
Sphinx==1.6.5
stestr==1.0.0
tempest==17.0.0
testresources==2.0.0
testscenarios==0.4
testtools==2.2.0
WebOb==1.8.2

View File

@ -1,49 +0,0 @@
#!/usr/bin/env bash
set -ex
VENV=${1:-"dsvm-functional"}
GATE_DEST=$BASE/new
NEUTRON_PATH=$GATE_DEST/neutron
NETWORKING_CCF_PATH=$GATE_DEST/neutron-classifier
GATE_HOOKS=$NETWORKING_CCF_PATH/neutron_classifier/tests/contrib/hooks
DEVSTACK_PATH=$GATE_DEST/devstack
LOCAL_CONF=$DEVSTACK_PATH/late-local.conf
DSCONF=/tmp/devstack-tools/bin/dsconf
# Install devstack-tools used to produce local.conf; we can't rely on
# test-requirements.txt because the gate hook is triggered before neutron is
# installed
sudo -H pip install virtualenv
virtualenv /tmp/devstack-tools
/tmp/devstack-tools/bin/pip install -U devstack-tools==0.4.0
case $VENV in
"dsvm-functional"|"dsvm-fullstack")
# The following need to be set before sourcing
# configure_for_func_testing.
GATE_STACK_USER=stack
PROJECT_NAME=neutron-classifier
IS_GATE=True
LOCAL_CONF=$DEVSTACK_PATH/local.conf
source $DEVSTACK_PATH/functions
source $NEUTRON_PATH/devstack/lib/ovs
source $NEUTRON_PATH/tools/configure_for_func_testing.sh
configure_host_for_func_testing
# Make the workspace owned by the stack user
sudo chown -R $STACK_USER:$STACK_USER $BASE
;;
"dsvm-neutron-classifier")
export DEVSTACK_LOCALCONF=$(cat $LOCAL_CONF)
$BASE/new/devstack-gate/devstack-vm-gate.sh
;;
*)
echo "Unrecognized environment $VENV".
exit 1
esac

View File

@ -1,42 +0,0 @@
#!/usr/bin/env bash
set -xe
CCF_DIR="$BASE/new/neutron-classifier"
SCRIPTS_DIR="/usr/os-testr-env/bin/"
venv=${1:-"dsvm-functional"}
function generate_testr_results {
# Give job user rights to access tox logs
sudo -H -u $owner chmod o+rw .
sudo -H -u $owner chmod o+rw -R .stestr
if [ -f ".stestr/0" ] ; then
.tox/$venv/bin/subunit-1to2 < .stestr/0 > ./stestr.subunit
$SCRIPTS_DIR/subunit2html ./stestr.subunit testr_results.html
gzip -9 ./stestr.subunit
gzip -9 ./testr_results.html
sudo mv ./*.gz /opt/stack/logs/
fi
}
if [[ "$venv" == dsvm-functional* ]] || [[ "$venv" == dsvm-fullstack* ]]
then
owner=stack
sudo_env=
# Set owner permissions according to job's requirements.
cd $CCF_DIR
sudo chown -R $owner:stack $CCF_DIR
# Run tests
echo "Running neutron-classifier $venv test suite"
set +e
sudo -H -u $owner $sudo_env tox -e $venv
testr_exit_code=$?
set -e
# Collect and parse results
generate_testr_results
exit $testr_exit_code
fi

View File

@ -1,80 +0,0 @@
- hosts: primary
tasks:
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=**/*nose_results.html
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=**/*testr_results.html.gz
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=/.testrepository/tmp*
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=**/*testrepository.subunit.gz
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}/tox'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=/.tox/*/log/*
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=/logs/**
- --include=*/
- --exclude=*
- --prune-empty-dirs

View File

@ -1,70 +0,0 @@
- hosts: all
name: neutron-classifier-functional-dsvm
tasks:
- name: Ensure legacy workspace directory
file:
path: '{{ ansible_user_dir }}/workspace'
state: directory
- shell:
cmd: |
set -e
set -x
cat > clonemap.yaml << EOF
clonemap:
- name: openstack/devstack-gate
dest: devstack-gate
EOF
/usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \
https://opendev.org \
openstack/devstack-gate
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'
- shell:
cmd: |
set -e
set -x
cat << 'EOF' >>"/tmp/dg-local.conf"
[[local|localrc]]
enable_plugin neutron-classifier https://opendev.org/x/neutron-classifier
EOF
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'
- shell:
cmd: |
set -e
set -x
export PYTHONUNBUFFERED=true
export DEVSTACK_GATE_UNSTACK=1
export DEVSTACK_GATE_TEMPEST=0
export DEVSTACK_GATE_EXERCISES=0
export DEVSTACK_GATE_NEUTRON=1
export DEVSTACK_GATE_INSTALL_TESTONLY=1
export BRANCH_OVERRIDE=default
if [ "$BRANCH_OVERRIDE" != "default" ] ; then
export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE
fi
# Because we are testing a non standard project, add
# our project repository. This makes zuul do the right
# reference magic for testing changes.
export PROJECTS="x/neutron-classifier $PROJECTS"
# Keep localrc to be able to set some vars in pre_test_hook
export KEEP_LOCALRC=1
function gate_hook {
bash -xe $BASE/new/neutron-classifier/neutron_classifier/tests/contrib/gate_hook.sh dsvm-functional
}
export -f gate_hook
function post_test_hook {
bash -xe $BASE/new/neutron-classifier/neutron_classifier/tests/contrib/post_test_hook.sh dsvm-functional
}
export -f post_test_hook
cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh
./safe-devstack-vm-gate-wrap.sh
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'

View File

@ -1,9 +1,23 @@
pbr>=2.0.0,!=2.1.0 # Apache-2.0
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr>=4.0.0,!=2.1.0 # Apache-2.0
Babel>=2.3.4,!=2.4.0 # BSD
keystoneauth1>=3.6.2 # Apache-2.0
python-neutronclient>=6.7.0 # Apache-2.0
python-openstackclient>=3.16.0 # Apache-2.0
SQLAlchemy>=1.0.10,!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8 # MIT
neutron-lib>=1.18.0 # Apache-2.0
SQLAlchemy>=1.2.0,!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8 # MIT
# OpenStack CI will install the following projects from git
# if they are in the required-projects list for a job:
neutron-lib>=1.28.0 # Apache-2.0
neutron>=14.0.0 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
# The comment below indicates this project repo is current with neutron-lib
# and should receive neutron-lib consumption patches as they are released
# in neutron-lib. It also implies the project will stay current with TC
# and infra initiatives ensuring consumption patches can land.
# neutron-lib-current

View File

@ -4,13 +4,13 @@
hacking>=1.1.0,<1.2.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
coverage>=4.5.1 # Apache-2.0
python-subunit>=1.0.0 # Apache-2.0/BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD
openstackdocstheme>=1.18.1 # Apache-2.0
oslosphinx>=4.7.0 # Apache-2.0
WebOb>=1.7.1 # MIT
WebOb>=1.8.2 # MIT
oslotest>=3.2.0 # Apache-2.0
os-client-config>=1.28.0 # Apache-2.0
stestr>=2.0.0 # Apache-2.0

66
tox.ini
View File

@ -1,6 +1,6 @@
[tox]
minversion = 1.6
envlist = py36,py35,py27,pep8
minversion = 2.0
envlist = docs,py36,py35,py27,pep8
skipsdist = True
[testenv]
@ -11,6 +11,7 @@ setenv =
OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:60}
PYTHONWARNINGS=default::DeprecationWarning
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
@ -27,8 +28,11 @@ commands =
[testenv:pep8]
basepython = python3
deps =
{[testenv]deps}
commands =
flake8
{[testenv:genconfig]commands}
{[testenv:genpolicy]commands}
[testenv:dsvm]
basepython = python3
@ -40,10 +44,11 @@ basepython = python3
setenv = {[testenv]setenv}
OS_TEST_TIMEOUT=180
OS_TEST_PATH=./neutron_classifier/tests/functional
OS_FAIL_ON_MISSING_DEPS=1
OS_TESTR_CONCURRENCY=1
OS_LOG_PATH={env:OS_LOG_PATH:/opt/stack/logs}
deps =
{[testenv]deps}
-r{toxinidir}/neutron_classifier/tests/functional/requirements.txt
deps = {[testenv]deps}
-r{toxinidir}/neutron_classifier/tests/functional/requirements.txt
commands =
stestr run {posargs}
@ -59,7 +64,7 @@ deps =
commands = stestr run {posargs}
[testenv:dsvm-functional]
basepython = python2.7
basepython = python3
setenv = {[testenv:functional]setenv}
{[testenv:dsvm]setenv}
OS_TEST_PATH=./neutron_classifier/tests/functional
@ -93,3 +98,50 @@ show-source = True
#ignore =
builtins = _
exclude = ./.*,build,dist
[testenv:genconfig]
basepython = python3
commands = oslo-config-generator --config-file etc/oslo-config-generator/networking-classifier.conf
[testenv:genpolicy]
basepython = python3
commands = oslopolicy-sample-generator --config-file=etc/oslo-policy-generator/policy.conf
[testenv:dev]
# run locally (not in the gate) using editable mode
# https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs
#note: Order is important
commands =
pip install -q -e "git+https://opendev.org/openstack/neutron-lib#egg=neutron_lib"
pip install -q -e "git+https://opendev.org/openstack/neutron#egg=neutron"
[testenv:py3-dev]
basepython = python3
commands =
{[testenv:dev]commands}
{[testenv]commands}
[testenv:py27-dev]
basepython = python2.7
commands =
{[testenv:dev]commands}
{[testenv]commands}
[testenv:pep8-dev]
basepython = python3
deps =
{[testenv]deps}
commands =
{[testenv:dev]commands}
{[testenv:pep8]commands}
[testenv:requirements-check-dev]
basepython = python3
commands =
pip install -q -e "git+https://opendev.org/openstack/requirements#egg=requirements"
pip freeze
# must have openstack/requirements on latest src/master in ../requirements
{toxinidir}/../requirements/playbooks/files/project-requirements-change.py --reqs={toxinidir}/../requirements {toxinidir}
deps =
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt

View File

@ -1,34 +1,12 @@
- project:
check:
jobs:
- neutron-classifier-functional-dsvm:
required-projects:
- openstack/neutron
- openstack/neutron-lib
gate:
jobs:
- neutron-classifier-functional-dsvm:
required-projects:
- openstack/neutron
- openstack/neutron-lib
- job:
name: neutron-classifier-functional-dsvm
parent: legacy-dsvm-base
run: playbooks/legacy/neutron-classifier-functional-dsvm/run.yaml
post-run: playbooks/legacy/neutron-classifier-functional-dsvm/post.yaml
timeout: 7800
required-projects:
- openstack/keystone
- openstack/neutron
- openstack/neutron-lib
- x/neutron-classifier
roles:
- zuul: openstack-infra/devstack
- job:
name: neutron-classifier-config-job
description: Sample job to hold configuration settings for jobs
vars:
tox_install_siblings: true
devstack_localrc:
DATABASE_PASSWORD: secretdatabase
RABBIT_PASSWORD: secretrabbit
MYSQL_PASSWORD: secretmysql
ADMIN_PASSWORD: secretadmin
SERVICE_PASSWORD: secretservice
NETWORK_GATEWAY: 10.1.0.1
@ -41,7 +19,6 @@
LIBS_FROM_GIT: python-openstackclient
GLANCE_V1_ENABLED: true
devstack_services:
tox_install_siblings: true
dstat: true
etcd3: true
mysql: true
@ -69,3 +46,33 @@
osc_environment:
PYTHONUNBUFFERED: 'true'
OS_CLOUD: devstack-admin
- job:
name: neutron-classifier-functional
parent: neutron-functional
timeout: 5400
vars:
project_name: neutron-classifier
required-projects:
- x/neutron-classifier
- openstack/devstack-gate
- openstack/keystone
- openstack/neutron
- job:
name: neutron-classifier-tox-lower-constraints
parent: openstack-tox-lower-constraints
timeout: 5400
required-projects:
- openstack/devstack-gate
- openstack/neutron
#(TODO)
#- job: neutron-classifier-tempest
# parent: neutron-tempest
# timeout: 5400
# vars:
# project_name: neutron-classifier
# required-projects:
# - openstack/neutron
# - openstack/devstack-gate

55
zuul.d/project.yaml Normal file
View File

@ -0,0 +1,55 @@
- project:
templates:
- check-requirements
- openstack-python-jobs-neutron
- openstack-python35-jobs-neutron
- openstack-python3-train-jobs
- openstack-python37-jobs-neutron
check:
jobs:
- openstack-tox-pep8:
required-projects:
# - openstack/devstack (not sure if needed)
- openstack/neutron
- openstack-tox-py27:
timeout: 5400
required-projects:
- openstack/neutron
- openstack-tox-py35:
timeout: 5400
required-projects:
- openstack/neutron
- openstack-tox-py36:
timeout: 5400
required-projects:
- openstack/neutron
- openstack-tox-docs:
required-projects:
- openstack/neutron
gate:
jobs:
- openstack-tox-pep8:
timeout: 5400
required-projects:
- openstack/devstack-gate
- openstack/neutron
- openstack-tox-py27:
timeout: 5400
required-projects:
- openstack/devstack-gate
- openstack/neutron
- openstack-tox-py35:
timeout: 5400
required-projects:
- openstack/devstack-gate
- openstack/neutron
- openstack-tox-py36:
timeout: 5400
required-projects:
- openstack/devstack-gate
- openstack/neutron
- openstack-tox-py37:
timeout: 5400
required-projects:
- openstack/devstack-gate
- openstack/neutron