Browse Source

[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
changes/57/744357/8
Ghanshyam Mann 2 years ago
parent
commit
0a1d21ff47
  1. 10
      lower-constraints.txt
  2. 2
      placement/handler.py
  3. 8
      placement/handlers/allocation.py
  4. 2
      placement/handlers/resource_class.py
  5. 9
      test-requirements.txt
  6. 4
      tools/test-setup.sh

10
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

2
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)

8
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)

2
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

9
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

4
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 "

Loading…
Cancel
Save