Skip to content

Commit

Permalink
Configure beaker with rspec for acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leoc authored and kajoik committed Aug 6, 2014
1 parent 86b4b3a commit bc8c650
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ end

group :development, :test do
gem 'puppet-lint', require: false
gem 'pry', require: false
gem 'rspec', require: false
gem 'rspec-puppet', require: false
gem 'puppetlabs_spec_helper', require: false
gem 'simplecov', require: false
gem 'puppet-blacksmith', require: false
gem 'puppet-syntax', require: false
gem 'beaker', require: false
gem 'beaker-rspec', require: false
end
9 changes: 9 additions & 0 deletions spec/acceptance/nodesets/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HOSTS:
debian-73-x64-virtualbox-puppet:
roles:
- master
platform: debian-7-amd64
box : debian-73-x64-virtualbox-puppet
box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-puppet.box
hypervisor : vagrant
distmoduledir: /etc/puppet/modules
15 changes: 15 additions & 0 deletions spec/acceptance/phpmyadmin_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'spec_helper_acceptance'

describe 'phpmyadmin class' do
describe 'running puppet code' do
it 'should work without errors' do
pp = 'class { \'phpmyadmin\': }'

# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
end

it 'should create config from template correctly'
end
end
1 change: 0 additions & 1 deletion spec/fixtures/modules/phpmyadmin/files

This file was deleted.

1 change: 0 additions & 1 deletion spec/fixtures/modules/phpmyadmin/lib

This file was deleted.

26 changes: 26 additions & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'beaker-rspec'
require 'pry'

hosts.each do |host|
# Install Puppet
install_package host, 'rubygems'
on host, 'gem install puppet --no-ri --no-rdoc'
on host, "mkdir -p #{host['distmoduledir']}"
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
puppet_module_install(:source => proj_root, :module_name => 'phpmyadmin')
hosts.each do |host|
on host, puppet('module','install','puppetlabs-vcsrepo'), { :acceptable_exit_codes => [0,1] }
end
end
end

0 comments on commit bc8c650

Please sign in to comment.