fix(freebsd): add openssl pkg and update all default tests

This commit is contained in:
Imran Iqbal 2021-04-03 09:41:50 +01:00
parent 1e5cd1108e
commit 4cd351adbc
No known key found for this signature in database
GPG Key ID: 6D8629439D2B7819
2 changed files with 29 additions and 19 deletions

View File

@ -105,6 +105,7 @@
'server_enabled': '/usr/local/etc/nginx/sites-enabled', 'server_enabled': '/usr/local/etc/nginx/sites-enabled',
'snippets_dir': '/usr/local/etc/nginx/snippets', 'snippets_dir': '/usr/local/etc/nginx/snippets',
'server_use_symlink': True, 'server_use_symlink': True,
'openssl_package': 'openssl',
'pid_file': '/var/run/nginx.pid', 'pid_file': '/var/run/nginx.pid',
}, },
}, default='Debian' ), }, default='Debian' ),

View File

@ -2,27 +2,36 @@
# Set defaults, use debian as base # Set defaults, use debian as base
server_available = '/etc/nginx/sites-available'
server_enabled = '/etc/nginx/sites-enabled'
# Override by platform family # Override by platform family
case platform[:family] server_available, server_enabled =
when 'redhat', 'fedora' case platform[:family]
server_available = '/etc/nginx/conf.d' when 'redhat', 'fedora'
server_enabled = '/etc/nginx/conf.d' %w[/etc/nginx/conf.d /etc/nginx/conf.d]
when 'suse' when 'suse'
server_available = '/etc/nginx/vhosts.d' %w[/etc/nginx/vhosts.d /etc/nginx/vhosts.d]
server_enabled = '/etc/nginx/vhosts.d' when 'bsd'
end %w[/usr/local/etc/nginx/sites-available /usr/local/etc/nginx/sites-enabled]
else
%w[/etc/nginx/sites-available /etc/nginx/sites-enabled]
end
nginx_conf, snippets_letsencrypt_conf, file_owner, file_group =
case platform[:family]
when 'bsd'
%w[/usr/local/etc/nginx/nginx.conf /usr/local/etc/nginx/snippets/letsencrypt.conf
root wheel]
else
%w[/etc/nginx/nginx.conf /etc/nginx/snippets/letsencrypt.conf root root]
end
control 'Nginx configuration' do control 'Nginx configuration' do
title 'should match desired lines' title 'should match desired lines'
# main configuration # main configuration
describe file('/etc/nginx/nginx.conf') do describe file(nginx_conf) do
it { should be_file } it { should be_file }
it { should be_owned_by 'root' } it { should be_owned_by file_owner }
it { should be_grouped_into 'root' } it { should be_grouped_into file_group }
its('mode') { should cmp '0644' } its('mode') { should cmp '0644' }
its('content') do its('content') do
# rubocop:disable Metrics/LineLength # rubocop:disable Metrics/LineLength
@ -34,10 +43,10 @@ control 'Nginx configuration' do
end end
# snippets configuration # snippets configuration
describe file('/etc/nginx/snippets/letsencrypt.conf') do describe file(snippets_letsencrypt_conf) do
it { should be_file } it { should be_file }
it { should be_owned_by 'root' } it { should be_owned_by file_owner }
it { should be_grouped_into 'root' } it { should be_grouped_into file_group }
its('mode') { should cmp '0644' } its('mode') { should cmp '0644' }
its('content') { should include 'location ^~ /.well-known/acme-challenge/ {' } its('content') { should include 'location ^~ /.well-known/acme-challenge/ {' }
its('content') { should include 'proxy_pass http://localhost:9999;' } its('content') { should include 'proxy_pass http://localhost:9999;' }
@ -52,8 +61,8 @@ control 'Nginx configuration' do
describe file "#{dir}/mysite" do describe file "#{dir}/mysite" do
it { should be_file } it { should be_file }
it { should be_owned_by 'root' } it { should be_owned_by file_owner }
it { should be_grouped_into 'root' } it { should be_grouped_into file_group }
its('mode') { should cmp '0644' } its('mode') { should cmp '0644' }
its('content') { should include 'server_name localhost;' } its('content') { should include 'server_name localhost;' }
its('content') { should include 'listen 80 default_server;' } its('content') { should include 'listen 80 default_server;' }