|
@@ -3,6 +3,7 @@ import os
|
|
|
import testinfra.utils.ansible_runner
|
|
|
|
|
|
|
|
|
import pytest
|
|
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-*')
|
|
|
|
|
@@ -163,37 +164,30 @@ def test_sockets(host):
|
|
|
assert host.socket("tcp://443").is_listening
|
|
|
|
|
|
|
|
|
def test_socket_directories(host, php_info):
|
|
|
@pytest.mark.parametrize("application_type, tmpfiles_d_path",
|
|
|
[("wsgi", "/etc/tmpfiles.d/wsgi.conf"),
|
|
|
("php", "/etc/tmpfiles.d/php7.0-fpm.conf")])
|
|
|
def test_socket_directories(host, application_type, tmpfiles_d_path):
|
|
|
"""
|
|
|
Tests if directories containing sockets for WSGI and PHP apps are created
|
|
|
correctly.
|
|
|
"""
|
|
|
|
|
|
directory = host.file('/run/wsgi')
|
|
|
assert directory.is_directory
|
|
|
assert directory.user == 'root'
|
|
|
assert directory.group == 'www-data'
|
|
|
assert directory.mode == 0o750
|
|
|
socket_directory = "/run/%s" % application_type
|
|
|
tmpfiles_d_content = "d /run/%s/ 0750 root www-data - -" % application_type
|
|
|
|
|
|
directory = host.file('/run/%s' % php_info.fpm_service)
|
|
|
directory = host.file(socket_directory)
|
|
|
assert directory.is_directory
|
|
|
assert directory.user == 'root'
|
|
|
assert directory.group == 'www-data'
|
|
|
assert directory.mode == 0o750
|
|
|
|
|
|
config = host.file('/etc/tmpfiles.d/wsgi.conf')
|
|
|
assert config.is_file
|
|
|
assert config.user == 'root'
|
|
|
assert config.group == 'root'
|
|
|
assert config.mode == 0o644
|
|
|
assert 'd /run/wsgi/ 0750 root www-data - -' in config.content
|
|
|
|
|
|
config = host.file('/etc/tmpfiles.d/%s.conf' % php_info.fpm_service)
|
|
|
config = host.file(tmpfiles_d_path)
|
|
|
assert config.is_file
|
|
|
assert config.user == 'root'
|
|
|
assert config.group == 'root'
|
|
|
assert config.mode == 0o644
|
|
|
assert 'd /run/%s/ 0750 root www-data - -' % php_info.fpm_service in config.content
|
|
|
assert config.content == tmpfiles_d_content
|
|
|
|
|
|
|
|
|
def test_php_fpm_service_overrides(host, php_info):
|