Skip to content
Snippets Groups Projects
Commit ce52cbb6 authored by nimrod's avatar nimrod
Browse files

- Correct URLs to PHP-FPM status and ping pages, updated tests

accordingly.
- Correct service test to use sudo.
- Modify the status test to parse the json output.
parent 0d353d6e
No related branches found
No related tags found
No related merge requests found
......@@ -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) }}'
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'
with Sudo():
assert socket.is_socket
assert socket.mode == 0o0660
assert socket.user == user
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment