Change in vdsm[master]: bridge: data verification

nsoffer at redhat.com nsoffer at redhat.com
Wed Mar 23 01:03:49 UTC 2016


Nir Soffer has posted comments on this change.

Change subject: bridge: data verification
......................................................................


Patch Set 13:

(5 comments)

https://gerrit.ovirt.org/#/c/53919/13/tests/schemaapi_test.py
File tests/schemaapi_test.py:

Line 66:         params = {"addr": "rack05-pdu01-lab4.tlv.redhat.com", "port": 54321,
Line 67:                   "agent": "apc_snmp", "username": "emesika",
Line 68:                   "password": "pass", "action": "off", "options": "port=15"}
Line 69: 
Line 70:         _schema.schema().verify_params('Host', 'fenceNode', params)
What do you test here? I don't see any assert
Line 71: 
Line 72:     @MonkeyPatch(schemaapi, 'config',
Line 73:                  make_config([('devel', 'api_strict_mode', 'true')]))
Line 74:     def test_ok_response(self):


Line 73:                  make_config([('devel', 'api_strict_mode', 'true')]))
Line 74:     def test_ok_response(self):
Line 75:         ret = {'power': 'on'}
Line 76: 
Line 77:         _schema.schema().verify_retval('Host', 'fenceNode', ret)
Same
Line 78: 
Line 79:     @MonkeyPatch(schemaapi, 'config',
Line 80:                  make_config([('devel', 'api_strict_mode', 'true')]))
Line 81:     def test_unknown_response_type(self):


Line 78: 
Line 79:     @MonkeyPatch(schemaapi, 'config',
Line 80:                  make_config([('devel', 'api_strict_mode', 'true')]))
Line 81:     def test_unknown_response_type(self):
Line 82:         with self.assertRaises(JsonRpcError) as e:
Why does it raise JsonRpcError? what public error is returned to the client?

I would expect that this will raise something like UnknownKey or some other SchemaVerificationError that explain the issue.
Line 83:             ret = {'My caps': 'My capabilites'}
Line 84: 
Line 85:             _schema.schema().verify_retval('Host', 'getCapabilities', ret)
Line 86: 


Line 83:             ret = {'My caps': 'My capabilites'}
Line 84: 
Line 85:             _schema.schema().verify_retval('Host', 'getCapabilities', ret)
Line 86: 
Line 87:         self.assertIn('My caps', e.exception.message)
What does does it mean that we have this text in the message?
Line 88: 
Line 89:     @MonkeyPatch(schemaapi, 'config',
Line 90:                  make_config([('devel', 'api_strict_mode', 'true')]))
Line 91:     def test_unknown_param(self):


Line 86: 
Line 87:         self.assertIn('My caps', e.exception.message)
Line 88: 
Line 89:     @MonkeyPatch(schemaapi, 'config',
Line 90:                  make_config([('devel', 'api_strict_mode', 'true')]))
This monkey patching is repeating too much, maybe move to to a helper function:

    def api_strict_mode():
        return MonkeyPatch(schemaapi, 'config', make_config([('devel', 'api_strict_mode', 'true')]))

Then use it like this:

    @api_strict_mode()
Line 91:     def test_unknown_param(self):
Line 92:         params = {"storagepoolID": "00000002-0002-0002-0002-0000000000f6",
Line 93:                   "onlyForce": True,
Line 94:                   "storagedomainID": "773adfc7-10d4-4e60-b700-3272ee1871f9"}


-- 
To view, visit https://gerrit.ovirt.org/53919
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id24a5e078fa92e4129d37a47593c7a167e78712e
Gerrit-PatchSet: 13
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list