nginx_proxy_spec.rb 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. require 'spec_helper_system'
  2. describe "nginx::resource::upstream define:" do
  3. it 'should run successfully' do
  4. pp = "
  5. class { 'nginx': }
  6. nginx::resource::upstream { 'puppet_rack_app':
  7. ensure => present,
  8. members => [
  9. 'localhost:3000',
  10. 'localhost:3001',
  11. 'localhost:3002',
  12. ],
  13. }
  14. nginx::resource::vhost { 'rack.puppetlabs.com':
  15. ensure => present,
  16. proxy => 'http://puppet_rack_app',
  17. }
  18. "
  19. puppet_apply(pp) do |r|
  20. [0,2].should include r.exit_code
  21. r.refresh
  22. r.stderr.should be_empty
  23. r.exit_code.should be_zero
  24. end
  25. end
  26. describe file('/etc/nginx/conf.d/puppet_rack_app-upstream.conf') do
  27. it { should be_file }
  28. it { should contain "server localhost:3000" }
  29. it { should contain "server localhost:3001" }
  30. it { should contain "server localhost:3002" }
  31. it { should_not contain "server localhost:3003" }
  32. end
  33. describe file('/etc/nginx/sites-available/rack.puppetlabs.com.conf') do
  34. it { should be_file }
  35. it { should contain "proxy_pass http://puppet_rack_app;" }
  36. end
  37. end