Unit tests failing with KeyError: 'network_type'

Bug #1475735 reported by Mark Goddard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
networking-arista
Fix Committed
Undecided
Mark Goddard

Bug Description

Three unit tests are currently failing in the ML2 test cases following the addition of the network type check in the neutron Arista ML2 driver. The network_type field is missing from the dummy network context object, causing a KeyError exception.

Failing tests:

networking_arista.tests.unit.ml2.test_arista_mechanism_driver.RealNetStorageAristaDriverTestCase.test_create_and_delete_ports
networking_arista.tests.unit.ml2.test_arista_mechanism_driver.RealNetStorageAristaDriverTestCase.test_create_and_delete_network
networking_arista.tests.unit.ml2.test_arista_mechanism_driver.RealNetStorageAristaDriverTestCase.test_create_and_delete_multiple_networks

Tox test run output:

$ tox -e py27
py27 develop-inst-nodeps: /root/networking-arista
py27 installed: aioeventlet==0.4,alabaster==0.7.6,alembic==0.7.6,amqp==1.4.6,anyjson==0.3.3,appdirs==1.4.0,Babel==1.3,cachetools==1.0.3,cliff==1.13.0,cmd2==0.6.8,coverage==3.7.1,debtcollector==0.5.0,decorator==3.4.2,discover==0.4.0,docutils==0.12,eventlet==0.17.4,extras==0.0.3,fasteners==0.12.0,fixtures==1.3.1,flake8==2.1.0,funcsigs==0.4,futures==3.0.3,futurist==0.1.1,greenlet==0.4.7,hacking==0.9.6,httplib2==0.9.1,iso8601==0.1.10,Jinja2==2.7.3,jsonrpclib==0.1.3,keystonemiddleware==2.1.0,kombu==3.0.26,linecache2==1.0.0,Mako==1.0.1,MarkupSafe==0.23,mccabe==0.2.1,mock==1.1.3,monotonic==0.2,mox3==0.8.0,msgpack-python==0.4.6,netaddr==0.7.15,netifaces==0.10.4,-e git+http://<email address hidden>/scm/df/networking-arista@3a3fd6341d2f212f53b2efe29f4eaf546fec1534#egg=networking_arista-df9_master,-e git://git.openstack.org/openstack/neutron.git@c7bcf6d4d69b3b06432552d5fae147af0e8ed90f#egg=neutron-master,os-client-config==1.4.0,oslo.concurrency==2.3.0,oslo.config==1.15.0,oslo.context==0.4.0,oslo.db==2.1.0,oslo.i18n==2.1.0,oslo.log==1.6.0,oslo.messaging==1.17.0,oslo.middleware==2.4.0,oslo.policy==0.7.0,oslo.rootwrap==2.1.0,oslo.serialization==1.7.0,oslo.service==0.4.0,oslo.utils==1.9.0,oslosphinx==3.0.0,oslotest==1.9.0,Paste==2.0.2,PasteDeploy==1.5.2,pbr==1.3.0,pep8==1.5.6,posix-ipc==1.0.0,prettytable==0.7.2,pycadf==1.0.0,pyflakes==0.8.1,Pygments==2.0.2,pyparsing==2.0.3,python-keystoneclient==1.6.0,python-mimeparse==0.1.4,python-neutronclient==2.6.0,python-novaclient==2.26.0,python-subunit==1.1.0,pytz==2015.4,PyYAML==3.11,repoze.lru==0.6,requests==2.7.0,retrying==1.3.3,Routes==2.1,simplejson==3.7.3,six==1.9.0,snowballstemmer==1.2.0,Sphinx==1.3.1,sphinx-rtd-theme==0.1.8,SQLAlchemy==1.0.6,sqlalchemy-migrate==0.9.7,sqlparse==0.1.15,stevedore==1.6.0,Tempita==0.5.2,testrepository==0.0.20,testresources==0.2.7,testscenarios==0.5.0,testtools==1.8.0,traceback2==1.4.0,trollius==2.0,unittest2==1.1.0,WebOb==1.4.1,wheel==0.24.0,wrapt==1.10.5
py27 runtests: PYTHONHASHSEED='1689066858'
py27 runtests: commands[0] | python setup.py testr --slowest --testr-args=
running testr
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
OS_LOG_CAPTURE=1 \
${PYTHON:-python} -m subunit.run discover -t ./ . --list
No handlers could be found for logger "neutron.quota"
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
OS_LOG_CAPTURE=1 \
${PYTHON:-python} -m subunit.run discover -t ./ . --load-list /tmp/tmpi4eqp8
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
OS_LOG_CAPTURE=1 \
${PYTHON:-python} -m subunit.run discover -t ./ . --load-list /tmp/tmpoKgK3Q
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
OS_LOG_CAPTURE=1 \
${PYTHON:-python} -m subunit.run discover -t ./ . --load-list /tmp/tmpdHX5cM
No handlers could be found for logger "neutron.quota"
No handlers could be found for logger "neutron.quota"
No handlers could be found for logger "neutron.quota"
======================================================================
FAIL: networking_arista.tests.unit.ml2.test_arista_mechanism_driver.RealNetStorageAristaDriverTestCase.test_create_and_delete_multiple_networks
tags: worker-0
----------------------------------------------------------------------
Empty attachments:
  pythonlogging:''
  pythonlogging:'neutron.api.extensions'
  stderr
  stdout

Traceback (most recent call last):
  File "networking_arista/tests/unit/ml2/test_arista_mechanism_driver.py", line 641, in test_create_and_delete_multiple_networks
    self.drv.create_network_precommit(network_context)
  File "/root/networking-arista/.tox/py27/src/neutron/neutron/plugins/ml2/drivers/arista/mechanism_arista.py", line 73, in create_network_precommit
    if segments[0][driver_api.NETWORK_TYPE] != p_const.TYPE_VLAN:
KeyError: 'network_type'
======================================================================
FAIL: networking_arista.tests.unit.ml2.test_arista_mechanism_driver.RealNetStorageAristaDriverTestCase.test_create_and_delete_network
tags: worker-0
----------------------------------------------------------------------
Empty attachments:
  pythonlogging:''
  pythonlogging:'neutron.api.extensions'
  stderr
  stdout

Traceback (most recent call last):
  File "networking_arista/tests/unit/ml2/test_arista_mechanism_driver.py", line 611, in test_create_and_delete_network
    self.drv.create_network_precommit(network_context)
  File "/root/networking-arista/.tox/py27/src/neutron/neutron/plugins/ml2/drivers/arista/mechanism_arista.py", line 73, in create_network_precommit
    if segments[0][driver_api.NETWORK_TYPE] != p_const.TYPE_VLAN:
KeyError: 'network_type'
======================================================================
FAIL: networking_arista.tests.unit.ml2.test_arista_mechanism_driver.RealNetStorageAristaDriverTestCase.test_create_and_delete_ports
tags: worker-1
----------------------------------------------------------------------
Empty attachments:
  pythonlogging:''
  pythonlogging:'neutron.api.extensions'
  stderr
  stdout

Traceback (most recent call last):
  File "networking_arista/tests/unit/ml2/test_arista_mechanism_driver.py", line 670, in test_create_and_delete_ports
    self.drv.create_network_precommit(network_context)
  File "/root/networking-arista/.tox/py27/src/neutron/neutron/plugins/ml2/drivers/arista/mechanism_arista.py", line 73, in create_network_precommit
    if segments[0][driver_api.NETWORK_TYPE] != p_const.TYPE_VLAN:
KeyError: 'network_type'
Ran 70 tests in 1.203s (-0.187s)
FAILED (id=145, failures=3 (+3))
error: testr failed (1)
ERROR: InvocationError: '/root/networking-arista/.tox/py27/bin/python setup.py testr --slowest --testr-args='
___________________________________________________________________ summary ___________________________________________________________________
ERROR: py27: commands failed

Mark Goddard (mgoddard)
Changed in networking-arista:
assignee: nobody → Mark Goddard (mgoddard)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to networking-arista (master)

Fix proposed to branch: master
Review: https://review.openstack.org/203180

Changed in networking-arista:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to networking-arista (master)

Reviewed: https://review.openstack.org/203180
Committed: https://git.openstack.org/cgit/openstack/networking-arista/commit/?id=e8df407d54bc61f31a9a532c837921dcaa89e3a9
Submitter: Jenkins
Branch: master

commit e8df407d54bc61f31a9a532c837921dcaa89e3a9
Author: Mark Goddard <email address hidden>
Date: Fri Jul 17 18:20:00 2015 +0100

    Fix unit tests

    Fixes three unit tests which have been broken since the network
    type check was added. Adds the network_type field to the network
    context dummy object.

    Change-Id: I5dbc325fd941fad0d436510361f62a5024034812
    Closes-bug: 1475735

Changed in networking-arista:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.