From f75685c225a15b3d363358aba3e530e8a6576ce9 Mon Sep 17 00:00:00 2001 From: zverev Date: Wed, 24 Dec 2014 11:57:24 +0700 Subject: [PATCH 1/3] fixed issue #19 SSL error with wget --- manifests/init.pp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 1c63e25..4e27d4a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,13 +5,14 @@ # # class selenium( - $user = $selenium::params::user, - $group = $selenium::params::group, - $install_root = $selenium::params::install_root, - $java = $selenium::params::java, - $version = $selenium::params::version, - $url = undef, - $download_timeout = $selenium::params::download_timeout, + $user = $selenium::params::user, + $group = $selenium::params::group, + $install_root = $selenium::params::install_root, + $java = $selenium::params::java, + $version = $selenium::params::version, + $url = undef, + $download_timeout = $selenium::params::download_timeout, + $nocheckcertificate = false, ) inherits selenium::params { validate_string($user) validate_string($group) @@ -20,6 +21,7 @@ validate_string($version) validate_string($url) validate_string($download_timeout) + validate_bool($nocheckcertificate) include wget @@ -74,6 +76,7 @@ timeout => $download_timeout, execuser => $user, require => File[$jar_path], + nocheckcertificate => $nocheckcertificate, } logrotate::rule { 'selenium': From de88fd820d3fed5712cdaad7d5daaa2a2a9a6b00 Mon Sep 17 00:00:00 2001 From: zivan Date: Wed, 14 Jan 2015 11:13:07 +0600 Subject: [PATCH 2/3] update order params --- manifests/init.pp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 4e27d4a..d9186ad 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -71,12 +71,12 @@ } wget::fetch { 'selenium-server-standalone': - source => $jar_url, - destination => "${jar_path}/${jar_name}", - timeout => $download_timeout, - execuser => $user, - require => File[$jar_path], + source => $jar_url, + destination => "${jar_path}/${jar_name}", + timeout => $download_timeout, nocheckcertificate => $nocheckcertificate, + execuser => $user, + require => File[$jar_path], } logrotate::rule { 'selenium': From c5b1dd212e3b0fe3d42deb24e82be8b2532b542c Mon Sep 17 00:00:00 2001 From: zivan Date: Fri, 30 Jan 2015 07:38:44 +0600 Subject: [PATCH 3/3] add unit test for the param nocheckcertificate --- spec/unit/classes/selenium_spec.rb | 42 ++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/spec/unit/classes/selenium_spec.rb b/spec/unit/classes/selenium_spec.rb index 311d3e9..b27b182 100644 --- a/spec/unit/classes/selenium_spec.rb +++ b/spec/unit/classes/selenium_spec.rb @@ -5,13 +5,14 @@ shared_examples 'selenium' do |params| # XXX need to test $url p = { - :user => 'selenium', - :group => 'selenium', - :install_root => '/opt/selenium', - :java => 'java', - :version => DEFAULT_VERSION, - :url => '', - :download_timeout => '90', + :user => 'selenium', + :group => 'selenium', + :install_root => '/opt/selenium', + :java => 'java', + :version => DEFAULT_VERSION, + :url => '', + :download_timeout => '90', + :nocheckcertificate => false, } if params @@ -52,10 +53,11 @@ 'target' => "#{p[:install_root]}/log", }) should contain_wget__fetch('selenium-server-standalone').with({ - 'source' => "https://selenium-release.storage.googleapis.com/#{path_version}/selenium-server-standalone-#{p[:version]}.jar", - 'destination' => "#{p[:install_root]}/jars/selenium-server-standalone-#{p[:version]}.jar", - 'timeout' => p[:download_timeout], - 'execuser' => p[:user], + 'source' => "https://selenium-release.storage.googleapis.com/#{path_version}/selenium-server-standalone-#{p[:version]}.jar", + 'destination' => "#{p[:install_root]}/jars/selenium-server-standalone-#{p[:version]}.jar", + 'timeout' => p[:download_timeout], + 'nocheckcertificate' => p[:nocheckcertificate], + 'execuser' => p[:user], }) should contain_logrotate__rule('selenium').with({ :path => "#{p[:install_root]}/log", @@ -166,6 +168,24 @@ }.to raise_error end end + + context 'nocheckcertificate => true' do + p = { :nocheckcertificate => true } + let(:params) { p } + + it_behaves_like 'selenium', p + end + + context 'nocheckcertificate => []' do + p = { :nocheckcertificate => [] } + let(:params) { p } + + it 'should fail' do + expect { + should contain_class('selenium') + }.to raise_error + end + end end end