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

Commit ba60f7a

Browse files
author
Zach Leslie
committed
Merge pull request #96 from danieldreier/beaker_tests
Add basic beaker tests
2 parents 1076be2 + 2192fcf commit ba60f7a

23 files changed

+505
-54
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ pkg
33
spec/fixtures
44
.rspec_system
55
.vagrant
6+
log

CONTRIBUTING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Testing
2+
=======
3+
4+
Tests on the puppet-puppet module can be run via `rake`.
5+
6+
Run beaker acceptance tests:
7+
```
8+
BEAKER_destroy=no BEAKER_provision=no rake acceptance
9+
```
10+
11+
Run beaker acceptance tests on debian 7:
12+
```
13+
BEAKER_set=debian-73-x64 BEAKER_destroy=no BEAKER_provision=no rake acceptance
14+
```
15+
See spec/acceptance/nodesets for a list of possible node names; use the filename without .yml.
16+
17+
Run rspec-puppet tests:
18+
(note that these are run automatically by travis CI on pull requests)
19+
```
20+
rake spec
21+
```
22+

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ group :test do
55
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.4.0'
66
gem "puppet-lint"
77
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'
8+
gem "rspec", '< 3.0.0'
89
gem "puppet-syntax"
910
gem "puppetlabs_spec_helper"
1011
end

Gemfile.lock

Lines changed: 86 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
11
GIT
22
remote: https://github.com/rodjek/rspec-puppet.git
3-
revision: 03e94422fb9bbdd950d5a0bec6ead5d76e06616b
3+
revision: 389f99ef666521fec1b4530fe69dc1ab84a060a8
44
specs:
55
rspec-puppet (1.0.1)
66
rspec
77

88
GEM
99
remote: http://rubygems.org/
1010
specs:
11-
CFPropertyList (2.2.7)
12-
addressable (2.3.5)
11+
CFPropertyList (2.2.8)
12+
addressable (2.3.6)
13+
archive-tar-minitar (0.5.2)
14+
autoparse (0.3.3)
15+
addressable (>= 2.3.1)
16+
extlib (>= 0.9.15)
17+
multi_json (>= 1.0.0)
18+
aws-sdk (1.42.0)
19+
json (~> 1.4)
20+
nokogiri (>= 1.4.4)
1321
backports (3.6.0)
14-
beaker (1.8.1)
22+
beaker (1.12.1)
23+
aws-sdk (~> 1.38)
1524
blimpy (~> 0.6)
25+
docker-api
1626
fission (~> 0.4)
27+
google-api-client (~> 0.7.1)
1728
inifile (~> 2.0)
1829
json (~> 1.8)
1930
mime-types (~> 1.25)
@@ -22,90 +33,102 @@ GEM
2233
nokogiri (= 1.5.10)
2334
rbvmomi (= 1.8.1)
2435
unf (~> 0.1)
25-
beaker-rspec (2.2.0)
26-
beaker (~> 1.3)
36+
beaker-rspec (2.2.4)
37+
beaker (~> 1.10)
2738
rspec (~> 2.14)
28-
serverspec (~> 0.14)
29-
specinfra (~> 0.3)
39+
serverspec (~> 1.0)
40+
specinfra (~> 1.0)
3041
blimpy (0.6.7)
3142
fog
3243
minitar
3344
thor
3445
builder (3.2.2)
3546
celluloid (0.15.2)
3647
timers (~> 1.1.0)
37-
celluloid-io (0.15.0)
38-
celluloid (>= 0.15.0)
39-
nio4r (>= 0.5.0)
4048
coderay (1.1.0)
4149
diff-lcs (1.2.5)
50+
docker-api (1.11.0)
51+
archive-tar-minitar
52+
excon (>= 0.34.0)
53+
json
4254
ethon (0.7.0)
4355
ffi (>= 1.3.0)
44-
excon (0.31.0)
56+
excon (0.35.0)
57+
extlib (0.9.16)
4558
facter (1.7.5)
46-
faraday (0.8.9)
47-
multipart-post (~> 1.2.0)
48-
faraday_middleware (0.9.0)
49-
faraday (>= 0.7.4, < 0.9)
59+
faraday (0.9.0)
60+
multipart-post (>= 1.2, < 3)
61+
faraday_middleware (0.9.1)
62+
faraday (>= 0.7.4, < 0.10)
5063
ffi (1.9.3)
5164
fission (0.5.0)
5265
CFPropertyList (~> 2.2)
53-
fog (1.19.0)
66+
fog (1.11.1)
5467
builder
55-
excon (~> 0.31.0)
68+
excon (~> 0.20)
5669
formatador (~> 0.2.0)
70+
json (~> 1.7)
5771
mime-types
58-
multi_json (~> 1.0)
5972
net-scp (~> 1.1)
6073
net-ssh (>= 2.1.3)
61-
nokogiri (~> 1.5)
74+
nokogiri (~> 1.5.0)
6275
ruby-hmac
63-
formatador (0.2.4)
76+
formatador (0.2.5)
6477
gh (0.13.2)
6578
addressable
6679
backports
6780
faraday (~> 0.8)
6881
multi_json (~> 1.0)
6982
net-http-persistent (>= 2.7)
7083
net-http-pipeline
71-
guard (2.5.1)
84+
google-api-client (0.7.1)
85+
addressable (>= 2.3.2)
86+
autoparse (>= 0.3.3)
87+
extlib (>= 0.9.15)
88+
faraday (>= 0.9.0)
89+
jwt (>= 0.1.5)
90+
launchy (>= 2.1.1)
91+
multi_json (>= 1.0.0)
92+
retriable (>= 1.4)
93+
signet (>= 0.5.0)
94+
uuidtools (>= 2.1.0)
95+
guard (2.6.1)
7296
formatador (>= 0.2.4)
73-
listen (~> 2.6)
97+
listen (~> 2.7)
7498
lumberjack (~> 1.0)
7599
pry (>= 0.9.12)
76100
thor (>= 0.18.1)
77101
guard-rake (0.0.9)
78102
guard
79103
rake
80104
hashr (0.0.22)
81-
hiera (1.3.2)
105+
hiera (1.3.3)
82106
json_pure
83107
highline (1.6.21)
84108
inifile (2.0.2)
85109
json (1.8.1)
86110
json_pure (1.8.1)
111+
jwt (1.0.0)
87112
launchy (2.4.2)
88113
addressable (~> 2.3)
89-
listen (2.7.1)
114+
listen (2.7.6)
90115
celluloid (>= 0.15.2)
91-
celluloid-io (>= 0.15.0)
92116
rb-fsevent (>= 0.9.3)
93117
rb-inotify (>= 0.9)
94-
lumberjack (1.0.4)
118+
lumberjack (1.0.6)
95119
metaclass (0.0.4)
96120
method_source (0.8.2)
97121
mime-types (1.25.1)
98122
minitar (0.5.4)
99-
mocha (1.0.0)
123+
mocha (1.1.0)
100124
metaclass (~> 0.0.1)
101-
multi_json (1.9.2)
102-
multipart-post (1.2.0)
125+
multi_json (1.10.1)
126+
multipart-post (2.0.0)
103127
net-http-persistent (2.9.4)
104128
net-http-pipeline (1.0.1)
105-
net-scp (1.1.2)
129+
net-scp (1.2.1)
106130
net-ssh (>= 2.6.5)
107-
net-ssh (2.8.0)
108-
nio4r (1.0.0)
131+
net-ssh (2.9.1)
109132
nokogiri (1.5.10)
110133
pry (0.9.12.6)
111134
coderay (~> 1.0)
@@ -120,68 +143,76 @@ GEM
120143
puppet (>= 2.7.16)
121144
rest-client
122145
puppet-lint (0.3.2)
123-
puppet-syntax (1.1.1)
146+
puppet-syntax (1.2.0)
124147
puppet (>= 2.7.0)
125148
rake
126149
puppetlabs_spec_helper (0.4.1)
127150
mocha (>= 0.10.5)
128151
rake
129152
rspec (>= 2.9.0)
130153
rspec-puppet (>= 0.1.1)
131-
pusher-client (0.4.0)
132-
websocket (~> 1.0.0)
133-
rake (10.1.1)
154+
pusher-client (0.6.0)
155+
json
156+
websocket (~> 1.0)
157+
rake (10.3.2)
134158
rb-fsevent (0.9.4)
135-
rb-inotify (0.9.3)
159+
rb-inotify (0.9.4)
136160
ffi (>= 0.5.0)
137161
rbvmomi (1.8.1)
138162
builder
139163
nokogiri (>= 1.4.1)
140164
trollop
141165
rest-client (1.6.7)
142166
mime-types (>= 1.16)
167+
retriable (1.4.1)
143168
rgen (0.6.6)
144-
rspec (2.14.1)
145-
rspec-core (~> 2.14.0)
146-
rspec-expectations (~> 2.14.0)
147-
rspec-mocks (~> 2.14.0)
148-
rspec-core (2.14.8)
149-
rspec-expectations (2.14.5)
169+
rspec (2.99.0)
170+
rspec-core (~> 2.99.0)
171+
rspec-expectations (~> 2.99.0)
172+
rspec-mocks (~> 2.99.0)
173+
rspec-core (2.99.0)
174+
rspec-expectations (2.99.0)
150175
diff-lcs (>= 1.1.3, < 2.0)
151-
rspec-mocks (2.14.6)
176+
rspec-mocks (2.99.0)
152177
ruby-hmac (0.4.0)
153178
safe_yaml (0.9.7)
154-
serverspec (0.15.5)
179+
serverspec (1.7.0)
155180
highline
156181
net-ssh
157182
rspec (~> 2.13)
158-
specinfra (>= 0.7.1)
183+
specinfra (~> 1.13)
184+
signet (0.5.0)
185+
addressable (>= 2.2.3)
186+
faraday (>= 0.9.0.rc5)
187+
jwt (>= 0.1.5)
188+
multi_json (>= 1.0.0)
159189
slop (3.5.0)
160-
specinfra (0.8.0)
161-
thor (0.18.1)
190+
specinfra (1.15.0)
191+
thor (0.19.1)
162192
timers (1.1.0)
163-
travis (1.6.8)
193+
travis (1.6.11)
164194
addressable (~> 2.3)
165195
backports
166-
faraday (~> 0.8.7)
196+
faraday (~> 0.9)
167197
faraday_middleware (~> 0.9)
168198
gh (~> 0.13)
169199
highline (~> 1.6)
170200
launchy (~> 2.1)
171201
pry (~> 0.9)
172202
pusher-client (~> 0.4)
173-
typhoeus (~> 0.6)
203+
typhoeus (~> 0.6, >= 0.6.8)
174204
travis-lint (1.8.0)
175205
hashr (~> 0.0.22)
176206
safe_yaml (~> 0.9.0)
177207
trollop (2.0)
178208
typhoeus (0.6.8)
179209
ethon (>= 0.7.0)
180-
unf (0.1.3)
210+
unf (0.1.4)
181211
unf_ext
182212
unf_ext (0.0.6)
213+
uuidtools (2.1.4)
183214
vagrant-wrapper (1.2.1.1)
184-
websocket (1.0.7)
215+
websocket (1.1.4)
185216

186217
PLATFORMS
187218
ruby
@@ -196,6 +227,7 @@ DEPENDENCIES
196227
puppet-syntax
197228
puppetlabs_spec_helper
198229
rake
230+
rspec (< 3.0.0)
199231
rspec-puppet!
200232
travis
201233
travis-lint

Rakefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ exclude_paths = [
2727
PuppetLint.configuration.ignore_paths = exclude_paths
2828
PuppetSyntax.exclude_paths = exclude_paths
2929

30+
desc "Run acceptance tests"
31+
RSpec::Core::RakeTask.new(:acceptance) do |t|
32+
t.pattern = 'spec/acceptance'
33+
end
34+
3035
desc "Run syntax, lint, and spec tests."
3136
task :test => [
3237
:syntax,

spec/acceptance/agent_spec.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe 'agent', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
4+
context 'with default parameters' do
5+
it 'should run with no errors' do
6+
pp = <<-EOS
7+
class { 'puppet::agent': }
8+
EOS
9+
10+
# Run it twice and test for idempotency
11+
apply_manifest(pp, :catch_failures => true)
12+
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
13+
end
14+
end
15+
16+
# context 'running as service' do
17+
# it 'should run with no errors' do
18+
# pp = <<-EOS
19+
# class { 'puppet::agent':
20+
# method => 'service',
21+
# }
22+
# EOS
23+
24+
# # Run it twice and test for idempotency
25+
# apply_manifest(pp, :catch_failures => true)
26+
# expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
27+
# end
28+
#
29+
# describe service('puppet') do
30+
# it {
31+
# should be_enabled
32+
# }
33+
# it {
34+
# should be_running
35+
# }
36+
# end
37+
# end
38+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
HOSTS:
2+
centos-59-x64:
3+
roles:
4+
- master
5+
platform: el-5-x86_64
6+
box : centos-59-x64-vbox4210-nocm
7+
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box
8+
hypervisor : vagrant
9+
CONFIG:
10+
log_level: debug
11+
type: git
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
HOSTS:
2+
centos-64-x64:
3+
roles:
4+
- master
5+
- database
6+
- dashboard
7+
platform: el-6-x86_64
8+
box : centos-64-x64-vbox4210-nocm
9+
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
10+
hypervisor : vagrant
11+
CONFIG:
12+
log_level: debug
13+
type: pe
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
HOSTS:
2+
centos-64-x64:
3+
roles:
4+
- master
5+
platform: el-6-x86_64
6+
box : centos-64-x64-vbox4210-nocm
7+
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
8+
hypervisor : vagrant
9+
CONFIG:
10+
log_level: debug
11+
type: git

0 commit comments

Comments
 (0)