forked from saltstack-formulas/php-formula
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request saltstack-formulas#197 from n-rodriguez/wip/tests
Add tests
- Loading branch information
Showing
14 changed files
with
346 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,38 @@ | ||
# Manages the php-fpm pools config files | ||
{% from "php/map.jinja" import php with context %} | ||
{% from "php/macro.jinja" import sls_block %} | ||
{% from "php/macro.jinja" import file_requisites %} | ||
{% from "php/fpm/pools_config.sls" import pool_states with context %} | ||
{% macro file_requisites(states) %} | ||
{%- for state in states %} | ||
- file: {{ state }} | ||
{%- endfor -%} | ||
{% endmacro %} | ||
include: | ||
- php.fpm.service | ||
- php.fpm.pools_config | ||
{% set pillar_php_version = salt['pillar.get']('php:version', '7.0') %} | ||
{% if pool_states %} | ||
extend: | ||
{% if pillar_php_version is iterable and pillar_php_version is not string %} | ||
{% for version in pillar_php_version %} | ||
php_fpm_service_{{ version }}: | ||
service: | ||
- watch: | ||
{{ file_requisites(pool_states) }} | ||
- require: | ||
{{ file_requisites(pool_states) }} | ||
{% endfor %} | ||
{% else %} | ||
php_fpm_service: | ||
service: | ||
- watch: | ||
{{ file_requisites(pool_states) }} | ||
- require: | ||
{{ file_requisites(pool_states) }} | ||
{% endif %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
include: | ||
- .install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import php with context %} | ||
{%- from tplroot ~ "/macro.jinja" import format_kwargs with context %} | ||
php/repo/install: | ||
pkgrepo.managed: | ||
{{- format_kwargs(php.repo) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
control 'Php configuration' do | ||
title 'should match desired lines' | ||
|
||
def test_debian | ||
describe file('/etc/php/5.6/fpm/pool.d/radius-admin.conf') do | ||
its('content') { should include '[radius-admin]' } | ||
its('content') { should include 'php_admin_value[date.timezone] = Europe/Paris' } | ||
end | ||
|
||
describe file('/etc/php/7.3/fpm/pool.d/ldap-admin.conf') do | ||
its('content') { should include '[ldap-admin]' } | ||
its('content') { should include 'php_admin_value[date.timezone] = Europe/Paris' } | ||
end | ||
|
||
describe file('/etc/php/5.6/fpm/php.ini') do | ||
its('content') { should include 'date.timezone = Europe/Paris' } | ||
end | ||
|
||
describe file('/etc/php/7.3/fpm/php.ini') do | ||
its('content') { should include 'date.timezone = Europe/Paris' } | ||
end | ||
end | ||
|
||
def test_redhat | ||
end | ||
|
||
def test_suse | ||
end | ||
|
||
case os[:family] | ||
when 'debian' | ||
test_debian | ||
when 'redhat', 'fedora' | ||
test_redhat | ||
when 'suse' | ||
test_suse | ||
end | ||
end |
Oops, something went wrong.