From: Davanum Srinivas Date: Wed, 7 Oct 2015 01:45:12 +0000 (-0700) Subject: Squashed commit of WebOb 1.5 and oslo.db fixes X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=61026d4e4f2a58dd84ffb2e4e40ab99860b9316a;p=openstack-build%2Fcinder-build.git Squashed commit of WebOb 1.5 and oslo.db fixes Add testresources and testscenarios used by oslo.db fixture If we use oslo.db fixtures, we'll need these 2 packages or the next version of oslo.db release will break us. Closes-Bug: #1503501 Change-Id: I8facdaf69c79b1b1ae4f9f64e9856e12f14440ed (cherry picked from commit ec40c3b6ddbfa4912ca6e612558efaef6043f3ae) Fix test_misc for WebOb 1.5 WebOb 1.5 was released at 2015-10-11. With this new version, webob.exc.WSGIHTTPException() constructor now fails with a KeyError when the HTTP status code is 0. test_exceptions_raise() of test_misc tries to instanciate all exceptions of cinder.exception. The problem is that ConvertedException uses a default HTTP status code of 0. Modify the default HTTP status code of ConvertedException to 400 to fix the unit test. The bug is only in the test, cinder/api/openstack/wsgi.py copies an existing HTTP code: Fault(exception.ConvertedException(code=ex_value.code, ...) Closes-Bug: #1505153 Change-Id: I1aec8038774828d48da4b0e831b390e33243809a (cherry picked from commit 867fccf833ffc597aa986cb6ff1b3b5c1101b9ba) Change default Exception code to 500 As a part of the fix for LP#1505153, the invalid response of 0 was changed to 400 to fix a running issue with the new version of WebOb. It was pointed out after the fact however that a 500 might be more appropriate here. Additionally, other projects have implemented a 500 as the default so for the sake of consistency we should consider doing the same. This patch just changes the 400 to a 500 as the default code. Conflicts: cinder/tests/unit/test_exception.py NOTE(mriedem): The conflict is due to 17802086f not being in stable/liberty. Change-Id: Ie486dc49c927f9b50f07c1fc562e89c090924a40 Closes-Bug: #1505488 (cherry picked from commit 9a7cbe540c94d54194194f4747a52b8211f6372e) --- diff --git a/cinder/exception.py b/cinder/exception.py index 5e0715e0e..de2e3b55f 100644 --- a/cinder/exception.py +++ b/cinder/exception.py @@ -46,7 +46,7 @@ CONF.register_opts(exc_log_opts) class ConvertedException(webob.exc.WSGIHTTPException): - def __init__(self, code=0, title="", explanation=""): + def __init__(self, code=500, title="", explanation=""): self.code = code self.title = title self.explanation = explanation diff --git a/test-requirements.txt b/test-requirements.txt index 04d0086bb..8982c803b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -17,6 +17,8 @@ sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 python-subunit>=0.0.18 testtools>=1.4.0 testrepository>=0.0.18 +testresources>=0.2.4 +testscenarios>=0.4 oslosphinx>=2.5.0 # Apache-2.0 os-testr>=0.1.0 tempest-lib>=0.8.0