2013-09-04 21:11:36 +02:00
|
|
|
require 'spec_helper_system'
|
|
|
|
|
|
|
|
describe "nginx::resource::upstream define:" do
|
2013-12-01 01:08:28 +01:00
|
|
|
it 'should run successfully' do
|
2013-09-04 21:11:36 +02:00
|
|
|
|
|
|
|
pp = "
|
|
|
|
class { 'nginx': }
|
|
|
|
nginx::resource::upstream { 'puppet_rack_app':
|
|
|
|
ensure => present,
|
|
|
|
members => [
|
|
|
|
'localhost:3000',
|
|
|
|
'localhost:3001',
|
|
|
|
'localhost:3002',
|
|
|
|
],
|
|
|
|
}
|
|
|
|
nginx::resource::vhost { 'rack.puppetlabs.com':
|
|
|
|
ensure => present,
|
|
|
|
proxy => 'http://puppet_rack_app',
|
|
|
|
}
|
|
|
|
"
|
|
|
|
|
2013-12-01 01:08:28 +01:00
|
|
|
puppet_apply(pp) do |r|
|
|
|
|
[0,2].should include r.exit_code
|
|
|
|
r.refresh
|
|
|
|
r.stderr.should be_empty
|
|
|
|
r.exit_code.should be_zero
|
2013-09-04 21:11:36 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe file('/etc/nginx/conf.d/puppet_rack_app-upstream.conf') do
|
|
|
|
it { should be_file }
|
|
|
|
it { should contain "server localhost:3000" }
|
|
|
|
it { should contain "server localhost:3001" }
|
|
|
|
it { should contain "server localhost:3002" }
|
|
|
|
it { should_not contain "server localhost:3003" }
|
|
|
|
end
|
|
|
|
|
2013-12-01 01:51:31 +01:00
|
|
|
describe file('/etc/nginx/sites-available/rack.puppetlabs.com.conf') do
|
2013-09-04 21:11:36 +02:00
|
|
|
it { should be_file }
|
|
|
|
it { should contain "proxy_pass http://puppet_rack_app;" }
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|