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: ...@@ -17,7 +17,7 @@ php_fpm_www_pool_config:
pm.start_servers: 2 pm.start_servers: 2
pm.min_spare_servers: 1 pm.min_spare_servers: 1
pm.max_spare_servers: 3 pm.max_spare_servers: 3
pm.status_path: /status pm.status_path: /status.php
ping.path: /ping ping.path: /ping.php
chdir: / chdir: /
chroot: '{{ php_fpm_chroot[ansible_os_family]|default(None) }}' chroot: '{{ php_fpm_chroot[ansible_os_family]|default(None) }}'
from testinfra.utils.ansible_runner import AnsibleRunner from testinfra.utils.ansible_runner import AnsibleRunner
import json
testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') 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': if SystemInfo.type == 'openbsd':
service = Service('php56_fpm') service = Service('php56_fpm')
socket = File('/var/www/run/php-fpm.sock') socket = File('/var/www/run/php-fpm.sock')
user = 'www' user = 'www'
elif SystemInfo.type == 'linux' and SystemInfo.distribution in ['debian', elif SystemInfo.type == 'linux' and SystemInfo.distribution in [
'ubuntu']: 'debian', 'ubuntu'
]:
service = Service('php5-fpm') service = Service('php5-fpm')
socket = File('/var/run/php5-fpm.sock') socket = File('/var/run/php5-fpm.sock')
user = 'www-data' user = 'www-data'
with Sudo():
assert socket.is_socket assert socket.is_socket
assert socket.mode == 0o0660 assert socket.mode == 0o0660
assert socket.user == user assert socket.user == user
...@@ -40,8 +43,10 @@ def test_php_fpm_config(Command, Sudo, SystemInfo): ...@@ -40,8 +43,10 @@ def test_php_fpm_config(Command, Sudo, SystemInfo):
def test_php_fpm_status(Command): def test_php_fpm_status(Command):
assert 'PHP version 5' in Command( status = json.loads(
'curl http://localhost/status.php').stdout Command('curl http://localhost/status.php?json').stdout)
assert status['pool'] == 'www'
assert status['process manager'] == 'dynamic'
def test_php_fpm_ping(Command): 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