DNSNameServerDbObjectTestCase.test_filtering_by_fields fails sometimes

Bug #1623425 reported by Ihar Hrachyshka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Ihar Hrachyshka

Bug Description

The test fails sometimes.

neutron.tests.unit.objects.test_subnet.DNSNameServerDbObjectTestCase.test_filtering_by_fields
---------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b' File "/home/vagrant/git/neutron/neutron/tests/unit/objects/test_base.py", line 1215, in test_filtering_by_fields'
    b" 'Filtering by %s failed.' % field)"
    b' File "/home/vagrant/git/neutron/.tox/py34/lib/python3.4/site-packages/unittest2/case.py", line 1182, in assertItemsEqual'
    b' return self.assertSequenceEqual(expected, actual, msg=msg)'
    b' File "/home/vagrant/git/neutron/.tox/py34/lib/python3.4/site-packages/unittest2/case.py", line 1014, in assertSequenceEqual'
    b' self.fail(msg)'
    b' File "/home/vagrant/git/neutron/.tox/py34/lib/python3.4/site-packages/unittest2/case.py", line 690, in fail'
    b' raise self.failureException(msg)'
    b"AssertionError: Sequences differ: [{'subnet_id': 'a8b63bc4-9799-4781-83c8-48e9491dcd5e', 'address': 'ioojfcuswf'}] != []"
    b''
    b'First sequence contains 1 additional elements.'
    b'First extra element 0:'
    b"{'subnet_id': 'a8b63bc4-9799-4781-83c8-48e9491dcd5e', 'address': 'ioojfcuswf'}"
    b''
    b'+ []'
    b"- [{'address': 'ioojfcuswf',"
    b"- 'subnet_id': 'a8b63bc4-9799-4781-83c8-48e9491dcd5e'}] : Filtering by order failed."
    b''

Reproducible with: ostestr --regex neutron.tests.unit.objects.test_subnet.DNSNameServerDbObjectTestCase.test_filtering_by_fields --until-failure

Log example: http://logs.openstack.org/59/365659/10/check/gate-neutron-python34/afb20dd/testr_results.html.gz

Changed in neutron:
assignee: nobody → Ihar Hrachyshka (ihar-hrachyshka)
status: New → Confirmed
milestone: none → newton-rc1
importance: Undecided → High
tags: added: gate-failure unittest
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

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

Reviewed: https://review.openstack.org/370037
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=2676372f261da202f41ab8e2d175be27b9405261
Submitter: Jenkins
Branch: master

commit 2676372f261da202f41ab8e2d175be27b9405261
Author: Ihar Hrachyshka <email address hidden>
Date: Sat Sep 10 06:07:58 2016 +0000

    tests: don't override base object test class attributes

    DNSNameServerDbObjectTestCase was overriding self.db_objs and
    self.obj_fields if the attributes did not have unique order/address
    fields generated by get_random_fields. But since
    Id1ca4ce7b134d9729e68661cedb2f5556e58d6ff landed, we should have also
    updated self.objs, otherwise test_filtering_by_fields will fail later
    when it will try to find an object with attributes that were not used
    when creating the object targeted by the filtering attempt.

    Instead of adding the update for self.objs in the
    DNSNameServerDbObjectTestCase test class, I went with an alternative
    approach, getting rid of overriding logic completely. The rationale for
    the path is that there is nothing wrong in duplicate address and order
    field values (at least as per underlying model definition), and hence
    our tests should be resilient against that kind of scenario.

    So instead of comparing all fields for an object, just make sure that
    the order monotonically goes up/down in the sorted result, and ignore
    other fields to be strictly ordered.

    Change-Id: Ic956072de5dab336f83b04bddfa9da967b2865b2
    Closes-Bug: #1623425

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

This issue was fixed in the openstack/neutron 9.0.0.0rc1 release candidate.

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.