yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #56576
[Bug 1623425] Re: DNSNameServerDbObjectTestCase.test_filtering_by_fields fails sometimes
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 <ihrachys@xxxxxxxxxx>
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
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1623425
Title:
DNSNameServerDbObjectTestCase.test_filtering_by_fields fails sometimes
Status in neutron:
Fix Released
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
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1623425/+subscriptions
References