Skip to content

Commit 97f1fe2

Browse files
committedAug 8, 2015
add acceptance test coverage of combined hub+node
1 parent 9b69415 commit 97f1fe2

File tree

3 files changed

+38
-7
lines changed

3 files changed

+38
-7
lines changed
 

‎manifests/config.pp

+4-6
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,18 @@
1919
validate_string($java)
2020
validate_string($jar_name)
2121

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

2425
case $::osfamily {
2526
'debian': {
2627
ensure_packages(['daemon'])
27-
Package['daemon'] -> File[$init_script]
28+
Package['daemon'] -> File[$prog]
2829
}
2930
default : {}
3031
}
3132

32-
# prog is the 'name' of the init.d script.
33-
$prog = "selenium${name}"
34-
35-
file { $init_script:
33+
file { $prog:
3634
ensure => 'file',
3735
path => "/etc/init.d/${prog}",
3836
owner => 'root',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe 'selenium::hub & selenium::node on the same host' do
4+
after(:all) do
5+
shell "service seleniumhub stop"
6+
shell "service seleniumnode stop"
7+
end
8+
9+
describe 'running puppet code' do
10+
# Using puppet_apply as a helper
11+
it 'should work with no errors' do
12+
pp = <<-EOS
13+
include java
14+
Class['java'] -> Class['selenium::hub']
15+
Class['java'] -> Class['selenium::node']
16+
17+
class { 'selenium::hub': }
18+
class { 'selenium::node': }
19+
EOS
20+
21+
# Run it twice and test for idempotency
22+
apply_manifest(pp, :catch_failures => true)
23+
apply_manifest(pp, :catch_changes => true)
24+
end
25+
end
26+
27+
['seleniumhub', 'seleniumnode'].each do |service|
28+
describe service(service) do
29+
it { should be_running }
30+
it { should be_enabled }
31+
end
32+
end
33+
end

‎spec/unit/defines/selenium_config_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
p.merge!(params) if params
1919

2020
it do
21-
should contain_file("init-script-#{title}").with({
21+
should contain_file("selenium#{title}").with({
2222
'ensure' => 'file',
2323
'path' => "/etc/init.d/selenium#{title}",
2424
'owner' => 'root',

0 commit comments

Comments
 (0)
Please sign in to comment.