testsuite incompatible with jsonschema 3.0.1

Bug #1824084 reported by Dirk Mueller
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
proliantutils
Fix Released
Undecided
Unassigned

Bug Description

when running tests against jsonschema 3.0.1, you get various failures, like e.g.

[ 90s] FAIL: proliantutils.tests.hpssa.test_manager.ManagerTestCases.test_create_configuration_invalid_logical_disks
[ 90s] tags: worker-4
[ 90s] ----------------------------------------------------------------------
[ 90s] Traceback (most recent call last):
[ 90s] File "/usr/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
[ 90s] return func(*args, **keywargs)
[ 90s] File "proliantutils/tests/hpssa/test_manager.py", line 113, in test_create_configuration_invalid_logical_disks
[ 90s] raid_info)
[ 90s] File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 485, in assertRaises
[ 90s] self.assertThat(our_callable, matcher)
[ 90s] File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 496, in assertThat
[ 90s] mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
[ 90s] File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 547, in _matchHelper
[ 90s] mismatch = matcher.match(matchee)
[ 90s] File "/usr/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 108, in match
[ 90s] mismatch = self.exception_matcher.match(exc_info)
[ 90s] File "/usr/lib/python2.7/site-packages/testtools/matchers/_higherorder.py", line 62, in match
[ 90s] mismatch = matcher.match(matchee)
[ 90s] File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 475, in match
[ 90s] reraise(*matchee)
[ 90s] File "/usr/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 101, in match
[ 90s] result = matchee()
[ 90s] File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 1049, in __call__
[ 90s] return self._callable_object(*self._args, **self._kwargs)
[ 90s] File "proliantutils/hpssa/manager.py", line 130, in create_configuration
[ 90s] validate(raid_config)
[ 90s] File "proliantutils/hpssa/manager.py", line 52, in validate
[ 90s] jsonschema.validate(raid_config, raid_config_schema)
[ 90s] File "/usr/lib/python2.7/site-packages/jsonschema/validators.py", line 895, in validate
[ 90s] cls.check_schema(schema)
[ 90s] File "/usr/lib/python2.7/site-packages/jsonschema/validators.py", line 289, in check_schema
[ 90s] raise exceptions.SchemaError.create_from(error)
[ 90s] jsonschema.exceptions.SchemaError: {u'additionalProperties': False, u'required': [u'raid_level', u'size_gb'], u'type': u'object', u'prope
rties': {u'size_gb': {u'anyOf': [{u'exclusiveMinimum': True, u'minimum': 0, u'type': u'integer'}, {u'enum': [u'MAX'], u'type': u'string'}], u'desc
ription': u"Size in GiB (Integer) for the logical disk. Use 'MAX' as size_gb if this logical disk is supposed to use the rest of the space availab
le. Required."}, u'physical_disks': {u'items': {u'type': u'string'}, u'type': u'array', u'description': u'The physical disks to use for this logic
al disk. Optional'}, u'interface_type': {u'enum': [u'sata', u'scsi', u'sas'], u'type': u'string', u'description': u"Specifies the interface type o
f disk. Valid values are 'sata', 'scsi' and 'sas'. Optional."}, u'number_of_physical_disks': {u'exclusiveMinimum': True, u'minimum': 0, u'type': u'integer', u'description': u'Number of physical disks to use for this logical disk. Optional.'}, u'raid_level': {u'enum': [u'0', u'1', u'5', u'6', u'10', u'50', u'60', u'1+0', u'5+0', u'6+0'], u'type': u'string', u'description': u'RAID level for the logical disk. Required.'}, u'is_root_volume': {u'type': u'boolean', u'description': u'Specifies whether this disk is a root volume. Optional.'}, u'share_physical_disks': {u'type': u'boolean', u'description': u'Specifies whether other logical disks can share physical disks with this logical disk. Optional.'}, u'controller': {u'type': u'string', u'description': u'Controller to use for this logical disk. Optional.'}, u'volume_name': {u'type': u'string', u'description': u'Name of the volume to be created. Optional.'}, u'disk_type': {u'enum': [u'hdd', u'ssd'], u'type': u'string', u'description': u"Specifies the type of disk preferred. Valid values are 'hdd' and 'ssd'. Optional."}}} is not valid under any of the given schemas
[ 90s]
[ 90s] Failed validating u'anyOf' in metaschema[u'properties'][u'properties'][u'additionalProperties'][u'properties'][u'items']:
[ 90s] {u'anyOf': [{u'$ref': u'#'}, {u'$ref': u'#/definitions/schemaArray'}],
[ 90s] u'default': True}
[ 90s]
[ 90s] On schema[u'properties'][u'logical_disks'][u'items']:
[ 90s] {u'additionalProperties': False,
[ 90s] u'properties': {u'controller': {u'description': u'Controller to use for this logical disk. Optional.',
[ 90s] u'type': u'string'},
[ 90s] u'disk_type': {u'description': u"Specifies the type of disk preferred. Valid values are 'hdd' and 'ssd'. Optional.",
[ 90s] u'enum': [u'hdd', u'ssd'],
[ 90s] u'type': u'string'},
[ 90s] u'interface_type': {u'description': u"Specifies the interface type of disk. Valid values are 'sata', 'scsi' and 'sas
'. Optional.",
[ 90s] u'enum': [u'sata',
[ 90s] u'scsi',
[ 90s] u'sas'],
[ 90s] u'type': u'string'},
[ 90s] u'is_root_volume': {u'description': u'Specifies whether this disk is a root volume. Optional.',
[ 90s] u'type': u'boolean'},
[ 90s] u'number_of_physical_disks': {u'description': u'Number of physical disks to use for this logical disk. Optional.',
[ 90s] u'exclusiveMinimum': True,
[ 90s] u'minimum': 0,
[ 90s] u'type': u'integer'},
[ 90s] u'physical_disks': {u'description': u'The physical disks to use for this logical disk. Optional',
[ 90s] u'items': {u'type': u'string'},
[ 90s] u'type': u'array'},
[ 90s] u'raid_level': {u'description': u'RAID level for the logical disk. Required.',
[ 90s] u'enum': [u'0',
[ 90s] u'1',
[ 90s] u'5',
[ 90s] u'6',
[ 90s] u'10',
[ 90s] u'50',
[ 90s] u'60',
[ 90s] u'1+0',
[ 90s] u'5+0',
[ 90s] u'6+0'],
[ 90s] u'type': u'string'},
[ 90s] u'share_physical_disks': {u'description': u'Specifies whether other logical disks can share physical disks with this
 logical disk. Optional.',
[ 90s] u'type': u'boolean'},
[ 90s] u'size_gb': {u'anyOf': [{u'exclusiveMinimum': True,
[ 90s] u'minimum': 0,
[ 90s] u'type': u'integer'},
[ 90s] {u'enum': [u'MAX'],
[ 90s] u'type': u'string'}],
[ 90s] u'description': u"Size in GiB (Integer) for the logical disk. Use 'MAX' as size_gb if this logical disk
 is supposed to use the rest of the space available. Required."},
[ 90s] u'volume_name': {u'description': u'Name of the volume to be created. Optional.',
[ 90s] u'type': u'string'}},
[ 90s] u'required': [u'raid_level', u'size_gb'],
[ 90s] u'type': u'object'}

Revision history for this message
Shivanand Tendulker (stendulker) wrote : Re: [Bug 1824084] [NEW] testsuite incompatible with jsonschema 3.0.1
Download full text (17.7 KiB)

Thank you Dirk for reaching out. Will triage this defect.

Regards
Shiv

On Wed, Apr 10, 2019 at 1:05 PM Dirk Mueller <email address hidden>
wrote:

> Public bug reported:
>
> when running tests against jsonschema 3.0.1, you get various failures,
> like e.g.
>
> [ 90s] FAIL:
> proliantutils.tests.hpssa.test_manager.ManagerTestCases.test_create_configuration_invalid_logical_disks
> [ 90s] tags: worker-4
> [ 90s]
> ----------------------------------------------------------------------
> [ 90s] Traceback (most recent call last):
> [ 90s] File "/usr/lib/python2.7/site-packages/mock/mock.py", line
> 1305, in patched
> [ 90s] return func(*args, **keywargs)
> [ 90s] File "proliantutils/tests/hpssa/test_manager.py", line 113, in
> test_create_configuration_invalid_logical_disks
> [ 90s] raid_info)
> [ 90s] File "/usr/lib/python2.7/site-packages/testtools/testcase.py",
> line 485, in assertRaises
> [ 90s] self.assertThat(our_callable, matcher)
> [ 90s] File "/usr/lib/python2.7/site-packages/testtools/testcase.py",
> line 496, in assertThat
> [ 90s] mismatch_error = self._matchHelper(matchee, matcher, message,
> verbose)
> [ 90s] File "/usr/lib/python2.7/site-packages/testtools/testcase.py",
> line 547, in _matchHelper
> [ 90s] mismatch = matcher.match(matchee)
> [ 90s] File
> "/usr/lib/python2.7/site-packages/testtools/matchers/_exception.py", line
> 108, in match
> [ 90s] mismatch = self.exception_matcher.match(exc_info)
> [ 90s] File
> "/usr/lib/python2.7/site-packages/testtools/matchers/_higherorder.py", line
> 62, in match
> [ 90s] mismatch = matcher.match(matchee)
> [ 90s] File "/usr/lib/python2.7/site-packages/testtools/testcase.py",
> line 475, in match
> [ 90s] reraise(*matchee)
> [ 90s] File
> "/usr/lib/python2.7/site-packages/testtools/matchers/_exception.py", line
> 101, in match
> [ 90s] result = matchee()
> [ 90s] File "/usr/lib/python2.7/site-packages/testtools/testcase.py",
> line 1049, in __call__
> [ 90s] return self._callable_object(*self._args, **self._kwargs)
> [ 90s] File "proliantutils/hpssa/manager.py", line 130, in
> create_configuration
> [ 90s] validate(raid_config)
> [ 90s] File "proliantutils/hpssa/manager.py", line 52, in validate
> [ 90s] jsonschema.validate(raid_config, raid_config_schema)
> [ 90s] File
> "/usr/lib/python2.7/site-packages/jsonschema/validators.py", line 895, in
> validate
> [ 90s] cls.check_schema(schema)
> [ 90s] File
> "/usr/lib/python2.7/site-packages/jsonschema/validators.py", line 289, in
> check_schema
> [ 90s] raise exceptions.SchemaError.create_from(error)
> [ 90s] jsonschema.exceptions.SchemaError: {u'additionalProperties':
> False, u'required': [u'raid_level', u'size_gb'], u'type': u'object', u'prope
> rties': {u'size_gb': {u'anyOf': [{u'exclusiveMinimum': True, u'minimum':
> 0, u'type': u'integer'}, {u'enum': [u'MAX'], u'type': u'string'}], u'desc
> ription': u"Size in GiB (Integer) for the logical disk. Use 'MAX' as
> size_gb if this logical disk is supposed to use the rest of the space
> availab
> le. Required."}, u'physical_disks': {u'it...

Revision history for this message
Nisha Agarwal (agarwalnisha1980) wrote :

Hello Dirk,

The issue is there because the syntax for some fields between json schema draft-04 and draft-06/07 has changed. The same issue exists in ironic as well when they switch to jsonschema 3.0.1. The bug and fix have been raised in ironic as well for that.
Ref: https://storyboard.openstack.org/#!/story/2005464
patch: https://review.openstack.org/#/c/653060/

The community has decided to use draft-04 for now instead of draft-07 of jsonschema. Since draft-04 is supported for both jsonschema 2.6 and jsonschema 3.0.1, the fix works with that. We plan to fix proliantutils also in the same way as of now.

Regards
Nisha

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

Reviewed: https://review.opendev.org/653413
Committed: https://git.openstack.org/cgit/x/proliantutils/commit/?id=bdc3ddf7f3ebdfdb2dbbbeb0b9c0c9b545af44c9
Submitter: Zuul
Branch: master

commit bdc3ddf7f3ebdfdb2dbbbeb0b9c0c9b545af44c9
Author: Nisha Agarwal <email address hidden>
Date: Wed Apr 17 06:20:08 2019 -0700

    Jsonschema 3.0.1: Binds the raid schema to draft-04

    This fix binds the raid schema to draft-04 of the
    json schema. The draft-04 is supported on both
    jsonschema 2.6 and jsonschema 3.0.1.
    Draft-06 and draft-07 require the schema change
    which is incompatible with draft-04.

    Closes-bug: 1824084
    Change-Id: I7452cf55df8643b52d2782359966fc042b2b9dfe

Changed in proliantutils:
status: New → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.opendev.org/655852
Committed: https://git.openstack.org/cgit/x/proliantutils/commit/?id=1afcadf7c1088e83575a9122f9ed259e81d8561e
Submitter: Zuul
Branch: master

commit 1afcadf7c1088e83575a9122f9ed259e81d8561e
Author: Nisha Agarwal <email address hidden>
Date: Fri Apr 26 03:52:45 2019 -0700

    jsonschema3.0.1: Uncap jsonschema

    This patch uncaps the jsonschema version.

    Closes-bug: 1824084

    Change-Id: I0f4c0346f6acf934abda4e1bda4064f88eeecfae

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.