Unit tests fail with new jsonschema 2.4.0

Bug #1359284 reported by Andrew Lazarev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Sahara
Fix Released
Critical
Sergey Lukjanov
Declined for Juno by Sergey Lukjanov
Icehouse
Fix Released
Critical
Sergey Lukjanov

Bug Description

Steps to repro:

1. Update jsonschema to 2.4.0 (line from requirements: "jsonschema>=2.0.0,<3.0.0")
2. run unit tests

I see two problems:
1. tests fail
2. expected and actual results swapped

Result:
Traceback (most recent call last):
  File "/Users/andrew/Sahara/sahara/sahara/tests/unit/service/validation/test_ng_template_validation_create.py", line 145, in test_ng_template_create_v_minimum_ints
    u'-1.0 is less than the minimum of 0')
  File "/Users/andrew/Sahara/sahara/.tox/py27/lib/python2.7/site-packages/mock.py", line 1201, in patched
    return func(*args, **keywargs)
  File "sahara/tests/unit/service/validation/utils.py", line 274, in _assert_create_object_validation
    self._assert_calls(bad_req, bad_req_i)
  File "sahara/tests/unit/service/validation/utils.py", line 258, in _assert_calls
    self.assertEqual(mock.call_args[0][0].message, call_info[2])
  File "/Users/andrew/Sahara/sahara/.tox/py27/lib/python2.7/site-packages/testtools/testcase.py", line 321, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/Users/andrew/Sahara/sahara/.tox/py27/lib/python2.7/site-packages/testtools/testcase.py", line 406, in assertThat
    raise mismatch_error
MismatchError: !=:
reference = '-1 is less than the minimum of 0'
actual = u'-1.0 is less than the minimum of 0'

Changed in sahara:
assignee: nobody → Andrew Lazarev (alazarev)
importance: Undecided → High
status: New → Confirmed
milestone: none → juno-3
Changed in sahara:
status: Confirmed → In Progress
Changed in sahara:
assignee: Andrew Lazarev (alazarev) → Sergey Lukjanov (slukjanov)
Changed in sahara:
importance: High → Critical
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to sahara (master)

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

Revision history for this message
Sergey Lukjanov (slukjanov) wrote :

The correct solution is to make our unit tests work with both versions of jsonschema.

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

Reviewed: https://review.openstack.org/115946
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=822c2f053f8aef6d75e82631c7881cb64b7fa0a7
Submitter: Jenkins
Branch: master

commit 822c2f053f8aef6d75e82631c7881cb64b7fa0a7
Author: Sergey Lukjanov <email address hidden>
Date: Thu Aug 21 15:37:08 2014 +0400

    Fix jsonschema>=2.4.0 message assertion

    The jsonschema 2.4.0 release slightly changed some of the error messages
    that are provided when validation fails. This patch updates the unit tests to
    expect the proper string and avoid failing as a result by using regex
    (.0)? instead of specific value.

    Change-Id: Ifd41147fd6157038b102c78144d1f6cb16cc25e6
    Closes-bug: #1359284

Changed in sahara:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in sahara:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to sahara (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/121521

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to sahara (stable/icehouse)

Reviewed: https://review.openstack.org/121521
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=03ef7dd4a28b976e6b853aa70bf81ac3f68f46a0
Submitter: Jenkins
Branch: stable/icehouse

commit 03ef7dd4a28b976e6b853aa70bf81ac3f68f46a0
Author: Sergey Lukjanov <email address hidden>
Date: Thu Aug 21 15:37:08 2014 +0400

    Fix jsonschema>=2.4.0 message assertion

    The jsonschema 2.4.0 release slightly changed some of the error messages
    that are provided when validation fails. This patch updates the unit tests to
    expect the proper string and avoid failing as a result by using regex
    (.0)? instead of specific value.

    Change-Id: Ifd41147fd6157038b102c78144d1f6cb16cc25e6
    Closes-bug: #1359284
    (cherry picked from commit 822c2f053f8aef6d75e82631c7881cb64b7fa0a7)

tags: added: in-stable-icehouse
Thierry Carrez (ttx)
Changed in sahara:
milestone: juno-3 → 2014.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.