diff --git a/docs/rolereference.rst b/docs/rolereference.rst index 1f8bcf1167de4710a14945545ff895b30b2deb71..b18d5c1b08b70a73ae512c2b18358b2b22c0d4c6 100644 --- a/docs/rolereference.rst +++ b/docs/rolereference.rst @@ -1686,7 +1686,6 @@ Distribution compatibility Role is compatible with the following distributions: -- Debian 10 (Buster) - Debian 11 (Bullseye) diff --git a/roles/php_website/defaults/main.yml b/roles/php_website/defaults/main.yml index 1d46b492eddfa2bc2372a5270acf3e1354104d42..3b9d577646ace35738efbcf7e92d813d2959e3d9 100644 --- a/roles/php_website/defaults/main.yml +++ b/roles/php_website/defaults/main.yml @@ -13,15 +13,12 @@ environment_indicator: null # Internal parameters. php_fpm_service_name_per_release: - buster: "php7.3-fpm" bullseye: "php7.4-fpm" php_fpm_binary_per_release: - buster: "php-fpm7.3" bullseye: "php-fpm7.4" php_fpm_pool_directory_per_release: - buster: "/etc/php/7.3/fpm/pool.d" bullseye: "/etc/php/7.4/fpm/pool.d" admin: "admin-{{ fqdn | replace('.', '_') }}" diff --git a/roles/php_website/meta/main.yml b/roles/php_website/meta/main.yml index 8c67541fc41f3ec799da1f38e5e6fbd07c63b65d..743dbcd0a59b463cb6d44921b05dd762e431b3e9 100644 --- a/roles/php_website/meta/main.yml +++ b/roles/php_website/meta/main.yml @@ -14,5 +14,4 @@ galaxy_info: platforms: - name: Debian versions: - - 10 - 11 diff --git a/roles/php_website/molecule/default/molecule.yml b/roles/php_website/molecule/default/molecule.yml index b54a9b2a536943f2355965c6880fb6af4172e0bd..711dd9cff71dba34b65cddf34b8b3659d033875b 100644 --- a/roles/php_website/molecule/default/molecule.yml +++ b/roles/php_website/molecule/default/molecule.yml @@ -14,16 +14,6 @@ lint: platforms: - - name: php-website-buster - groups: - - parameters-mandatory - - parameters-optional - box: debian/contrib-buster64 - memory: 512 - cpus: 1 - provider_raw_config_args: - - "customize ['modifyvm', :id, '--paravirtprovider', 'minimal']" - - name: php-website-bullseye groups: - parameters-mandatory diff --git a/roles/php_website/molecule/default/tests/conftest.py b/roles/php_website/molecule/default/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..f4ef497f2b8953bd333b725ce698b3ab695f9354 --- /dev/null +++ b/roles/php_website/molecule/default/tests/conftest.py @@ -0,0 +1,35 @@ +from collections import namedtuple + +import pytest + + +@pytest.fixture +def php_info(host): + """ + Helper fixture used to define what the expected PHP-FPM details + are (paths, package names etc) based on Debian release. + + Currently supports: + + - Debian 11 (Bullseye) + + Resulting information can be accessed through returned named tuple + with the following properties: + + - fpm_package (name of the PHP-FPM package) + - fpm_service (name of the PHP-FPM system service) + - fpm_pool_dir (pato to directory with PHP-FPM pool definitions) + - base_config_dir (base configuration directory for PHP) + """ + + PHPInfo = namedtuple('PHPInfo', 'fpm_package fpm_service fpm_pool_dir base_config_dir') + + ansible_facts = host.ansible("setup")["ansible_facts"] + ansible_distribution_release = ansible_facts['ansible_distribution_release'] + + if ansible_distribution_release == 'bullseye': + info = PHPInfo(fpm_package='php-fpm', fpm_service='php7.4-fpm', fpm_pool_dir='/etc/php/7.4/fpm/pool.d', base_config_dir='/etc/php/7.4') + else: + raise Exception('The php_info pytest fixture does not support Debian release: %s' % ansible_distribution_release) + + return info diff --git a/roles/php_website/molecule/default/tests/test_parameters_mandatory.py b/roles/php_website/molecule/default/tests/test_parameters_mandatory.py index 70f69db08e28c2687be25e70cd0d34f342c81bcc..a5860a32a5a28b3cbe0c369be2a715f77fbcfe61 100644 --- a/roles/php_website/molecule/default/tests/test_parameters_mandatory.py +++ b/roles/php_website/molecule/default/tests/test_parameters_mandatory.py @@ -132,19 +132,12 @@ def test_mail_forwarding(host): assert re.search(pattern, mail_log.content_string) is not None -def test_php_fpm_configuration_file(host): +def test_php_fpm_configuration_file(host, php_info): """ Tests if PHP FPM configuration file has been correctly deployed. """ - distribution_release = host.ansible("setup")["ansible_facts"]["ansible_distribution_release"] - - if distribution_release == "buster": - config_file_path = '/etc/php/7.3/fpm/pool.d/parameters-mandatory.conf' - elif distribution_release == "bullseye": - config_file_path = '/etc/php/7.4/fpm/pool.d/parameters-mandatory.conf' - else: - raise Exception("Tried running test on unsupported distribution: %s" % distribution_release) + config_file_path = os.path.join(php_info.fpm_pool_dir, 'parameters-mandatory.conf') with host.sudo():