Convert existing tests over to beakr-rspec.
+++ /dev/null
----
-default_set: 'ubuntu-server-12042-x64'
-sets:
- 'debian-607-x64':
- nodes:
- "main.foo.vm":
- prefab: 'debian-607-x64'
- 'debian-70rc1-x64':
- nodes:
- "main.foo.vm":
- prefab: 'debian-70rc1-x64'
- 'ubuntu-server-10044-x64':
- nodes:
- "main.foo.vm":
- prefab: 'ubuntu-server-10044-x64'
- 'ubuntu-server-12042-x64':
- nodes:
- "main.foo.vm":
- prefab: 'ubuntu-server-12042-x64'
gem 'rake', :require => false
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
- gem 'rspec-system', :require => false
- gem 'rspec-system-puppet', :require => false
- gem 'rspec-system-serverspec', :require => false
+ gem 'serverspec', :require => false
+ gem 'beaker', :require => false
+ gem 'beaker-rspec', :require => false
end
if puppetversion = ENV['PUPPET_GEM_VERSION']
-require 'spec_helper_system'
+require 'spec_helper_acceptance'
describe 'apt::builddep' do
apt::builddep { 'glusterfs-server': }
EOS
- puppet_apply(pp) do |r|
- r.exit_code.should_not == 1
- end
+ apply_manifest(pp, :catch_failures => true)
end
describe 'should install g++ as a dependency' do
-require 'spec_helper_system'
+require 'spec_helper_acceptance'
describe 'apt::key' do
context 'reset' do
it 'clean up keys' do
- shell('apt-key del 4BD6EC30')
- shell('apt-key del D50582E6')
+ shell('apt-key del 4BD6EC30', :acceptable_exit_codes => [0,1,2])
+ shell('apt-key del D50582E6', :acceptable_exit_codes => [0,1,2])
end
end
}
EOS
- puppet_apply(pp) do |r|
- r.exit_code.should_not == 1
- end
+ apply_manifest(pp, :catch_failures => true)
end
describe 'keys should exist' do
it 'finds puppetlabs key' do
shell('apt-key list | grep 4BD6EC30') do |r|
- r.exit_code.should be_zero
+ expect(r.exit_code).to be_zero
end
end
it 'finds jenkins key' do
shell('apt-key list | grep D50582E6') do |r|
- r.exit_code.should be_zero
+ expect(r.exit_code).to be_zero
end
end
end
-require 'spec_helper_system'
+require 'spec_helper_acceptance'
describe 'apt::ppa' do
context 'reset' do
it 'removes ppa' do
- shell('rm /etc/apt/sources.list.d/drizzle-developers-ppa*')
- shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*')
+ shell('rm /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [0,1,2])
+ shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*', :acceptable_exit_codes => [0,1,2])
end
end
it 'should work with no errors' do
pp = <<-EOS
include '::apt'
- apt::ppa { 'ppa:drizzle-developers/ppa': }
+ apt::ppa { 'ppa:canonical-kernel-team/ppa': }
EOS
- puppet_apply(pp) do |r|
- r.exit_code.should_not == 1
- end
+ apply_manifest(pp, :catch_failures => true)
end
describe 'contains the source file' do
- it 'contains a drizzle ppa source' do
- shell('ls /etc/apt/sources.list.d/drizzle-developers-ppa-*.list') do |r|
- r.exit_code.should be_zero
- end
+ it 'contains a kernel ppa source' do
+ shell('ls /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [0])
end
end
end
apt::ppa { 'ppa:raravena80/collectd5': }
EOS
- puppet_apply(pp) do |r|
- r.exit_code.should_not == 1
- end
+ apply_manifest(pp, :catch_failures => true)
end
end
context 'reset' do
it 'removes added ppas' do
- shell('rm /etc/apt/sources.list.d/drizzle-developers-ppa*')
+ shell('rm /etc/apt/sources.list.d/canonical-kernel-team-ppa-*')
shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*')
end
end
-require 'spec_helper_system'
+require 'spec_helper_acceptance'
describe 'apt::source' do
context 'reset' do
it 'clean up puppetlabs repo' do
- shell('apt-key del 4BD6EC30')
- shell('rm /etc/apt/sources.list.d/puppetlabs.list')
+ shell('apt-key del 4BD6EC30', :acceptable_exit_codes => [0,1,2])
+ shell('rm /etc/apt/sources.list.d/puppetlabs.list', :acceptable_exit_codes => [0,1,2])
end
end
}
EOS
- puppet_apply(pp) do |r|
- r.exit_code.should_not == 1
- end
+ apply_manifest(pp, :catch_failures => true)
end
describe 'key should exist' do
it 'finds puppetlabs key' do
shell('apt-key list | grep 4BD6EC30') do |r|
- r.exit_code.should be_zero
+ expect(r.exit_code).to be_zero
end
end
end
-require 'spec_helper_system'
+require 'spec_helper_acceptance'
describe 'apt class' do
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
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_failures => true)
end
end
end
--- /dev/null
+HOSTS:
+ debian-70rc1-x64:
+ roles:
+ - master
+ platform: debian-70rc1-x64
+ box : debian-70rc1-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210-nocm.box
+ hypervisor : vagrant
--- /dev/null
+HOSTS:
+ ubuntu-server-12042-x64:
+ roles:
+ - master
+ platform: ubuntu-server-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
--- /dev/null
+HOSTS:
+ ubuntu-server-12042-x64:
+ roles:
+ - master
+ platform: ubuntu-server-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
--- /dev/null
+require 'beaker-rspec'
+
+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 and dependencies
+ puppet_module_install(:source => proj_root, :module_name => 'apt')
+ hosts.each do |host|
+ shell('/bin/touch /etc/puppet/hiera.yaml')
+ shell('puppet module install puppetlabs-stdlib', { :acceptable_exit_codes => [0,1] })
+ end
+ end
+end
+++ /dev/null
-require 'rspec-system/spec_helper'
-require 'rspec-system-puppet/helpers'
-require 'rspec-system-serverspec/helpers'
-
-include RSpecSystemPuppet::Helpers
-
-include Serverspec::Helper::RSpecSystem
-include Serverspec::Helper::DetectOS
-
-RSpec.configure do |c|
- # Project root
- proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
-
- # Enable colour
- c.tty = true
-
- c.include RSpecSystemPuppet::Helpers
-
- # This is where we 'setup' the nodes before running our tests
- c.before :suite do
- # May as well update here as this can only run on apt-get machines.
- shell('apt-get update')
- # Install puppet
- puppet_install
-
- # Install modules and dependencies
- puppet_module_install(:source => proj_root, :module_name => 'apt')
- shell('puppet module install puppetlabs-stdlib')
- end
-end
+++ /dev/null
-require 'spec_helper_system'
-
-describe 'basic tests:' do
- # Using puppet_apply as a subject
- context puppet_apply 'notice("foo")' do
- its(:stdout) { should =~ /foo/ }
- its(:stderr) { should be_empty }
- its(:exit_code) { should be_zero }
- end
-end