Skip to content

Commit

Permalink
Merge pull request #27 from zivan/master
Browse files Browse the repository at this point in the history
fixed issue #19 SSL error with wget
  • Loading branch information
Joshua Hoblitt committed Feb 1, 2015
2 parents 0426075 + c5b1dd2 commit 1c6a1b0
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 23 deletions.
27 changes: 15 additions & 12 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -20,6 +21,7 @@
validate_string($version)
validate_string($url)
validate_string($download_timeout)
validate_bool($nocheckcertificate)

include wget

Expand Down Expand Up @@ -69,11 +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':
Expand Down
42 changes: 31 additions & 11 deletions spec/unit/classes/selenium_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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

0 comments on commit 1c6a1b0

Please sign in to comment.