Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Commit

Permalink
Merge pull request #96 from danieldreier/beaker_tests
Browse files Browse the repository at this point in the history
Add basic beaker tests
  • Loading branch information
Zach Leslie committed Jun 23, 2014
2 parents 1076be2 + 2192fcf commit ba60f7a
Show file tree
Hide file tree
Showing 23 changed files with 505 additions and 54 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pkg
spec/fixtures
.rspec_system
.vagrant
log
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Testing
=======

Tests on the puppet-puppet module can be run via `rake`.

Run beaker acceptance tests:
```
BEAKER_destroy=no BEAKER_provision=no rake acceptance
```

Run beaker acceptance tests on debian 7:
```
BEAKER_set=debian-73-x64 BEAKER_destroy=no BEAKER_provision=no rake acceptance
```
See spec/acceptance/nodesets for a list of possible node names; use the filename without .yml.

Run rspec-puppet tests:
(note that these are run automatically by travis CI on pull requests)
```
rake spec
```

1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ group :test do
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.4.0'
gem "puppet-lint"
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'
gem "rspec", '< 3.0.0'
gem "puppet-syntax"
gem "puppetlabs_spec_helper"
end
Expand Down
140 changes: 86 additions & 54 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
GIT
remote: https://github.com/rodjek/rspec-puppet.git
revision: 03e94422fb9bbdd950d5a0bec6ead5d76e06616b
revision: 389f99ef666521fec1b4530fe69dc1ab84a060a8
specs:
rspec-puppet (1.0.1)
rspec

GEM
remote: http://rubygems.org/
specs:
CFPropertyList (2.2.7)
addressable (2.3.5)
CFPropertyList (2.2.8)
addressable (2.3.6)
archive-tar-minitar (0.5.2)
autoparse (0.3.3)
addressable (>= 2.3.1)
extlib (>= 0.9.15)
multi_json (>= 1.0.0)
aws-sdk (1.42.0)
json (~> 1.4)
nokogiri (>= 1.4.4)
backports (3.6.0)
beaker (1.8.1)
beaker (1.12.1)
aws-sdk (~> 1.38)
blimpy (~> 0.6)
docker-api
fission (~> 0.4)
google-api-client (~> 0.7.1)
inifile (~> 2.0)
json (~> 1.8)
mime-types (~> 1.25)
Expand All @@ -22,90 +33,102 @@ GEM
nokogiri (= 1.5.10)
rbvmomi (= 1.8.1)
unf (~> 0.1)
beaker-rspec (2.2.0)
beaker (~> 1.3)
beaker-rspec (2.2.4)
beaker (~> 1.10)
rspec (~> 2.14)
serverspec (~> 0.14)
specinfra (~> 0.3)
serverspec (~> 1.0)
specinfra (~> 1.0)
blimpy (0.6.7)
fog
minitar
thor
builder (3.2.2)
celluloid (0.15.2)
timers (~> 1.1.0)
celluloid-io (0.15.0)
celluloid (>= 0.15.0)
nio4r (>= 0.5.0)
coderay (1.1.0)
diff-lcs (1.2.5)
docker-api (1.11.0)
archive-tar-minitar
excon (>= 0.34.0)
json
ethon (0.7.0)
ffi (>= 1.3.0)
excon (0.31.0)
excon (0.35.0)
extlib (0.9.16)
facter (1.7.5)
faraday (0.8.9)
multipart-post (~> 1.2.0)
faraday_middleware (0.9.0)
faraday (>= 0.7.4, < 0.9)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.9.1)
faraday (>= 0.7.4, < 0.10)
ffi (1.9.3)
fission (0.5.0)
CFPropertyList (~> 2.2)
fog (1.19.0)
fog (1.11.1)
builder
excon (~> 0.31.0)
excon (~> 0.20)
formatador (~> 0.2.0)
json (~> 1.7)
mime-types
multi_json (~> 1.0)
net-scp (~> 1.1)
net-ssh (>= 2.1.3)
nokogiri (~> 1.5)
nokogiri (~> 1.5.0)
ruby-hmac
formatador (0.2.4)
formatador (0.2.5)
gh (0.13.2)
addressable
backports
faraday (~> 0.8)
multi_json (~> 1.0)
net-http-persistent (>= 2.7)
net-http-pipeline
guard (2.5.1)
google-api-client (0.7.1)
addressable (>= 2.3.2)
autoparse (>= 0.3.3)
extlib (>= 0.9.15)
faraday (>= 0.9.0)
jwt (>= 0.1.5)
launchy (>= 2.1.1)
multi_json (>= 1.0.0)
retriable (>= 1.4)
signet (>= 0.5.0)
uuidtools (>= 2.1.0)
guard (2.6.1)
formatador (>= 0.2.4)
listen (~> 2.6)
listen (~> 2.7)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
guard-rake (0.0.9)
guard
rake
hashr (0.0.22)
hiera (1.3.2)
hiera (1.3.3)
json_pure
highline (1.6.21)
inifile (2.0.2)
json (1.8.1)
json_pure (1.8.1)
jwt (1.0.0)
launchy (2.4.2)
addressable (~> 2.3)
listen (2.7.1)
listen (2.7.6)
celluloid (>= 0.15.2)
celluloid-io (>= 0.15.0)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.4)
lumberjack (1.0.6)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (1.25.1)
minitar (0.5.4)
mocha (1.0.0)
mocha (1.1.0)
metaclass (~> 0.0.1)
multi_json (1.9.2)
multipart-post (1.2.0)
multi_json (1.10.1)
multipart-post (2.0.0)
net-http-persistent (2.9.4)
net-http-pipeline (1.0.1)
net-scp (1.1.2)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.8.0)
nio4r (1.0.0)
net-ssh (2.9.1)
nokogiri (1.5.10)
pry (0.9.12.6)
coderay (~> 1.0)
Expand All @@ -120,68 +143,76 @@ GEM
puppet (>= 2.7.16)
rest-client
puppet-lint (0.3.2)
puppet-syntax (1.1.1)
puppet-syntax (1.2.0)
puppet (>= 2.7.0)
rake
puppetlabs_spec_helper (0.4.1)
mocha (>= 0.10.5)
rake
rspec (>= 2.9.0)
rspec-puppet (>= 0.1.1)
pusher-client (0.4.0)
websocket (~> 1.0.0)
rake (10.1.1)
pusher-client (0.6.0)
json
websocket (~> 1.0)
rake (10.3.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.3)
rb-inotify (0.9.4)
ffi (>= 0.5.0)
rbvmomi (1.8.1)
builder
nokogiri (>= 1.4.1)
trollop
rest-client (1.6.7)
mime-types (>= 1.16)
retriable (1.4.1)
rgen (0.6.6)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
rspec (2.99.0)
rspec-core (~> 2.99.0)
rspec-expectations (~> 2.99.0)
rspec-mocks (~> 2.99.0)
rspec-core (2.99.0)
rspec-expectations (2.99.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.6)
rspec-mocks (2.99.0)
ruby-hmac (0.4.0)
safe_yaml (0.9.7)
serverspec (0.15.5)
serverspec (1.7.0)
highline
net-ssh
rspec (~> 2.13)
specinfra (>= 0.7.1)
specinfra (~> 1.13)
signet (0.5.0)
addressable (>= 2.2.3)
faraday (>= 0.9.0.rc5)
jwt (>= 0.1.5)
multi_json (>= 1.0.0)
slop (3.5.0)
specinfra (0.8.0)
thor (0.18.1)
specinfra (1.15.0)
thor (0.19.1)
timers (1.1.0)
travis (1.6.8)
travis (1.6.11)
addressable (~> 2.3)
backports
faraday (~> 0.8.7)
faraday (~> 0.9)
faraday_middleware (~> 0.9)
gh (~> 0.13)
highline (~> 1.6)
launchy (~> 2.1)
pry (~> 0.9)
pusher-client (~> 0.4)
typhoeus (~> 0.6)
typhoeus (~> 0.6, >= 0.6.8)
travis-lint (1.8.0)
hashr (~> 0.0.22)
safe_yaml (~> 0.9.0)
trollop (2.0)
typhoeus (0.6.8)
ethon (>= 0.7.0)
unf (0.1.3)
unf (0.1.4)
unf_ext
unf_ext (0.0.6)
uuidtools (2.1.4)
vagrant-wrapper (1.2.1.1)
websocket (1.0.7)
websocket (1.1.4)

PLATFORMS
ruby
Expand All @@ -196,6 +227,7 @@ DEPENDENCIES
puppet-syntax
puppetlabs_spec_helper
rake
rspec (< 3.0.0)
rspec-puppet!
travis
travis-lint
Expand Down
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ exclude_paths = [
PuppetLint.configuration.ignore_paths = exclude_paths
PuppetSyntax.exclude_paths = exclude_paths

desc "Run acceptance tests"
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = 'spec/acceptance'
end

desc "Run syntax, lint, and spec tests."
task :test => [
:syntax,
Expand Down
38 changes: 38 additions & 0 deletions spec/acceptance/agent_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require 'spec_helper_acceptance'

describe 'agent', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
context 'with default parameters' do
it 'should run with no errors' do
pp = <<-EOS
class { 'puppet::agent': }
EOS

# 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
end

# context 'running as service' do
# it 'should run with no errors' do
# pp = <<-EOS
# class { 'puppet::agent':
# method => 'service',
# }
# EOS

# # 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
#
# describe service('puppet') do
# it {
# should be_enabled
# }
# it {
# should be_running
# }
# end
# end
end
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/centos-59-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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:
log_level: debug
type: git
13 changes: 13 additions & 0 deletions spec/acceptance/nodesets/centos-64-x64-pe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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:
log_level: debug
type: pe
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/centos-64-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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:
log_level: debug
type: git
Loading

0 comments on commit ba60f7a

Please sign in to comment.