forked from voxpupuli/puppet-rabbitmq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add framework for rspec-system tests.
- Loading branch information
Ashley Penney
committed
Jul 16, 2013
1 parent
c246ec6
commit 39af9ee
Showing
6 changed files
with
132 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
default_set: 'centos-64-x64' | ||
sets: | ||
'centos-59-x64': | ||
nodes: | ||
"main.foo.vm": | ||
prefab: 'centos-59-x64' | ||
'centos-64-x64': | ||
nodes: | ||
"main.foo.vm": | ||
prefab: 'centos-64-x64' | ||
'fedora-18-x64': | ||
nodes: | ||
"main.foo.vm": | ||
prefab: 'fedora-18-x64' | ||
'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' | ||
'sles-11sp1-x64': | ||
nodes: | ||
"main.foo.vm": | ||
prefab: 'sles-11sp1-x64' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
require 'puppetlabs_spec_helper/rake_tasks' | ||
require 'rspec-system/rake_task' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'rspec-system/spec_helper' | ||
require 'rspec-system-puppet/helpers' | ||
require 'rspec-system-serverspec/helpers' | ||
include Serverspec::Helper::RSpecSystem | ||
include Serverspec::Helper::DetectOS | ||
include RSpecSystemPuppet::Helpers | ||
|
||
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 | ||
# Install puppet | ||
puppet_install | ||
|
||
# We need EPEL for erlang. | ||
if node.facts['osfamily'] == 'RedHat' | ||
shell('rpm -i http://mirrors.rit.edu/epel/6/i386/epel-release-6-8.noarch.rpm') | ||
end | ||
|
||
# Install modules and dependencies | ||
puppet_module_install(:source => proj_root, :module_name => 'rabbitmq') | ||
puppet_module_install(:source => "#{proj_root}/../erlang", :module_name => 'erlang') | ||
shell('puppet module install puppetlabs-stdlib') | ||
shell('puppet module install puppetlabs-apt') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'spec_helper_system' | ||
|
||
# Here we put the more basic fundamental tests, ultra obvious stuff. | ||
describe "basic tests:" do | ||
context 'make sure we have copied the module across' do | ||
# No point diagnosing any more if the module wasn't copied properly | ||
context shell 'ls /etc/puppet/modules/rabbitmq' do | ||
its(:stdout) { should =~ /Modulefile/ } | ||
its(:stderr) { should be_empty } | ||
its(:exit_code) { should be_zero } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
require 'spec_helper_system' | ||
|
||
describe "rabbitmq class:" do | ||
context 'should run successfully' do | ||
pp=" | ||
class { 'erlang': } | ||
class { 'rabbitmq': } | ||
Class['erlang'] -> Class['rabbitmq'] | ||
" | ||
|
||
context puppet_apply(pp) do | ||
its(:stderr) { should be_empty } | ||
its(:exit_code) { should_not == 1 } | ||
its(:refresh) { should be_nil } | ||
its(:stderr) { should be_empty } | ||
its(:exit_code) { should be_zero } | ||
end | ||
end | ||
|
||
context 'service_ensure => stopped:' do | ||
pp = "class { 'rabbitmq': service_ensure => stopped }" | ||
|
||
context puppet_apply(pp) do | ||
its(:stderr) { should be_empty } | ||
its(:exit_code) { should_not == 1 } | ||
its(:refresh) { should be_nil } | ||
its(:stderr) { should be_empty } | ||
its(:exit_code) { should be_zero } | ||
end | ||
end | ||
|
||
context 'service_ensure => running:' do | ||
pp = "class { 'rabbitmq': service_ensure => running }" | ||
|
||
context puppet_apply(pp) do |r| | ||
its(:stderr) { should be_empty } | ||
its(:exit_code) { should_not == 1 } | ||
its(:refresh) { should be_nil } | ||
its(:stderr) { should be_empty } | ||
its(:exit_code) { should be_zero } | ||
end | ||
end | ||
end |