diff --git a/defaults/main.yml b/defaults/main.yml index b978e748750b7ee578e704da07592120f1c5b75d..48c28d5f52d3a73c217a2b26f55939e365032f1f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -17,7 +17,7 @@ php_fpm_www_pool_config: pm.start_servers: 2 pm.min_spare_servers: 1 pm.max_spare_servers: 3 - pm.status_path: /status - ping.path: /ping + pm.status_path: /status.php + ping.path: /ping.php chdir: / chroot: '{{ php_fpm_chroot[ansible_os_family]|default(None) }}' diff --git a/tests/test_php-fpm.py b/tests/test_php-fpm.py index 1df008bf5f5e9be12ef1256240db86ab81fe9462..284261bb1e5421552556d4e26ce5ca92ea6c0f02 100644 --- a/tests/test_php-fpm.py +++ b/tests/test_php-fpm.py @@ -1,27 +1,30 @@ from testinfra.utils.ansible_runner import AnsibleRunner +import json testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') -def test_php_fpm_service(Service, SystemInfo, File): +def test_php_fpm_service(Service, SystemInfo, File, Sudo): if SystemInfo.type == 'openbsd': service = Service('php56_fpm') socket = File('/var/www/run/php-fpm.sock') user = 'www' - elif SystemInfo.type == 'linux' and SystemInfo.distribution in ['debian', - 'ubuntu']: + elif SystemInfo.type == 'linux' and SystemInfo.distribution in [ + 'debian', 'ubuntu' + ]: service = Service('php5-fpm') socket = File('/var/run/php5-fpm.sock') user = 'www-data' - assert socket.is_socket - assert socket.mode == 0o0660 - assert socket.user == user - assert socket.group == user - assert service.is_running - try: - assert service.is_enabled - except NotImplementedError: - pass + with Sudo(): + assert socket.is_socket + assert socket.mode == 0o0660 + assert socket.user == user + assert socket.group == user + assert service.is_running + try: + assert service.is_enabled + except NotImplementedError: + pass def test_phpinfo(Command): @@ -40,8 +43,10 @@ def test_php_fpm_config(Command, Sudo, SystemInfo): def test_php_fpm_status(Command): - assert 'PHP version 5' in Command( - 'curl http://localhost/status.php').stdout + status = json.loads( + Command('curl http://localhost/status.php?json').stdout) + assert status['pool'] == 'www' + assert status['process manager'] == 'dynamic' def test_php_fpm_ping(Command):