TestObjEqualPrims.test_object_not_equal is failing

Bug #1465344 reported by Sylvain Bauza
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Paul Murray

Bug Description

For some reason not yet identified, local master branches fail with this check

======================================================================
FAIL: nova.tests.unit.objects.test_objects.TestObjEqualPrims.test_object_not_equal
----------------------------------------------------------------------
Traceback (most recent call last):
testtools.testresult.real._StringException: Empty attachments:
  pythonlogging:''
  stderr
  stdout

Traceback (most recent call last):
  File "nova/tests/unit/objects/test_objects.py", line 1419, in test_object_not_equal
    "Objects that differ in any field "
  File "/home/sbauza/git/openstack/nova/.venv/lib/python2.7/site-packages/unittest2/case.py", line 672, in assertFalse
    raise self.failureException(msg)
AssertionError: True is not false : Objects that differ in any field should not be equal

but Jenkins py27 seems to be fine, with LogStash silent :
http://logstash.openstack.org/#eyJzZWFyY2giOiJtZXNzYWdlOlwiT2JqZWN0cyB0aGF0IGRpZmZlciBpbiBhbnkgZmllbGQgc2hvdWxkIG5vdCBiZSBlcXVhbFwiIEFORCB0YWdzOlwiY29uc29sZS5odG1sXCIiLCJmaWVsZHMiOltdLCJvZmZzZXQiOjAsInRpbWVmcmFtZSI6IjE0NDAwIiwiZ3JhcGhtb2RlIjoiY291bnQiLCJ0aW1lIjp7InVzZXJfaW50ZXJ2YWwiOjB9LCJzdGFtcCI6MTQzNDM4NDc1MzYxM30=

A git bisect shows d95c05a8fd2f762765408b9cf84da7c8d34a7892 being the bad guy.

Revision history for this message
Paul Murray (pmurray) wrote :

I stepped through the test in a debugger and found that the name managling for the object fields was not happening as they were set. So e.g.

        obj1 = MyObj(foo=1, bar='goodbye')

creates an object with the fields stored as: foo and bar

The test code converts the objects to primitives and then compares the primitives. The calls to obj_to_primitve() return:

prim1 = {'nova_object.version': '1.6', 'nova_object.name': 'MyObj', 'nova_object.data': {}, 'nova_object.namespace': 'nova'}
prim2 = {'nova_object.version': '1.6', 'nova_object.name': 'MyObj', 'nova_object.data': {}, 'nova_object.namespace': 'nova'}

This is because the getter on the objects is using the _obj_ prefix on the names when looking up the data fields, but they were saved by the setter without those prefixes, so they are not found.

The setter and getter code is added by the object metaclass - so something is going wrong there.

The commit d95c05a8fd2f762765408b9cf84da7c8d34a7892 identified above changes the metaclass.

Note: this is not happening in CI checks on jenkins, only on local test runs - so something environmental?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
assignee: nobody → Paul Murray (pmurray)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit c2dcdb0b56653912614d31d3f94b48f2fd8e0b66
Author: Paul Murray <email address hidden>
Date: Mon Jun 15 18:30:18 2015 +0100

    Fix TestObjEqualPrims test object registration

    The way objects are registered was changed in commit
    d95c05a8fd2f762765408b9cf84da7c8d34a7892 so that test objects were
    no longer automatically registered. This meant that they now have
    to be explicitly registered. The MyObj test object in
    nova.tests.unit.object.test_objects is registered in
    _BaseTestCase.setup() for convienience. Unfortunately
    TestObjEqualPrims did not extend _BaseTestCase so it missed the
    registration and so the tests are invalid.

    This fixes the tests by making them extend _BaseTestCase.

    Closes-Bug: #1465344

    Change-Id: Ibfd4d81f9aecbd3628193cf47688ab3ac28090db

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → liberty-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: liberty-1 → 12.0.0
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.