Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing tests and upgrading to latest rpsec #36

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
matrix:
allow_failures:
- rvm: ruby-head
- env: PUPPET_GEM_VERSION="~> 3.7" FUTURE_PARSER="yes"
exclude:
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 2.7"
Expand Down
32 changes: 18 additions & 14 deletions spec/acceptance/selenium_hub_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
include java
Class['java'] -> Class['selenium::hub']

class { 'selenium':
nocheckcertificate => true
}

class { 'selenium::hub': }
EOS

Expand All @@ -22,34 +26,34 @@ class { 'selenium::hub': }
end

describe file('/etc/init.d/seleniumhub') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 755 }
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'root' }
it { is_expected.to be_grouped_into 'root' }
it { is_expected.to be_mode 755 }
end

%w[hub_stdout.log hub_stderr.log].each do |file|
describe file("/opt/selenium/log/#{file}") do
it { should be_file }
it { should be_owned_by 'selenium' }
it { should be_grouped_into 'selenium' }
it { should be_mode 644}
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'selenium' }
it { is_expected.to be_grouped_into 'selenium' }
it { is_expected.to be_mode 644}
end
end

describe service('seleniumhub') do
it { should be_running }
it { should be_enabled }
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end

describe process('java') do
its(:args) { should match /-role hub/ }
it { should be_running }
its(:args) { is_expected.to match /-role hub/ }
it { is_expected.to be_running }
end

pending('daemon is very slow to start listening') do
skip('daemon is very slow to start listening') do
describe port(4444) do
it { should be_listening.with('tcp') }
it { is_expected.to be_listening.with('tcp') }
end
end
end
32 changes: 18 additions & 14 deletions spec/acceptance/selenium_node_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
include java
Class['java'] -> Class['selenium::node']

class { 'selenium':
nocheckcertificate => true
}

class { 'selenium::node': }
EOS

Expand All @@ -22,34 +26,34 @@ class { 'selenium::node': }
end

describe file('/etc/init.d/seleniumnode') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 755 }
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'root' }
it { is_expected.to be_grouped_into 'root' }
it { is_expected.to be_mode 755 }
end

%w[node_stdout.log node_stderr.log].each do |file|
describe file("/opt/selenium/log/#{file}") do
it { should be_file }
it { should be_owned_by 'selenium' }
it { should be_grouped_into 'selenium' }
it { should be_mode 644}
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'selenium' }
it { is_expected.to be_grouped_into 'selenium' }
it { is_expected.to be_mode 644}
end
end

describe service('seleniumnode') do
it { should be_running }
it { should be_enabled }
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end

describe process('java') do
its(:args) { should match %|-Dwebdriver.enable.native.events=1 -role node -hub http://localhost:4444/grid/register| }
it { should be_running }
its(:args) { is_expected.to match %|-Dwebdriver.enable.native.events=1 -role node -hub http://localhost:4444/grid/register| }
it { is_expected.to be_running }
end

pending('daemon is very slow to start listening') do
skip('daemon is very slow to start listening') do
describe port(5555) do
it { should be_listening.with('tcp') }
it { is_expected.to be_listening.with('tcp') }
end
end
end
32 changes: 17 additions & 15 deletions spec/acceptance/selenium_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
pp = <<-EOS
include java
Class['java'] -> Class['selenium::server']

class { 'selenium':
nocheckcertificate => true
}
class { 'selenium::server': }
EOS

Expand All @@ -22,34 +24,34 @@ class { 'selenium::server': }
end

describe file('/etc/init.d/seleniumserver') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 755 }
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'root' }
it { is_expected.to be_grouped_into 'root' }
it { is_expected.to be_mode 755 }
end

%w[server_stdout.log server_stderr.log].each do |file|
describe file("/opt/selenium/log/#{file}") do
it { should be_file }
it { should be_owned_by 'selenium' }
it { should be_grouped_into 'selenium' }
it { should be_mode 644}
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'selenium' }
it { is_expected.to be_grouped_into 'selenium' }
it { is_expected.to be_mode 644}
end
end

describe service('seleniumserver') do
it { should be_running }
it { should be_enabled }
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end

describe process('java') do
its(:args) { should match /-Dwebdriver.enable.native.events=1/ }
it { should be_running }
its(:args) { is_expected.to match /-Dwebdriver.enable.native.events=1/ }
it { is_expected.to be_running }
end

pending('daemon is very slow to start listening') do
skip('daemon is very slow to start listening') do
describe port(4444) do
it { should be_listening.with('tcp') }
it { is_expected.to be_listening.with('tcp') }
end
end
end
30 changes: 16 additions & 14 deletions spec/acceptance/selenium_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
include java
Class['java'] -> Class['selenium']

class { 'selenium': }
class { 'selenium':
nocheckcertificate => true
}
EOS

# Run it twice and test for idempotency
Expand All @@ -19,28 +21,28 @@ class { 'selenium': }

%w[/opt/selenium /opt/selenium/jars /opt/selenium/log].each do |file|
describe file(file) do
it { should be_directory }
it { should be_owned_by 'selenium' }
it { should be_grouped_into 'selenium' }
it { should be_mode 755 }
it { is_expected.to be_directory }
it { is_expected.to be_owned_by 'selenium' }
it { is_expected.to be_grouped_into 'selenium' }
it { is_expected.to be_mode 755 }
end
end

describe file('/var/log/selenium') do
it { should be_linked_to '/opt/selenium/log' }
it { is_expected.to be_linked_to '/opt/selenium/log' }
end

describe file("/opt/selenium/jars/selenium-server-standalone-#{DEFAULT_VERSION}.jar") do
it { should be_file }
it { should be_owned_by 'selenium' }
it { should be_grouped_into 'selenium' }
it { should be_mode 644 }
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'selenium' }
it { is_expected.to be_grouped_into 'selenium' }
it { is_expected.to be_mode 644 }
end

describe file('/etc/logrotate.d/selenium') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 444 }
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'root' }
it { is_expected.to be_grouped_into 'root' }
it { is_expected.to be_mode 444 }
end
end
8 changes: 4 additions & 4 deletions spec/unit/classes/selenium_hub_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
p.merge!(params) if params

it do
should contain_class('selenium')
should contain_selenium__config('hub').with({
is_expected.to contain_class('selenium')
is_expected.to contain_selenium__config('hub').with({
'options' => p[:options],
})
should contain_class('selenium::hub')
is_expected.to contain_class('selenium::hub')
end
end

Expand All @@ -37,7 +37,7 @@

it 'should fail' do
expect {
should contain_class('selenium::hub')
is_expected.to contain_class('selenium::hub')
}.to raise_error
end
end
Expand Down
12 changes: 6 additions & 6 deletions spec/unit/classes/selenium_node_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
p.merge!(params) if params

it do
should contain_class('selenium')
should contain_selenium__config('node').with({
is_expected.to contain_class('selenium')
is_expected.to contain_selenium__config('node').with({
'options' => "#{p[:options]} -hub #{p[:hub]}",
})
should contain_class('selenium::node')
is_expected.to contain_class('selenium::node')
end
end

Expand All @@ -39,7 +39,7 @@

it 'should fail' do
expect {
should contain_class('selenium::node')
is_expected.to contain_class('selenium::node')
}.to raise_error
end
end
Expand All @@ -56,7 +56,7 @@

it 'should fail' do
expect {
should contain_class('selenium::node')
is_expected.to contain_class('selenium::node')
}.to raise_error
end
end
Expand All @@ -73,7 +73,7 @@

it 'should fail' do
expect {
should contain_class('selenium::node')
is_expected.to contain_class('selenium::node')
}.to raise_error
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/classes/selenium_params_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
context 'for osfamily RedHat' do
let(:facts) {{ :osfamily => 'RedHat' }}

it { should contain_class('selenium::params') }
it { is_expected.to contain_class('selenium::params') }
end

context 'unsupported osfamily' do
Expand All @@ -17,7 +17,7 @@
end

it 'should fail' do
expect { should contain_class('selenium::params') }.
expect { is_expected.to contain_class('selenium::params') }.
to raise_error(Puppet::Error, /not supported on Debian/)
end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/unit/classes/selenium_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
p.merge!(params) if params

it do
should contain_class('selenium')
should contain_selenium__config('server').with({
is_expected.to contain_class('selenium')
is_expected.to contain_selenium__config('server').with({
'display' => p[:display],
'options' => p[:options],
})
should contain_class('selenium::server')
is_expected.to contain_class('selenium::server')
end
end

Expand All @@ -39,7 +39,7 @@

it 'should fail' do
expect {
should contain_class('selenium::server')
is_expected.to contain_class('selenium::server')
}.to raise_error
end
end
Expand All @@ -56,7 +56,7 @@

it 'should fail' do
expect {
should contain_class('selenium::server')
is_expected.to contain_class('selenium::server')
}.to raise_error
end
end
Expand Down
Loading