test_obj_make_compatible() does not call __init__ properly on ServiceStatusPayload objects

Bug #1537882 reported by Ryan Rossiter on 2016-01-25
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Ryan Rossiter

Bug Description

Because I can tell the future, the test_obj_make_compatible() method will start failing the next time we bump the version of ServiceStatusPayload.

It looks like in https://github.com/openstack/nova/blob/master/nova/tests/unit/objects/test_objects.py#L1252-L1268 we run compatibility checks on all previous versions to see if we're compatible with them. It does not test current->current conversion though, so in the case of ServiceStatusPayload, which is currently at 1.0, that for loop is never run.

I caught this in my change (https://review.openstack.org/#/c/259112/2/nova/tests/unit/objects/test_objects.py) because ovo's compatibility checker includes checking from 1.0 to 1.0 (https://github.com/openstack/oslo.versionedobjects/blob/master/oslo_versionedobjects/fixture.py#L302-L310), and I'm trying to change nova's tests to use the o.vo fixture. In my tests, ServiceStatusPayload is causing:

Traceback (most recent call last):
  File "nova/tests/unit/objects/test_objects.py", line 1259, in test_obj_make_compatible
  File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_versionedobjects/fixture.py", line 325, in test_compatibility_routines
    self._test_object_compatibility(obj_class, manifest=manifest)
  File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_versionedobjects/fixture.py", line 309, in _test_object_compatibility
TypeError: __init__() takes exactly 2 arguments (1 given)

So we need to somehow inject args to __init__() when we need to...

Ryan Rossiter (rlrossit) on 2016-01-25
summary: test_obj_make_compatible() does not call __init__ properly on
- NotificationPayloadBase objects
+ ServiceStatusPayload objects
Changed in nova:
assignee: nobody → Ryan Rossiter (rlrossit)
tags: added: testing

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

Changed in nova:
status: New → In Progress

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

commit e36bc6ee352600d77f4b2cbf352bf2a09933c86d
Author: Ryan Rossiter <email address hidden>
Date: Mon Jan 25 22:01:27 2016 +0000

    Use ovo in test_obj_make_compatible()

    o.vo has a fixture for testing compatibility routines. This changes the
    nova unit tests to use that compatibility testing on all objects. In the
    original nova test, the versions tested were from 1.0 to 1.(x-1), where
    1.x is the current version. o.vo's fixture tests from 1.0 to 1.x, which
    should be a no-op, but is also a good thing to test (if we can't convert
    1.x to 1.x, that's a bad thing).

    o.vo also had an enhancement where it passed args and kwargs to __init__
    in the different objects, which was a bug in nova, but using that
    fixture allows us to also close the nova bug. This change in o.vo was

    Change-Id: Ie127f55f2e5bcd383796ff51253cf1091be16c98
    Closes-Bug: #1537882

Changed in nova:
status: In Progress → Fix Released

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

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers