test_safe_parse_xml not working with some minidom versions

Bug #1172352 reported by Jay Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Jay Bryant

Bug Description

While running the cinder unit tests on a RHEL6 based system using python2.6 I saw the following test case error:

======================================================================
FAIL: test_safe_parse_xml (cinder.tests.test_utils.GenericUtilsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/openstack/cinder-es/cinder/tests/test_utils.py", line 456, in test_safe_parse_xml
    self.assertEqual(normal_body, str(dom.toxml()))
AssertionError: '<?xml version="1.0" ?><foo>\n <bar>\n <v1>hey</v1>\n <v2>there</v2>\n </bar>\n </foo>' != '<?xml version="1.0" ?>\n<foo>\n <bar>\n <v1>hey</v1>\n <v2>there</v2>\n </bar>\n </foo>'
>> raise self.failureException, \
          (None or '%r != %r' % ('<?xml version="1.0" ?><foo>\n <bar>\n <v1>hey</v1>\n <v2>there</v2>\n </bar>\n </foo>', '<?xml version="1.0" ?>\n<foo>\n <bar>\n <v1>hey</v1>\n <v2>there</v2>\n </bar>\n </foo>'))

----------------------------------------------------------------------
Ran 1379 tests in 78.258s

After doing some searching I found the following Bug #1158826 in the Nova project. The bug notes that some versions of minidom inject extra newlines in the parsed XML that is returned. The fix they proposed there also works for Cinder.

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

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

Changed in cinder:
assignee: nobody → Jay Bryant (jsbryant)
status: New → In Progress
Revision history for this message
Avishay Traeger (avishay-il) wrote : AUTO: Avishay Traeger is out of the office (returning 05/12/2013)

I am out of the office until 05/12/2013.

For technical issues regarding the Storwize/SVC Cinder driver, please
contact: Jie Ping Wu <email address hidden>, Li Min Liu <email address hidden>,
Ronen Kat <email address hidden>
For all other issue, please contact my manager, Dalit Naor
<email address hidden>

Note: This is an automated response to your message "[Bug 1172352] [NEW]
test_safe_parse_xml not working with some minidom versions" sent on
24/04/2013 20:06:13.

This is the only notification you will receive while this person is away.

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

Reviewed: https://review.openstack.org/27434
Committed: http://github.com/openstack/cinder/commit/03a32bcb91d3f8af1717277d1d09e571e5c35a7b
Submitter: Jenkins
Branch: master

commit 03a32bcb91d3f8af1717277d1d09e571e5c35a7b
Author: Jay S. Bryant <email address hidden>
Date: Wed Apr 24 12:56:03 2013 -0500

    Avoid using whitespace in test_safe_parse_xml.

    Updates the test_safe_parse_xml test case in
    cinder.tests.test_utils.GenericUtilsTestCase to avoid using
    whitespaces and to ignore extraneous newlines returned in the
    parsed XML. This is required to work around differences in
    the output from minidom in python 2.6.

    Fixes LP Bug #1172352.

    Change-Id: I48bdf3cb8eed3e65f7ceaeb1c2b19aa529c930d0

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