Project

General

Profile

« Previous | Next » 

Revision 2a616445

Added by Justin Sherrill almost 10 years ago

Refs #5029 - specify inital org and location

View differences:

modules/apache/spec/acceptance/vhost_spec.rb
shell("/usr/bin/curl -sSf files.example.net:80/private.html", {:acceptable_exit_codes => 22}).stderr.should match(/curl: \(22\) The requested URL returned error: 403/)
end
end
describe 'SetHandler directive' do
it 'should configure a vhost with a SetHandler directive' do
pp = <<-EOS
class { 'apache': }
apache::mod { 'status': }
host { 'files.example.net': ip => '127.0.0.1', }
apache::vhost { 'files.example.net':
docroot => '/var/www/files',
directories => [
{ path => '/var/www/files', },
{ path => '/server-status', provider => 'location', sethandler => 'server-status', },
],
}
file { '/var/www/files/index.html':
ensure => file,
content => "Hello World\\n",
}
EOS
apply_manifest(pp, :catch_failures => true)
end
describe service($service_name) do
it { should be_enabled }
it { should be_running }
end
it 'should answer to files.example.net' do
shell("/usr/bin/curl -sSf files.example.net:80/index.html").stdout.should eq("Hello World\n")
shell("/usr/bin/curl -sSf files.example.net:80/server-status?auto").stdout.should match(/Scoreboard: /)
end
end
end
case fact('lsbdistcodename')
......
docroot => '/tmp/test',
docroot_owner => 'test_owner',
docroot_group => 'test_group',
docroot_mode => '0750',
}
EOS
apply_manifest(pp, :catch_failures => true)
......
it { should be_directory }
it { should be_owned_by 'test_owner' }
it { should be_grouped_into 'test_group' }
it { should be_mode 750 }
end
end
......
apply_manifest(pp, :catch_failures => true)
end
describe file($ports_file) do
it { should be_file }
if fact('osfamily') == 'RedHat' and fact('operatingsystemmajrelease') == '7'
it { should_not contain 'NameVirtualHost test.server' }
elsif fact('operatingsystem') == 'Ubuntu' and fact('operatingsystemrelease') =~ /(14\.04|13\.10)/
it { should_not contain 'NameVirtualHost test.server' }
else
it { should contain 'NameVirtualHost test.server' }
end
end
describe file("#{$vhost_dir}/10-test.server.conf") do
it { should be_file }
end
......
end
end
describe 'actions' do
it 'applies cleanly' do
pp = <<-EOS
class { 'apache': }
host { 'test.server': ip => '127.0.0.1' }
apache::vhost { 'test.server':
docroot => '/tmp',
action => 'php-fastcgi',
}
EOS
pp = pp + "\nclass { 'apache::mod::actions': }" if fact('osfamily') == 'Debian'
apply_manifest(pp, :catch_failures => true)
end
describe file("#{$vhost_dir}/25-test.server.conf") do
it { should be_file }
it { should contain 'Action php-fastcgi /cgi-bin virtual' }
end
end
describe 'suphp' do
it 'applies cleanly' do
pp = <<-EOS
......
# Passenger isn't even in EPEL on el-5
if default['platform'] !~ /^el-5/
describe 'rack_base_uris' do
if fact('osfamily') == 'RedHat'
it 'adds epel' do
pp = "class { 'epel': }"
apply_manifest(pp, :catch_failures => true)
if fact('osfamily') == 'RedHat' and fact('operatingsystemmajrelease') == '7'
pending('Since we don\'t have passenger on RHEL7 rack_base_uris tests will fail')
else
describe 'rack_base_uris' do
if fact('osfamily') == 'RedHat'
it 'adds epel' do
pp = "class { 'epel': }"
apply_manifest(pp, :catch_failures => true)
end
end
end
it 'applies cleanly' do
pp = <<-EOS
class { 'apache': }
host { 'test.server': ip => '127.0.0.1' }
apache::vhost { 'test.server':
docroot => '/tmp',
rack_base_uris => ['/test'],
}
EOS
apply_manifest(pp, :catch_failures => true)
end
it 'applies cleanly' do
pp = <<-EOS
class { 'apache': }
host { 'test.server': ip => '127.0.0.1' }
apache::vhost { 'test.server':
docroot => '/tmp',
rack_base_uris => ['/test'],
}
EOS
apply_manifest(pp, :catch_failures => true)
end
describe file("#{$vhost_dir}/25-test.server.conf") do
it { should be_file }
it { should contain 'RackBaseURI /test' }
describe file("#{$vhost_dir}/25-test.server.conf") do
it { should be_file }
it { should contain 'RackBaseURI /test' }
end
end
end
end
......
end
# So what does this work on?
if default['platform'] !~ /^(debian-(6|7)|el-(5|6))/
if default['platform'] !~ /^(debian-(6|7)|el-(5|6|7))/
describe 'fastcgi' do
it 'applies cleanly' do
pp = <<-EOS
......
describe 'additional_includes' do
it 'applies cleanly' do
pp = <<-EOS
if $::osfamily == 'RedHat' and $::selinux == 'true' {
$semanage_package = $::operatingsystemmajrelease ? {
'5' => 'policycoreutils',
default => 'policycoreutils-python',
}
exec { 'set_apache_defaults':
command => 'semanage fcontext -a -t httpd_sys_content_t "/apache_spec(/.*)?"',
path => '/bin:/usr/bin/:/sbin:/usr/sbin',
require => Package[$semanage_package],
}
package { $semanage_package: ensure => installed }
exec { 'restorecon_apache':
command => 'restorecon -Rv /apache_spec',
path => '/bin:/usr/bin/:/sbin:/usr/sbin',
before => Service['httpd'],
require => Class['apache'],
}
}
class { 'apache': }
host { 'test.server': ip => '127.0.0.1' }
file { '/tmp/include': ensure => present, content => '#additional_includes' }
file { '/apache_spec': ensure => directory, }
file { '/apache_spec/include': ensure => present, content => '#additional_includes' }
apache::vhost { 'test.server':
docroot => '/tmp',
additional_includes => '/tmp/include',
docroot => '/apache_spec',
additional_includes => '/apache_spec/include',
}
EOS
apply_manifest(pp, :catch_failures => true)
......
describe file("#{$vhost_dir}/25-test.server.conf") do
it { should be_file }
it { should contain 'Include "/tmp/include"' }
it { should contain 'Include "/apache_spec/include"' }
end
end

Also available in: Unified diff