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
ae2af80
commit e564608
Showing
3 changed files
with
119 additions
and
35 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,59 @@ | ||
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': | ||
ensure => present, | ||
server => 'www.puppetlabs.com', | ||
location => '/media', | ||
proxy => 'http://static', | ||
} | ||
nginx::resource::location { 'letsencrypt': | ||
ensure => present, | ||
server => ['www.puppetlabs.com', 'socket.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 ' proxy_pass http://production;' } | ||
it { is_expected.to contain ' location /media {' } | ||
it { is_expected.to contain ' root /var/www/staticfiles;' } | ||
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/socket.puppetlabs.com.conf') do | ||
it { is_expected.to be_file } | ||
it { is_expected.to contain '# MANAGED BY PUPPET' } | ||
it { is_expected.to contain ' proxy_pass http://socket;' } | ||
it { is_expected.not_to contain ' location /media {' } | ||
it { is_expected.not_to contain ' root /var/www/staticfiles;' } | ||
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