test_neutronv2 unit tests fail with python-neutronclient 5.0.0

Bug #1608258 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Matt Riedemann

Bug Description

Seen in a g-r change here:

https://review.openstack.org/#/c/347652/

http://logs.openstack.org/52/347652/5/check/gate-cross-nova-python27-db-ubuntu-xenial/97c6a0d/console.html#_2016-07-30_17_59_01_389311

2016-07-30 17:59:01.388984 | Captured traceback:
2016-07-30 17:59:01.389033 | ~~~~~~~~~~~~~~~~~~~
2016-07-30 17:59:01.389058 | Traceback (most recent call last):
2016-07-30 17:59:01.389095 | File "nova/tests/unit/network/test_neutronv2.py", line 1678, in test_validate_networks
2016-07-30 17:59:01.389120 | tenant_id=uuids.my_tenant).AndReturn(
2016-07-30 17:59:01.389175 | File "/home/jenkins/workspace/gate-cross-nova-python27-db-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/mox3/mox.py", line 1109, in __call__
2016-07-30 17:59:01.389200 | self._checker.Check(params, named_params)
2016-07-30 17:59:01.389253 | File "/home/jenkins/workspace/gate-cross-nova-python27-db-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/mox3/mox.py", line 1031, in Check
2016-07-30 17:59:01.389280 | % (' '.join(sorted(still_needed))))
2016-07-30 17:59:01.389311 | AttributeError: No values given for arguments: project_id

It's because of this change: https://review.openstack.org/#/c/320090/

And these unit tests are creating a mox'ed mock of the neutronclient Client class, which doesn't get that these methods are decorated with a rename from debtcollector:

http://git.openstack.org/cgit/openstack/debtcollector/tree/debtcollector/renames.py#n25

We currently require neutronclient>=4.2 which doesn't have these kwargs, so I can't start passing project_name/project_id until neutronclient>=5.0 in g-r, and I can't pass tenant_id/name until that point.

We might have to change the tests to use mock instead of mox which is less strict.

Revision history for this message
Matt Riedemann (mriedem) wrote :

I tried stubbing out the mox'ed neutronclient in the tests but it's not happy about that - the stub doesn't work for the asserts:

http://paste.openstack.org/show/544710/

Revision history for this message
Matt Riedemann (mriedem) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to nova (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/349300

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Matt Riedemann (<email address hidden>) on branch: master
Review: https://review.openstack.org/349300
Reason: This is fixed in:

https://review.openstack.org/#/c/349297/

Matt Riedemann (mriedem)
Changed in nova:
assignee: nobody → Matt Riedemann (mriedem)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/349297
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=a280d2e88c7a732630a5ae00c2c452c6db34cc8b
Submitter: Jenkins
Branch: master

commit a280d2e88c7a732630a5ae00c2c452c6db34cc8b
Author: Matt Riedemann <email address hidden>
Date: Sun Jul 31 18:34:57 2016 -0400

    Straddle python-neutronclient 5.0 for testing

    python-neutronclient 5.0 has deprecated the usage of
    tenant_id/tenant_name in place of project_id/project_name
    for keystone v3 usage. It does this using debtcollector
    decorators on the methods with those kwargs. This is fine
    at runtime but doesn't work with mox since mox stubs the
    methods off the Client class, but doesn't pick up and stub
    any decorators on those methods. So when our unit tests
    pass tenant_id kwargs they fail on the moxed_client.

    To make the tests work for both neutronclient>5 and <5 we
    simply pass the project_id as an arg rather than kwarg
    to the show_quota method.

    Change-Id: I86bbac3e24bef27396297dfc79eb24c61dbcb6ac
    Closes-Bug: #1608258

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 14.0.0.0b3

This issue was fixed in the openstack/nova 14.0.0.0b3 development milestone.

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.