forked from voxpupuli/puppet-nginx
-
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.
By changing the data type, you can now specify multiple servers for a location. Fixes voxpupuliGH-1187
- Loading branch information
1 parent
36d7f37
commit 455291e
Showing
3 changed files
with
128 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'nginx::resource::location define:' do | ||
it 'runs successfully' do | ||
pp = " | ||
class { 'nginx': } | ||
nginx::resource::server { 'www.puppetlabs.com': | ||
ensure => present, | ||
www_root => '/var/www/www.puppetlabs.com', | ||
} | ||
nginx::resource::server { 'stage.puppetlabs.com': | ||
ensure => present, | ||
www_root => '/var/www/stage.puppetlabs.com', | ||
} | ||
nginx::resource::location { 'static-production': | ||
ensure => present, | ||
server => 'www.puppetlabs.com', | ||
location => '/media', | ||
www_root => '/var/www/staticfiles/production', | ||
} | ||
nginx::resource::location { 'static-stage': | ||
ensure => present, | ||
server => 'stage.puppetlabs.com', | ||
location => '/media', | ||
www_root => '/var/www/staticfiles/stage', | ||
} | ||
nginx::resource::location { 'letsencrypt': | ||
ensure => present, | ||
server => ['www.puppetlabs.com', 'stage.puppetlabs.com'], | ||
location => '/.well-known/acme-challenge/', | ||
www_root => '/var/www/letsencrypt', | ||
} | ||
" | ||
apply_manifest(pp, catch_failures: true) | ||
end | ||
|
||
describe file('/etc/nginx/sites-available/www.puppetlabs.com.conf') do | ||
it { is_expected.to be_file } | ||
it { is_expected.to contain '# MANAGED BY PUPPET' } | ||
it { is_expected.to contain ' root /var/www/www.puppetlabs.com;' } | ||
it { is_expected.to contain ' location /media {' } | ||
it { is_expected.to contain ' root /var/www/staticfiles/production;' } | ||
it { is_expected.not_to contain ' root /var/www/staticfiles/stage;' } | ||
it { is_expected.to contain ' location /.well-known/acme-challenge/ {' } | ||
it { is_expected.to contain ' root /var/www/letsencrypt;' } | ||
end | ||
describe file('/etc/nginx/sites-available/stage.puppetlabs.com.conf') do | ||
it { is_expected.to be_file } | ||
it { is_expected.to contain '# MANAGED BY PUPPET' } | ||
it { is_expected.to contain ' root /var/www/stage.puppetlabs.com;' } | ||
it { is_expected.to contain ' location /media {' } | ||
it { is_expected.to contain ' root /var/www/staticfiles/stage;' } | ||
it { is_expected.not_to contain ' root /var/www/staticfiles/production;' } | ||
it { is_expected.to contain ' location /.well-known/acme-challenge/ {' } | ||
it { is_expected.to contain ' root /var/www/letsencrypt;' } | ||
end | ||
|
||
describe service('nginx') do | ||
it { is_expected.to be_running } | ||
it { is_expected.to be_enabled } | ||
end | ||
|
||
describe port(80) do | ||
it { is_expected.to be_listening } | ||
end | ||
end |
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