added tests

This commit is contained in:
James R. Carr 2015-03-23 14:40:13 -05:00
parent 466641a1f0
commit 6891c37864
2 changed files with 35 additions and 0 deletions

View file

@ -812,6 +812,24 @@ describe 'nginx::resource::vhost' do
it { is_expected.to contain_file("/etc/nginx/#{title}.key") } it { is_expected.to contain_file("/etc/nginx/#{title}.key") }
end end
context 'when ssl_client_cert is set' do
let :params do default_params.merge({
:ssl => true,
:listen_port => 80,
:ssl_port => 80,
:ssl_key => 'dummy.key',
:ssl_cert => 'dummy.cert',
:ssl_client_cert => 'client.cert',
}) end
it { is_expected.to contain_nginx__resource__location("#{title}-default").with_ssl_only(true) }
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content(%r{access_log\s+/var/log/nginx/ssl-www\.rspec\.example\.com\.access\.log combined;}) }
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content(%r{error_log\s+/var/log/nginx/ssl-www\.rspec\.example\.com\.error\.log}) }
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content(%r{client_verify on;}) }
it { is_expected.to contain_file("/etc/nginx/#{title}.crt") }
it { is_expected.to contain_file("/etc/nginx/#{title}.client.crt") }
it { is_expected.to contain_file("/etc/nginx/#{title}.key") }
end
context 'when passenger_cgi_param is set' do context 'when passenger_cgi_param is set' do
let :params do default_params.merge({ let :params do default_params.merge({
:passenger_cgi_param => { 'test1' => 'test value 1', 'test2' => 'test value 2', 'test3' => 'test value 3' } :passenger_cgi_param => { 'test1' => 'test value 1', 'test2' => 'test value 2', 'test3' => 'test value 3' }

View file

@ -1,5 +1,14 @@
include nginx include nginx
nginx::resource::vhost { 'test3.local test3':
ensure => present,
www_root => '/var/www/nginx-default',
ssl => true,
ssl_cert => 'puppet:///modules/sslkey/whildcard_mydomain.crt',
ssl_client_cert => 'puppet:///modules/sslkey/whildcard_mydomain.crt',
ssl_key => 'puppet:///modules/sslkey/whildcard_mydomain.key'
}
nginx::resource::vhost { 'test2.local test2': nginx::resource::vhost { 'test2.local test2':
ensure => present, ensure => present,
www_root => '/var/www/nginx-default', www_root => '/var/www/nginx-default',
@ -15,3 +24,11 @@ nginx::resource::location { 'test2.local-bob':
vhost => 'test2.local test2', vhost => 'test2.local test2',
} }
nginx::resource::location { 'test3.local-bob':
ensure => present,
www_root => '/var/www/bob',
location => '/bob',
vhost => 'test3.local test3',
}