diff --git a/docs/rolereference.rst b/docs/rolereference.rst index 4018bc22e6a53fcc9c9895b7b49e603d47b10ffa..0c18b5a5ae40e765d4596c471b0a521a91032ff9 100644 --- a/docs/rolereference.rst +++ b/docs/rolereference.rst @@ -1991,6 +1991,7 @@ Distribution compatibility Role is compatible with the following distributions: - Debian 11 (Bullseye) +- Debian 12 (Bookworm) Examples diff --git a/roles/wsgi_website/meta/main.yml b/roles/wsgi_website/meta/main.yml index 06bd0794f7ba40445e79306a5db9cfd3a5ba91ef..43903efa2b25890b92a3d8793de4700371125cd2 100644 --- a/roles/wsgi_website/meta/main.yml +++ b/roles/wsgi_website/meta/main.yml @@ -15,3 +15,4 @@ galaxy_info: - name: Debian versions: - 11 + - 12 diff --git a/roles/wsgi_website/molecule/default/molecule.yml b/roles/wsgi_website/molecule/default/molecule.yml index cc0a275082d528fa0c3ce9b3d3da22fc366a1f35..b3d7e93d618c9f64c05271731289423b353e52cb 100644 --- a/roles/wsgi_website/molecule/default/molecule.yml +++ b/roles/wsgi_website/molecule/default/molecule.yml @@ -25,6 +25,17 @@ platforms: provider_raw_config_args: - "customize ['modifyvm', :id, '--paravirtprovider', 'minimal']" + - name: wsgi-website-bookworm + groups: + - wsgi-website + - parameters-mandatory + - parameters-optional + box: debian/bookworm64 + memory: 512 + cpus: 1 + provider_raw_config_args: + - "customize ['modifyvm', :id, '--paravirtprovider', 'minimal']" + provisioner: name: ansible playbooks: diff --git a/roles/wsgi_website/molecule/default/playbook.yml b/roles/wsgi_website/molecule/default/playbook.yml index 6d88a71b30e2a450be7e3b122d3c01da60f5e377..f5ee1ab714e4acdb70dd9093678a0ee5a254a436 100644 --- a/roles/wsgi_website/molecule/default/playbook.yml +++ b/roles/wsgi_website/molecule/default/playbook.yml @@ -12,6 +12,7 @@ default_https_tls_key: "{{ lookup('file', 'tests/data/x509/server/wsgi-website_https.key.pem') }}" roles: + - role: wsgi_website fqdn: parameters-mandatory https_tls_certificate: "{{ lookup('file', 'tests/data/x509/server/parameters-mandatory_https.cert.pem') }}" @@ -47,16 +48,15 @@ use_paste: false virtualenv_packages: # Main packages. - - dnspython==1.15.0 - - ptpython==0.41 - - prompt-toolkit==1.0.15 + - dnspython==2.6.1 + - prompt-toolkit==3.0.43 + - ptpython==3.0.26 # Dependencies. - - docopt==0.6.2 - - jedi==0.13.1 - - parso==0.3.1 - - Pygments==2.2.0 - - six==1.11.0 - - wcwidth==0.1.7 + - appdirs==1.4.4 + - jedi==0.19.1 + - parso==0.8.3 + - pygments==2.17.2 + - wcwidth==0.2.13 website_mail_recipients: user wsgi_application: testapp:application wsgi_requirements: @@ -69,16 +69,20 @@ fqdn: parameters-paste-req use_paste: true virtualenv_packages: - - click==6.7 - - Flask==0.12.2 - - itsdangerous==0.24 - - Jinja2==2.9.6 - - MarkupSafe==1.0 - - Paste==2.0.3 - - PasteDeploy==1.5.2 - - PasteScript==2.0.2 - - six==1.10.0 - - Werkzeug==0.12.2 + # Main packages. + - Flask==3.0.2 + - Paste==3.7.1 + - PasteDeploy==3.1.0 + # Dependencies. + - Jinja2==3.1.3 + - MarkupSafe==2.1.5 + - Werkzeug==3.0.1 + - blinker==1.7.0 + - click==8.1.7 + - importlib-metadata==7.0.1 + - itsdangerous==2.1.2 + - six==1.16.0 + - zipp==3.17.0 wsgi_application: config.ini wsgi_requirements: - gunicorn==21.1.0 diff --git a/roles/wsgi_website/molecule/default/tests/conftest.py b/roles/wsgi_website/molecule/default/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..ac2560bbec6fb3fc772eed682502d36f500cc589 --- /dev/null +++ b/roles/wsgi_website/molecule/default/tests/conftest.py @@ -0,0 +1,35 @@ +from collections import namedtuple + +import pytest + + +@pytest.fixture +def python_info(host): + """ + Helper fixture used to define what the expected Python details + are (paths, package names etc) based on Debian release. + + Currently supports: + + - Debian 11 (Bullseye) + - Debian 12 (Bookworm) + + Resulting information can be accessed through returned named tuple + with the following properties: + + - python_version (version of installed Python interpreter) + """ + + PythonInfo = namedtuple('PythonInfo', 'python_version') + + ansible_facts = host.ansible("setup")["ansible_facts"] + ansible_distribution_release = ansible_facts['ansible_distribution_release'] + + if ansible_distribution_release == 'bullseye': + info = PythonInfo(python_version="3.9.2") + elif ansible_distribution_release == 'bookworm': + info = PythonInfo(python_version="3.11.2") + else: + raise Exception('The php_info pytest fixture does not support Debian release: %s' % ansible_distribution_release) + + return info diff --git a/roles/wsgi_website/molecule/default/tests/test_default.py b/roles/wsgi_website/molecule/default/tests/test_default.py index e9fab47eadd19eb4246683b63dae979739fb2d24..c0cd5271ee47c50d7ca03ccf3fea8b39f4d7ee80 100644 --- a/roles/wsgi_website/molecule/default/tests/test_default.py +++ b/roles/wsgi_website/molecule/default/tests/test_default.py @@ -277,31 +277,32 @@ def test_python_virtualenv_wrapper_script(host, wrapper_script, expected_owner, "packaging==23.2", ]), ('admin-parameters-optional_local', '/var/www/parameters-optional.local/virtualenv/bin/pip', [ - "Pygments==2.2.0", - "dnspython==1.15.0", - "docopt==0.6.2", + "appdirs==1.4.4", + "dnspython==2.6.1", "gunicorn==21.1.0", - "jedi==0.13.1", + "jedi==0.19.1", "packaging==23.2", - "parso==0.3.1", - "prompt-toolkit==1.0.15", - "ptpython==0.41", - "six==1.11.0", - "wcwidth==0.1.7", + "parso==0.8.3", + "prompt-toolkit==3.0.43", + "ptpython==3.0.26", + "pygments==2.17.2", + "wcwidth==0.2.13", ]), ('admin-parameters-paste-req', '/var/www/parameters-paste-req/virtualenv/bin/pip', [ - "Flask==0.12.2", - "Jinja2==2.9.6", - "MarkupSafe==1.0", - "Paste==2.0.3", - "PasteDeploy==1.5.2", - "PasteScript==2.0.2", - "Werkzeug==0.12.2", - "click==6.7", + "Flask==3.0.2", + "Jinja2==3.1.3", + "MarkupSafe==2.1.5", + "Paste==3.7.1", + "PasteDeploy==3.1.0", + "Werkzeug==3.0.1", + "blinker==1.7.0", + "click==8.1.7", "gunicorn==21.1.0", - "itsdangerous==0.24", + "importlib-metadata==7.0.1", + "itsdangerous==2.1.2", "packaging==23.2", - "six==1.10.0", + "six==1.16.0", + "zipp==3.17.0", ]), ]) def test_virtualenv_packages(host, admin_user, pip_path, expected_packages): @@ -495,17 +496,19 @@ def test_website_enabled(host, config_file, expected_content): assert config.linked_to == expected_content -@pytest.mark.parametrize("python_path, expected_version", [ - ("/var/www/parameters-mandatory/virtualenv/bin/python", "Python 3.9.2"), - ("/var/www/parameters-optional.local/virtualenv/bin/python", "Python 3.9.2"), - ("/var/www/parameters-paste-req/virtualenv/bin/python", "Python 3.9.2"), +@pytest.mark.parametrize("python_path", [ + ("/var/www/parameters-mandatory/virtualenv/bin/python"), + ("/var/www/parameters-optional.local/virtualenv/bin/python"), + ("/var/www/parameters-paste-req/virtualenv/bin/python"), ]) -def test_python_version_in_virtualenv(host, python_path, expected_version): +def test_python_version_in_virtualenv(host, python_info, python_path,): """ Tests if correct Python version is used inside of virtual environment. """ + expected_version = "Python %s" % python_info.python_version + with host.sudo(): python_version = host.run(python_path + " --version")