From 1af2c91e41b147f95082b68e3ec9df95ab458fb2 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Tue, 28 May 2019 09:30:09 -0500 Subject: [PATCH] Unblock gate failures There are a few issues causing all gate runs to fail that are addressed in this patch. Update constraints to match global requirements: There are a few local requirements that conflict with what is now in upstream global-requirements. This updates sphinx to match the constrained versions due to incompatibility with py2 and uncaps jsonschema. Update handling for falcon 2.0.0 behavior changes: The 2.0.0 release of falcon changed the default values for two request query parsing options that would cause failures due to unexpected results. This sets those options to their previous defaults to maintain compatibility across 2.0.0 and pre-2.0.0 versions of the package. Lower constraint version raised to 1.1.0 where the options were introduced. There are additional integration test failures with Falcon 2.0.0 that were due to changes in the subscription URL path. Closes-bug: #1830903 Requirements and upper constraints not enforced in some tox targets: The docs and api-ref tox targets were not setting the right dependencies or the upper constraints to use for pip installs. Also updates the constraints to the newer preferred static redirect URL maintained by the release team. Co-authored-by: wanghao Change-Id: I19c5363878c629a04e1be902c865ee7cea92dcd9 Signed-off-by: Sean McGinnis --- .gitignore | 1 + doc/requirements.txt | 3 ++- lower-constraints.txt | 2 +- requirements.txt | 4 ++-- tox.ini | 21 ++++++++++++------- .../functional/wsgi/v2/test_subscriptions.py | 8 +++---- zaqar/transport/wsgi/driver.py | 4 ++++ 7 files changed, 28 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index e5015e7ed..e610a7dd3 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ var/* ChangeLog AUTHORS etc/zaqar.conf.sample +doc/source/_static/zaqar.conf.sample .idea # Files created by releasenotes build releasenotes/build diff --git a/doc/requirements.txt b/doc/requirements.txt index 90fcbd877..a80482018 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -2,7 +2,8 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. openstackdocstheme>=1.18.1 # Apache-2.0 -sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD +sphinx!=1.6.6,!=1.6.7,>=1.6.3,<2.0.0;python_version=='2.7' # BSD +sphinx!=1.6.6,!=1.6.7,>=1.6.3;python_version>='3.4' # BSD sphinxcontrib-apidoc>=0.2.0 # BSD reno>=2.5.0 # Apache-2.0 os-api-ref>=1.4.0 # Apache-2.0 diff --git a/lower-constraints.txt b/lower-constraints.txt index b9f29a013..ae2f2394a 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -6,7 +6,7 @@ ddt==1.0.1 doc8==0.6.0 dogpile.cache==0.6.2 enum34==1.0.4;python_version=='2.7' -falcon==1.0.0 +falcon==1.1.0 fixtures==3.0.0 flake8==2.5.5 future==0.16.0 diff --git a/requirements.txt b/requirements.txt index 98e0f8430..10db9483e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,8 +5,8 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0 alembic>=0.8.10 # MIT Babel!=2.4.0,>=2.3.4 # BSD -falcon>=1.0.0 # Apache-2.0 -jsonschema<3.0.0,>=2.6.0 # MIT +falcon>=1.1.0 # Apache-2.0 +jsonschema>=2.6.0 # MIT iso8601>=0.1.11 # MIT keystonemiddleware>=4.17.0 # Apache-2.0 msgpack>=0.5.1 # Apache-2.0 diff --git a/tox.ini b/tox.ini index f788747b1..fde561fd3 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ setenv = VIRTUAL_ENV={envdir} OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 OS_TEST_PATH=./zaqar/tests/unit -deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} +deps = -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = @@ -63,9 +63,10 @@ commands = {posargs} [testenv:docs] basepython = python3 deps = - -r{toxinidir}/doc/requirements.txt + -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/doc/requirements.txt commands = - sphinx-build -W -b html doc/source doc/build/html + sphinx-build -W -b html doc/source doc/build/html [testenv:api-ref] basepython = python3 @@ -74,9 +75,12 @@ basepython = python3 # whitelist_externals = bash rm +deps = + -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/doc/requirements.txt commands = - rm -rf api-ref/build - sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html + rm -rf api-ref/build + sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html [testenv:debug] basepython = python3 @@ -84,9 +88,12 @@ commands = oslo_debug_helper {posargs} [testenv:releasenotes] basepython = python3 +deps = + -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/doc/requirements.txt commands = - doc8 releasenotes/source releasenotes/notes - sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html + doc8 releasenotes/source releasenotes/notes + sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [flake8] exclude = .venv*,.git,.tox,dist,doc,*lib/python*,*.egg,.update-venv diff --git a/zaqar/tests/functional/wsgi/v2/test_subscriptions.py b/zaqar/tests/functional/wsgi/v2/test_subscriptions.py index 067da8d02..185d0df02 100644 --- a/zaqar/tests/functional/wsgi/v2/test_subscriptions.py +++ b/zaqar/tests/functional/wsgi/v2/test_subscriptions.py @@ -43,7 +43,7 @@ class TestSubscriptions(base.V2FunctionalTestBase): self.client.put(self.queue_url) - self.subscriptions_url = self.queue_url + '/subscriptions/' + self.subscriptions_url = self.queue_url + '/subscriptions' self.client.set_base_url(self.subscriptions_url) def tearDown(self): @@ -51,7 +51,7 @@ class TestSubscriptions(base.V2FunctionalTestBase): result = self.client.get(self.subscriptions_url) subscriptions = result.json()['subscriptions'] for sub in subscriptions: - sub_url = self.subscriptions_url + sub['id'] + sub_url = self.subscriptions_url + '/' + sub['id'] self.client.delete(sub_url) # Delete test queue. self.client.delete(self.queue_url) @@ -72,7 +72,7 @@ class TestSubscriptions(base.V2FunctionalTestBase): result = self.client.post(data=doc) self.assertEqual(201, result.status_code) shortlive_id = result.json()['subscription_id'] - shortlive_url = self.subscriptions_url + shortlive_id + shortlive_url = self.subscriptions_url + '/' + shortlive_id # Let's wait for subscription to expire. for i in range(self.class_ttl_gc_interval + ttl_for_shortlive): @@ -97,7 +97,7 @@ class TestSubscriptions(base.V2FunctionalTestBase): result = self.client.post(data=doc) self.assertEqual(201, result.status_code) subscription_id = result.json()['subscription_id'] - subscription_url = self.subscriptions_url + subscription_id + subscription_url = self.subscriptions_url + '/' + subscription_id # This is a minimum TTL allowed by server. updated_ttl = 60 diff --git a/zaqar/transport/wsgi/driver.py b/zaqar/transport/wsgi/driver.py index 81516262b..a95f30b2d 100644 --- a/zaqar/transport/wsgi/driver.py +++ b/zaqar/transport/wsgi/driver.py @@ -129,6 +129,10 @@ class Driver(transport.DriverBase): else: self.app = falcon.API(before=self.before_hooks) + # Set options to keep behavior compatible to pre-2.0.0 falcon + self.app.req_options.auto_parse_qs_csv = True + self.app.req_options.keep_blank_qs_values = False + self.app.add_error_handler(Exception, self._error_handler) for version_path, endpoints in catalog: