Skip to content

Commit

Permalink
fix(freebsd): add openssl pkg and update all default tests
Browse files Browse the repository at this point in the history
  • Loading branch information
myii committed Apr 3, 2021
1 parent 1e5cd11 commit 4cd351a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
1 change: 1 addition & 0 deletions nginx/map.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
'server_enabled': '/usr/local/etc/nginx/sites-enabled',
'snippets_dir': '/usr/local/etc/nginx/snippets',
'server_use_symlink': True,
'openssl_package': 'openssl',
'pid_file': '/var/run/nginx.pid',
},
}, default='Debian' ),
Expand Down
47 changes: 28 additions & 19 deletions test/integration/default/controls/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,36 @@

# Set defaults, use debian as base

server_available = '/etc/nginx/sites-available'
server_enabled = '/etc/nginx/sites-enabled'

# Override by platform family
case platform[:family]
when 'redhat', 'fedora'
server_available = '/etc/nginx/conf.d'
server_enabled = '/etc/nginx/conf.d'
when 'suse'
server_available = '/etc/nginx/vhosts.d'
server_enabled = '/etc/nginx/vhosts.d'
end
server_available, server_enabled =
case platform[:family]
when 'redhat', 'fedora'
%w[/etc/nginx/conf.d /etc/nginx/conf.d]
when 'suse'
%w[/etc/nginx/vhosts.d /etc/nginx/vhosts.d]
when 'bsd'
%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
title 'should match desired lines'

# main configuration
describe file('/etc/nginx/nginx.conf') do
describe file(nginx_conf) do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_owned_by file_owner }
it { should be_grouped_into file_group }
its('mode') { should cmp '0644' }
its('content') do
# rubocop:disable Metrics/LineLength
Expand All @@ -34,10 +43,10 @@
end

# snippets configuration
describe file('/etc/nginx/snippets/letsencrypt.conf') do
describe file(snippets_letsencrypt_conf) do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_owned_by file_owner }
it { should be_grouped_into file_group }
its('mode') { should cmp '0644' }
its('content') { should include 'location ^~ /.well-known/acme-challenge/ {' }
its('content') { should include 'proxy_pass http://localhost:9999;' }
Expand All @@ -52,8 +61,8 @@

describe file "#{dir}/mysite" do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_owned_by file_owner }
it { should be_grouped_into file_group }
its('mode') { should cmp '0644' }
its('content') { should include 'server_name localhost;' }
its('content') { should include 'listen 80 default_server;' }
Expand Down

0 comments on commit 4cd351a

Please sign in to comment.