Selaa lähdekoodia

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

tags/v2.6.3
Imran Iqbal 3 vuotta sitten
vanhempi
commit
4cd351adbc
No account linked to committer's email address
2 muutettua tiedostoa jossa 29 lisäystä ja 19 poistoa
  1. +1
    -0
      nginx/map.jinja
  2. +28
    -19
      test/integration/default/controls/config.rb

+ 1
- 0
nginx/map.jinja Näytä tiedosto

@@ -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' ),

+ 28
- 19
test/integration/default/controls/config.rb Näytä tiedosto

@@ -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
@@ -34,10 +43,10 @@ control 'Nginx configuration' do
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;' }
@@ -52,8 +61,8 @@ control 'Nginx configuration' do

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;' }

Loading…
Peruuta
Tallenna