From 0a1d21ff478e35ff4f0fa6f1f3bc0f9a7e4f389c Mon Sep 17 00:00:00 2001 From: Ghanshyam Mann Date: Sat, 1 Aug 2020 19:39:52 -0500 Subject: [PATCH] [goal] Migrate testing to ubuntu focal As per victoria cycle testing runtime and community goal[1] we need to migrate upstream CI/CD to Ubuntu Focal(20.04). Fixing: - bug#1885825 Fix user creation with GRANT in MySQL 8.0(Ubuntu Focal) Ubuntu Focal (20.04) has mysql 8.0 and with mysql 8.0 there is no implicit user creation with GRANT. We need to create the user first before using GRANT command. - bug#1886298 Bump the lower constraints for required deps which added python3.8 support in their later version. - bug#1886296 pyflake issue and some pep8 fixes. Story: #2007865 Task: #40209 Related-Bug: #1885825 Related-Bug: #1886298 [1] https://governance.openstack.org/tc/goals/selected/victoria/migrate-ci-cd-jobs-to-ubuntu-focal Change-Id: Iac9652b0d36ef208075da506957cc87f22912c45 --- lower-constraints.txt | 10 +++++----- placement/handler.py | 2 +- placement/handlers/allocation.py | 8 ++++---- placement/handlers/resource_class.py | 2 +- test-requirements.txt | 9 +++++++-- tools/test-setup.sh | 4 ++-- 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 5dec0100d..6a4a4154d 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -25,7 +25,7 @@ keystoneauth1==3.9.0 keystonemiddleware==4.18.0 linecache2==1.0.0 Mako==1.0.7 -MarkupSafe==1.0 +MarkupSafe==1.1.1 mccabe==0.2.1 microversion-parse==0.2.1 mock==2.0.0 @@ -56,11 +56,11 @@ pep8==1.5.7 pluggy==0.6.0 ply==3.11 prettytable==0.7.1 -psycopg2==2.7 +psycopg2==2.8 py==1.5.2 pycadf==2.7.0 -pyflakes==0.8.1 -PyMySQL==0.7.6 +pyflakes==2.1.1 +PyMySQL==0.8.0 pyparsing==2.2.0 pytest==3.4.2 python-dateutil==2.5.3 @@ -69,7 +69,7 @@ python-keystoneclient==3.15.0 python-mimeparse==1.6.0 python-subunit==1.2.0 pytz==2018.3 -PyYAML==3.12 +PyYAML==3.13 repoze.lru==0.7 requests==2.14.2 requestsexceptions==1.4.0 diff --git a/placement/handler.py b/placement/handler.py index ef280558c..7a7ebbe6a 100644 --- a/placement/handler.py +++ b/placement/handler.py @@ -207,7 +207,7 @@ class PlacementHandler(object): raise webob.exc.HTTPBadRequest( 'content-type header required when content-length > 0', json_formatter=util.json_error_formatter) - except ValueError as exc: + except ValueError: raise webob.exc.HTTPBadRequest( 'content-length header must be an integer', json_formatter=util.json_error_formatter) diff --git a/placement/handlers/allocation.py b/placement/handlers/allocation.py index 9be824044..bf29eafee 100644 --- a/placement/handlers/allocation.py +++ b/placement/handlers/allocation.py @@ -471,28 +471,28 @@ def set_allocations_for_consumer(req): @wsgi_wrapper.PlacementWsgify # noqa @microversion.version_handler('1.8', '1.11') @util.require_content('application/json') -def set_allocations_for_consumer(req): +def set_allocations_for_consumer(req): # noqa return _set_allocations_for_consumer(req, schema.ALLOCATION_SCHEMA_V1_8) @wsgi_wrapper.PlacementWsgify # noqa @microversion.version_handler('1.12', '1.27') @util.require_content('application/json') -def set_allocations_for_consumer(req): +def set_allocations_for_consumer(req): # noqa return _set_allocations_for_consumer(req, schema.ALLOCATION_SCHEMA_V1_12) @wsgi_wrapper.PlacementWsgify # noqa @microversion.version_handler('1.28', '1.33') @util.require_content('application/json') -def set_allocations_for_consumer(req): +def set_allocations_for_consumer(req): # noqa return _set_allocations_for_consumer(req, schema.ALLOCATION_SCHEMA_V1_28) @wsgi_wrapper.PlacementWsgify # noqa @microversion.version_handler('1.34') @util.require_content('application/json') -def set_allocations_for_consumer(req): +def set_allocations_for_consumer(req): # noqa return _set_allocations_for_consumer(req, schema.ALLOCATION_SCHEMA_V1_34) diff --git a/placement/handlers/resource_class.py b/placement/handlers/resource_class.py index b0504799a..156393c60 100644 --- a/placement/handlers/resource_class.py +++ b/placement/handlers/resource_class.py @@ -206,7 +206,7 @@ def update_resource_class(req): @wsgi_wrapper.PlacementWsgify # noqa @microversion.version_handler('1.7') -def update_resource_class(req): +def update_resource_class(req): # noqa """PUT to create or validate the existence of single resource class. On a successful create return 201. Return 204 if the class already diff --git a/test-requirements.txt b/test-requirements.txt index 9babfe64e..890d52e85 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,14 +3,19 @@ # process, which may cause wedges in the gate later. hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 +# remove this pyflakes from here once you bump the +# hacking to 3.2.0 or above. hacking 3.2.0 takes +# care of pyflakes version compatibilty. +pyflakes>=2.1.1 + coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD # NOTE(tetsuro): Local testing on osx may have problems to install packages, # psycopg2 and PYMySQL. You can workaround them using sys_platform qualifier. # See the https://review.opendev.org/#/c/671249/ for details. However, we # don't use it here to keep the consistency with global requirements. -psycopg2>=2.7 # LGPL/ZPL -PyMySQL>=0.7.6 # MIT License +psycopg2>=2.8 # LGPL/ZPL +PyMySQL>=0.8.0 # MIT License oslotest>=3.4.0 # Apache-2.0 stestr>=1.0.0 # Apache-2.0 testtools>=2.2.0 # MIT diff --git a/tools/test-setup.sh b/tools/test-setup.sh index 00c765e73..5b986ced3 100755 --- a/tools/test-setup.sh +++ b/tools/test-setup.sh @@ -23,8 +23,8 @@ sudo -H mysqladmin -u root password $DB_ROOT_PW sudo -H mysql -u root -p$DB_ROOT_PW -h localhost -e " DELETE FROM mysql.user WHERE User=''; FLUSH PRIVILEGES; - GRANT ALL PRIVILEGES ON *.* - TO '$DB_USER'@'%' identified by '$DB_PW' WITH GRANT OPTION;" + CREATE USER '$DB_USER'@'%' IDENTIFIED BY '$DB_PW'; + GRANT ALL PRIVILEGES ON *.* TO '$DB_USER'@'%' WITH GRANT OPTION;" # Now create our database. mysql -u $DB_USER -p$DB_PW -h 127.0.0.1 -e "