Merge "Move to Python 3.8"

This commit is contained in:
Zuul
2022-05-07 10:41:16 +00:00
committed by Gerrit Code Review
8 changed files with 50 additions and 40 deletions

View File

@@ -28,12 +28,12 @@ To run the full suite of tests maintained within Octavia.
To run tests for one or more specific test environments(for example, the most To run tests for one or more specific test environments(for example, the most
common configuration of Python 3.7 and PEP-8), list the environments with the common configuration of Python 3.8 and PEP-8), list the environments with the
``-e`` option, separated by spaces: ``-e`` option, separated by spaces:
.. code-block:: bash .. code-block:: bash
$ tox -e py37,pep8 $ tox -e py38,pep8
See ``tox -l`` for the full list of available test environments. See ``tox -l`` for the full list of available test environments.

View File

@@ -19,11 +19,10 @@
# of metrics. It also aligns the terms to be consistent with Octavia # of metrics. It also aligns the terms to be consistent with Octavia
# terminology. # terminology.
from http.server import HTTPServer
from http.server import SimpleHTTPRequestHandler from http.server import SimpleHTTPRequestHandler
from http.server import ThreadingHTTPServer
import os import os
import signal import signal
import socketserver
import sys import sys
import threading import threading
import time import time
@@ -785,12 +784,6 @@ def shutdown_thread(http):
http.shutdown() http.shutdown()
# TODO(johnsom) Remove and switch to ThreadingHTTPServer once python3.7 is
# the minimum version supported.
class ThreadedHTTPServer(socketserver.ThreadingMixIn, HTTPServer):
daemon_threads = True
def main(): def main():
global PRINT_REJECTED global PRINT_REJECTED
try: try:
@@ -806,15 +799,13 @@ def main():
# it gracefully. # it gracefully.
try: try:
with network_namespace.NetworkNamespace(consts.AMPHORA_NAMESPACE): with network_namespace.NetworkNamespace(consts.AMPHORA_NAMESPACE):
httpd = ThreadedHTTPServer(('127.0.0.1', 9102), httpd = ThreadingHTTPServer(('127.0.0.1', 9102),
PrometheusProxy) PrometheusProxy)
shutdownthread = threading.Thread(target=shutdown_thread, shutdownthread = threading.Thread(target=shutdown_thread,
args=(httpd,)) args=(httpd,))
shutdownthread.start() shutdownthread.start()
# TODO(johnsom) Uncomment this when we move to httpd.daemon_threads = True
# ThreadingHTTPServer
# httpd.daemon_threads = True
print("Now serving on port 9102") print("Now serving on port 9102")
httpd.serve_forever() httpd.serve_forever()
except Exception: except Exception:

View File

@@ -147,10 +147,7 @@ class TestPrometheusProxyCMD(base.TestCase):
mock_http.shutdown.assert_called_once() mock_http.shutdown.assert_called_once()
@mock.patch('threading.Thread') @mock.patch('threading.Thread')
# TODO(johnsom) Switch this when we move to ThreadingHTTPServer @mock.patch('http.server.ThreadingHTTPServer.serve_forever')
# @mock.patch('http.server.ThreadingHTTPServer.serve_forever')
@mock.patch('octavia.cmd.prometheus_proxy.ThreadedHTTPServer.'
'serve_forever')
@mock.patch('octavia.amphorae.backends.utils.network_namespace.' @mock.patch('octavia.amphorae.backends.utils.network_namespace.'
'NetworkNamespace.__exit__') 'NetworkNamespace.__exit__')
@mock.patch('octavia.amphorae.backends.utils.network_namespace.' @mock.patch('octavia.amphorae.backends.utils.network_namespace.'

View File

@@ -0,0 +1,6 @@
---
upgrade:
- |
Update Python base version from 3.6 to 3.8. As per Openstack Python
runtime versions policy Python 3.8 will be the the minimum Python version
in the Zed release cycle.

View File

@@ -6,7 +6,7 @@ description_file =
author = OpenStack author = OpenStack
author_email = openstack-discuss@lists.openstack.org author_email = openstack-discuss@lists.openstack.org
home_page = https://docs.openstack.org/octavia/latest/ home_page = https://docs.openstack.org/octavia/latest/
python_requires = >=3.6 python_requires = >=3.8
classifier = classifier =
Development Status :: 5 - Production/Stable Development Status :: 5 - Production/Stable
Environment :: OpenStack Environment :: OpenStack
@@ -17,10 +17,9 @@ classifier =
Operating System :: POSIX :: Linux Operating System :: POSIX :: Linux
Programming Language :: Python Programming Language :: Python
Programming Language :: Python :: 3 Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
[files] [files]
packages = packages =

16
tox.ini
View File

@@ -55,18 +55,18 @@ setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
basepython = python3 basepython = python3
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:functional-py36]
basepython = python3.6
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:functional-py37]
basepython = python3.7
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:functional-py38] [testenv:functional-py38]
basepython = python3.8 basepython = python3.8
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:functional-py39]
basepython = python3.9
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:functional-py310]
basepython = python3.10
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:debug] [testenv:debug]
commands = oslo_debug_helper {posargs} commands = oslo_debug_helper {posargs}

View File

@@ -113,14 +113,14 @@
name: octavia-tox-tips name: octavia-tox-tips
check: check:
jobs: jobs:
- octavia-tox-py37-tips - octavia-tox-py39-tips
- octavia-tox-functional-py37-tips - octavia-tox-functional-py39-tips
- job: - job:
name: octavia-tox-py37-tips name: octavia-tox-py39-tips
parent: openstack-tox-py37 parent: openstack-tox-py39
description: | description: |
Run tox python 3.7 unit tests against master of related libraries. Run tox python 3.9 unit tests against master of related libraries.
vars: vars:
tox_install_siblings: true tox_install_siblings: true
zuul_work_dir: src/opendev.org/openstack/octavia zuul_work_dir: src/opendev.org/openstack/octavia
@@ -129,10 +129,10 @@
- openstack/octavia - openstack/octavia
- job: - job:
name: octavia-tox-functional-py37-tips name: octavia-tox-functional-py39-tips
parent: openstack-tox-functional-py37 parent: openstack-tox-functional-py39
description: | description: |
Run tox python 3.7 functional against master of related libraries. Run tox python 3.9 functional against master of related libraries.
vars: vars:
tox_install_siblings: true tox_install_siblings: true
zuul_work_dir: src/opendev.org/openstack/octavia zuul_work_dir: src/opendev.org/openstack/octavia

View File

@@ -20,7 +20,7 @@
- ^etc/.*$ - ^etc/.*$
- ^octavia/tests/.*$ - ^octavia/tests/.*$
- ^releasenotes/.*$ - ^releasenotes/.*$
- openstack-tox-functional-py36: - openstack-tox-functional-py38:
irrelevant-files: irrelevant-files:
- ^.*\.rst$ - ^.*\.rst$
- ^api-ref/.*$ - ^api-ref/.*$
@@ -28,6 +28,23 @@
- ^etc/.*$ - ^etc/.*$
- ^octavia/tests/unit/.*$ - ^octavia/tests/unit/.*$
- ^releasenotes/.*$ - ^releasenotes/.*$
- openstack-tox-functional-py39:
irrelevant-files:
- ^.*\.rst$
- ^api-ref/.*$
- ^doc/.*$
- ^etc/.*$
- ^octavia/tests/unit/.*$
- ^releasenotes/.*$
- openstack-tox-functional-py310:
irrelevant-files:
- ^.*\.rst$
- ^api-ref/.*$
- ^doc/.*$
- ^etc/.*$
- ^octavia/tests/unit/.*$
- ^releasenotes/.*$
voting: false
- octavia-v2-dsvm-noop-api: - octavia-v2-dsvm-noop-api:
irrelevant-files: &irrelevant-files irrelevant-files: &irrelevant-files
- ^.*\.rst$ - ^.*\.rst$
@@ -86,7 +103,7 @@
- ^etc/.*$ - ^etc/.*$
- ^octavia/tests/.*$ - ^octavia/tests/.*$
- ^releasenotes/.*$ - ^releasenotes/.*$
- openstack-tox-functional-py36: - openstack-tox-functional-py38:
irrelevant-files: irrelevant-files:
- ^.*\.rst$ - ^.*\.rst$
- ^api-ref/.*$ - ^api-ref/.*$