← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1545167] [NEW] _compare_results incorrectly reports extra list items when items in lists don't match

 

Public bug reported:

I discovered this bug while refactoring functional tests. This happens
in the current Nova master.

The _compare_results function is defined in
nova/tests/functional/api_samples_test_base.py

To reproduce, pass two lists to _compare_results that are the same
length but have one item not equal.

list1 = [{u'foo': u'bar', u'bar': u'baz'}]

list2 = [{u'foo': u'baz', u'bar': u'baz'}]

_compare_results returns the following:

nova.tests.functional.api_samples_test_base.NoMatch: Extra list items in template:
{u'foo': u'bar', u'bar': u'baz'}
Extra list items in Test:
{u'foo': u'baz', u'bar': u'baz'}

While this is "technically" accurate, it's really hard to debug if you
can imagine a lengthy, nested json file dumped into that response.

_compare_results is already checking each item in the list, it should
just be returning a list of keys that don't match, not the whole thing!

** Affects: nova
     Importance: Medium
     Assignee: Augustina Ragwitz (auggy)
         Status: Confirmed


** Tags: testing

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1545167

Title:
  _compare_results incorrectly reports extra list items when items in
  lists don't match

Status in OpenStack Compute (nova):
  Confirmed

Bug description:
  I discovered this bug while refactoring functional tests. This happens
  in the current Nova master.

  The _compare_results function is defined in
  nova/tests/functional/api_samples_test_base.py

  To reproduce, pass two lists to _compare_results that are the same
  length but have one item not equal.

  list1 = [{u'foo': u'bar', u'bar': u'baz'}]

  list2 = [{u'foo': u'baz', u'bar': u'baz'}]

  _compare_results returns the following:

  nova.tests.functional.api_samples_test_base.NoMatch: Extra list items in template:
  {u'foo': u'bar', u'bar': u'baz'}
  Extra list items in Test:
  {u'foo': u'baz', u'bar': u'baz'}

  While this is "technically" accurate, it's really hard to debug if you
  can imagine a lengthy, nested json file dumped into that response.

  _compare_results is already checking each item in the list, it should
  just be returning a list of keys that don't match, not the whole
  thing!

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1545167/+subscriptions