diff --git a/spec/defines/resource_vhost_spec.rb b/spec/defines/resource_vhost_spec.rb index eb2f239..ab3b894 100644 --- a/spec/defines/resource_vhost_spec.rb +++ b/spec/defines/resource_vhost_spec.rb @@ -812,6 +812,24 @@ describe 'nginx::resource::vhost' do it { is_expected.to contain_file("/etc/nginx/#{title}.key") } 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 let :params do default_params.merge({ :passenger_cgi_param => { 'test1' => 'test value 1', 'test2' => 'test value 2', 'test3' => 'test value 3' } diff --git a/tests/vhost_ssl.pp b/tests/vhost_ssl.pp index 0eff758..2973273 100644 --- a/tests/vhost_ssl.pp +++ b/tests/vhost_ssl.pp @@ -1,5 +1,14 @@ 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': ensure => present, www_root => '/var/www/nginx-default', @@ -15,3 +24,11 @@ nginx::resource::location { 'test2.local-bob': vhost => 'test2.local test2', } +nginx::resource::location { 'test3.local-bob': + ensure => present, + www_root => '/var/www/bob', + location => '/bob', + vhost => 'test3.local test3', +} + +