Skip to content

Commit

Permalink
Merge pull request #14 from jhoblitt/feature/beaker
Browse files Browse the repository at this point in the history
convert from rspec-systerm -> beaker
  • Loading branch information
Joshua Hoblitt committed May 31, 2014
2 parents c500ad7 + c62e058 commit c46f6eb
Show file tree
Hide file tree
Showing 28 changed files with 267 additions and 73 deletions.
11 changes: 0 additions & 11 deletions .nodeset.yml

This file was deleted.

19 changes: 9 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ else
gem 'puppet', :require => false
end

gem 'rake', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'puppet-lint', :require => false
gem 'puppet-syntax', :require => false
gem 'rspec-system', :require => false
gem 'rspec-system-puppet', :require => false
gem 'rspec-system-serverspec', '>= 2.0.1', :require => false
gem 'serverspec', :require => false

# vim:ft=ruby
gem 'rake', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'puppet-lint', :require => false
gem 'puppet-syntax', :require => false
gem 'rspec-puppet', :require => false
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
gem 'serverspec', :require => false
gem 'pry', :require => false
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'rspec-system/rake_task'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet-lint/tasks/puppet-lint'

Expand Down
10 changes: 10 additions & 0 deletions spec/acceptance/nodesets/centos-59-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HOSTS:
centos-59-x64:
roles:
- master
platform: el-5-x86_64
box : centos-59-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: git
12 changes: 12 additions & 0 deletions spec/acceptance/nodesets/centos-64-x64-pe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
HOSTS:
centos-64-x64:
roles:
- master
- database
- dashboard
platform: el-6-x86_64
box : centos-64-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: pe
10 changes: 10 additions & 0 deletions spec/acceptance/nodesets/centos-64-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HOSTS:
centos-64-x64:
roles:
- master
platform: el-6-x86_64
box : centos-64-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss
10 changes: 10 additions & 0 deletions spec/acceptance/nodesets/debian-607-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HOSTS:
debian-607-x64:
roles:
- master
platform: debian-6-amd64
box : debian-607-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-607-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: git
10 changes: 10 additions & 0 deletions spec/acceptance/nodesets/debian-70rc1-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HOSTS:
debian-70rc1-x64:
roles:
- master
platform: debian-7-amd64
box : debian-70rc1-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: git
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/debian-73-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
debian-73-x64.localhost:
roles:
- master
platform: debian-7-amd64
box : debian-73-x64-virtualbox-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box
hypervisor : vagrant
CONFIG:
log_level: debug
type: foss
10 changes: 10 additions & 0 deletions spec/acceptance/nodesets/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HOSTS:
centos-65-x64.localdomain:
roles:
- master
platform: el-6-x86_64
box : centos-65-x64-virtualbox-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
hypervisor : vagrant
CONFIG:
type: foss
10 changes: 10 additions & 0 deletions spec/acceptance/nodesets/fedora-18-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HOSTS:
fedora-18-x64:
roles:
- master
platform: fedora-18-x86_64
box : fedora-18-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss
10 changes: 10 additions & 0 deletions spec/acceptance/nodesets/sles-11-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HOSTS:
sles-11-x64.local:
roles:
- master
platform: sles-11-x64
box : sles-11sp1-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss
10 changes: 10 additions & 0 deletions spec/acceptance/nodesets/sles-11sp1-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HOSTS:
sles-11sp1-x64:
roles:
- master
platform: sles-11-x86_64
box : sles-11sp1-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: git
10 changes: 10 additions & 0 deletions spec/acceptance/nodesets/ubuntu-server-10044-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HOSTS:
ubuntu-server-10044-x64:
roles:
- master
platform: ubuntu-10.04-amd64
box : ubuntu-server-10044-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss
10 changes: 10 additions & 0 deletions spec/acceptance/nodesets/ubuntu-server-12042-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HOSTS:
ubuntu-server-12042-x64:
roles:
- master
platform: ubuntu-12.04-amd64
box : ubuntu-server-12042-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
ubuntu-server-1404-x64:
roles:
- master
platform: ubuntu-14.04-amd64
box : puppetlabs/ubuntu-14.04-64-nocm
box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
hypervisor : vagrant
CONFIG:
log_level : debug
type: git
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
require 'spec_helper_system'
require 'spec_helper_acceptance'

describe 'selenium::hub class' do
after(:all) do
shell "service seleniumhub stop"
end

describe 'running puppet code' do
# Using puppet_apply as a helper
it 'should work with no errors' do
Expand All @@ -12,11 +16,8 @@ class { 'selenium::hub': }
EOS

# Run it twice and test for idempotency
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
r.refresh
r.exit_code.should be_zero
end
expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("")
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
end
end

Expand All @@ -41,7 +42,14 @@ class { 'selenium::hub': }
it { should be_enabled }
end

describe port(4444) do
it { should be_listening.with('tcp') }
describe process('java') do
its(:args) { should match /-role hub/ }
it { should be_running }
end

pending('daemon is very slow to start listening') do
describe port(4444) do
it { should be_listening.with('tcp') }
end
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
require 'spec_helper_system'
require 'spec_helper_acceptance'

describe 'selenium::node class' do
after(:all) do
shell "service seleniumnode stop"
end

describe 'running puppet code' do
# Using puppet_apply as a helper
it 'should work with no errors' do
Expand All @@ -12,11 +16,8 @@ class { 'selenium::node': }
EOS

# Run it twice and test for idempotency
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
r.refresh
r.exit_code.should be_zero
end
expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("")
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
end
end

Expand All @@ -41,7 +42,14 @@ class { 'selenium::node': }
it { should be_enabled }
end

describe port(5555) do
it { should be_listening.with('tcp') }
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 }
end

pending('daemon is very slow to start listening') do
describe port(5555) do
it { should be_listening.with('tcp') }
end
end
end
55 changes: 55 additions & 0 deletions spec/acceptance/selenium_server_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
require 'spec_helper_acceptance'

describe 'selenium::server class' do
after(:all) do
shell "service seleniumserver 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::server']
class { 'selenium::server': }
EOS

# Run it twice and test for idempotency
expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("")
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
end
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 }
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}
end
end

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

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

pending('daemon is very slow to start listening') do
describe port(4444) do
it { should be_listening.with('tcp') }
end
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper_system'
require 'spec_helper_acceptance'

describe 'selenium class' do
describe 'running puppet code' do
Expand All @@ -12,11 +12,8 @@ class { 'selenium': }
EOS

# Run it twice and test for idempotency
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
r.refresh
r.exit_code.should be_zero
end
expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("")
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
end
end

Expand All @@ -33,7 +30,7 @@ class { 'selenium': }
it { should be_linked_to '/opt/selenium/log' }
end

describe file('/opt/selenium/jars/selenium-server-standalone-2.39.0.jar') do
describe file('/opt/selenium/jars/selenium-server-standalone-2.41.0.jar') do
it { should be_file }
it { should be_owned_by 'selenium' }
it { should be_grouped_into 'selenium' }
Expand Down
33 changes: 33 additions & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'beaker-rspec/spec_helper'
require 'beaker-rspec/helpers/serverspec'

unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
if hosts.first.is_pe?
install_pe
else
install_puppet
end
hosts.each do |host|
on hosts, "mkdir -p #{host['distmoduledir']}"
end
end

RSpec.configure do |c|
# Project root
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))

# Readable test descriptions
c.formatter = :documentation

# Configure all nodes in nodeset
c.before :suite do
# Install module and dependencies
puppet_module_install(:source => proj_root, :module_name => 'selenium')
hosts.each do |host|
on host, puppet('module', 'install', 'puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module', 'install', 'maestrodev-wget'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module', 'install', 'rodjek-logrotate'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module', 'install', 'puppetlabs-java'), { :acceptable_exit_codes => [0,1] }
end
end
end
Loading

0 comments on commit c46f6eb

Please sign in to comment.