diff --git a/TESTING.rst b/TESTING.rst index 6714cc9f12..b375148049 100644 --- a/TESTING.rst +++ b/TESTING.rst @@ -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 -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: .. code-block:: bash - $ tox -e py37,pep8 + $ tox -e py38,pep8 See ``tox -l`` for the full list of available test environments. diff --git a/octavia/cmd/prometheus_proxy.py b/octavia/cmd/prometheus_proxy.py index 1737915f0e..954cd9dd97 100644 --- a/octavia/cmd/prometheus_proxy.py +++ b/octavia/cmd/prometheus_proxy.py @@ -19,11 +19,10 @@ # of metrics. It also aligns the terms to be consistent with Octavia # terminology. -from http.server import HTTPServer from http.server import SimpleHTTPRequestHandler +from http.server import ThreadingHTTPServer import os import signal -import socketserver import sys import threading import time @@ -785,12 +784,6 @@ def shutdown_thread(http): 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(): global PRINT_REJECTED try: @@ -806,15 +799,13 @@ def main(): # it gracefully. try: with network_namespace.NetworkNamespace(consts.AMPHORA_NAMESPACE): - httpd = ThreadedHTTPServer(('127.0.0.1', 9102), - PrometheusProxy) + httpd = ThreadingHTTPServer(('127.0.0.1', 9102), + PrometheusProxy) shutdownthread = threading.Thread(target=shutdown_thread, args=(httpd,)) shutdownthread.start() - # TODO(johnsom) Uncomment this when we move to - # ThreadingHTTPServer - # httpd.daemon_threads = True + httpd.daemon_threads = True print("Now serving on port 9102") httpd.serve_forever() except Exception: diff --git a/octavia/tests/unit/cmd/test_prometheus_proxy.py b/octavia/tests/unit/cmd/test_prometheus_proxy.py index 2e4a9acb97..d9e18fbed7 100644 --- a/octavia/tests/unit/cmd/test_prometheus_proxy.py +++ b/octavia/tests/unit/cmd/test_prometheus_proxy.py @@ -147,10 +147,7 @@ class TestPrometheusProxyCMD(base.TestCase): mock_http.shutdown.assert_called_once() @mock.patch('threading.Thread') - # TODO(johnsom) Switch this when we move to ThreadingHTTPServer - # @mock.patch('http.server.ThreadingHTTPServer.serve_forever') - @mock.patch('octavia.cmd.prometheus_proxy.ThreadedHTTPServer.' - 'serve_forever') + @mock.patch('http.server.ThreadingHTTPServer.serve_forever') @mock.patch('octavia.amphorae.backends.utils.network_namespace.' 'NetworkNamespace.__exit__') @mock.patch('octavia.amphorae.backends.utils.network_namespace.' diff --git a/releasenotes/notes/move-to-python-3.8-203249392fd1f1aa.yaml b/releasenotes/notes/move-to-python-3.8-203249392fd1f1aa.yaml new file mode 100644 index 0000000000..045b5242a3 --- /dev/null +++ b/releasenotes/notes/move-to-python-3.8-203249392fd1f1aa.yaml @@ -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. diff --git a/setup.cfg b/setup.cfg index 086056225c..0ff93ea04b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ description_file = author = OpenStack author_email = openstack-discuss@lists.openstack.org home_page = https://docs.openstack.org/octavia/latest/ -python_requires = >=3.6 +python_requires = >=3.8 classifier = Development Status :: 5 - Production/Stable Environment :: OpenStack @@ -17,10 +17,9 @@ classifier = Operating System :: POSIX :: Linux Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 [files] packages = diff --git a/tox.ini b/tox.ini index a7e5afc10a..87e6fd364a 100644 --- a/tox.ini +++ b/tox.ini @@ -55,18 +55,18 @@ setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional basepython = python3 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] basepython = python3.8 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] commands = oslo_debug_helper {posargs} diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 3d253dae43..3911319b43 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -113,14 +113,14 @@ name: octavia-tox-tips check: jobs: - - octavia-tox-py37-tips - - octavia-tox-functional-py37-tips + - octavia-tox-py39-tips + - octavia-tox-functional-py39-tips - job: - name: octavia-tox-py37-tips - parent: openstack-tox-py37 + name: octavia-tox-py39-tips + parent: openstack-tox-py39 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: tox_install_siblings: true zuul_work_dir: src/opendev.org/openstack/octavia @@ -129,10 +129,10 @@ - openstack/octavia - job: - name: octavia-tox-functional-py37-tips - parent: openstack-tox-functional-py37 + name: octavia-tox-functional-py39-tips + parent: openstack-tox-functional-py39 description: | - Run tox python 3.7 functional against master of related libraries. + Run tox python 3.9 functional against master of related libraries. vars: tox_install_siblings: true zuul_work_dir: src/opendev.org/openstack/octavia diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index c666eec49d..519748c6d5 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -20,7 +20,7 @@ - ^etc/.*$ - ^octavia/tests/.*$ - ^releasenotes/.*$ - - openstack-tox-functional-py36: + - openstack-tox-functional-py38: irrelevant-files: - ^.*\.rst$ - ^api-ref/.*$ @@ -28,6 +28,23 @@ - ^etc/.*$ - ^octavia/tests/unit/.*$ - ^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: irrelevant-files: &irrelevant-files - ^.*\.rst$ @@ -86,7 +103,7 @@ - ^etc/.*$ - ^octavia/tests/.*$ - ^releasenotes/.*$ - - openstack-tox-functional-py36: + - openstack-tox-functional-py38: irrelevant-files: - ^.*\.rst$ - ^api-ref/.*$