Skip to content

Commit

Permalink
Merge pull request #50 from jhoblitt/bugfix/hub-and-node-on-same-host
Browse files Browse the repository at this point in the history
acceptance test coverage of hub+node on the same host
  • Loading branch information
Joshua Hoblitt committed Aug 8, 2015
2 parents afe1d8c + 97f1fe2 commit c569f5b
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 7 deletions.
10 changes: 4 additions & 6 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,18 @@
validate_string($java)
validate_string($jar_name)

$init_script = "init-script-${name}"
# prog is the 'name' of the init.d script.
$prog = "selenium${name}"

case $::osfamily {
'debian': {
ensure_packages(['daemon'])
Package['daemon'] -> File[$init_script]
Package['daemon'] -> File[$prog]
}
default : {}
}

# prog is the 'name' of the init.d script.
$prog = "selenium${name}"

file { $init_script:
file { $prog:
ensure => 'file',
path => "/etc/init.d/${prog}",
owner => 'root',
Expand Down
33 changes: 33 additions & 0 deletions spec/acceptance/selenium_hub_and_node_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'spec_helper_acceptance'

describe 'selenium::hub & selenium::node on the same host' do
after(:all) do
shell "service seleniumhub stop"
shell "service seleniumnode stop"
end

describe 'running puppet code' do
# Using puppet_apply as a helper
it 'should work with no errors' do
pp = <<-EOS
include java
Class['java'] -> Class['selenium::hub']
Class['java'] -> Class['selenium::node']
class { 'selenium::hub': }
class { 'selenium::node': }
EOS

# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
end

['seleniumhub', 'seleniumnode'].each do |service|
describe service(service) do
it { should be_running }
it { should be_enabled }
end
end
end
12 changes: 11 additions & 1 deletion spec/unit/defines/selenium_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
p.merge!(params) if params

it do
should contain_file("init-script-#{title}").with({
should contain_file("selenium#{title}").with({
'ensure' => 'file',
'path' => "/etc/init.d/selenium#{title}",
'owner' => 'root',
Expand Down Expand Up @@ -93,4 +93,14 @@
end
end

context 'for osfamily Debian' do
let(:title) { 'server' }
let(:facts) {{ :osfamily => 'Debian' }}
let :pre_condition do
"include selenium"
end

it { should contain_package('daemon').with_ensure('present') }
end

end

0 comments on commit c569f5b

Please sign in to comment.