serverspec 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 593c624ff578dd19f008494d2c96baffdac588f2
4
- data.tar.gz: 02e72fd3e80fb95ba6baaa8b9179648f31bed28b
3
+ metadata.gz: e33ca47a0fc901359a0863ad44a1472cc6776259
4
+ data.tar.gz: 7f52fb2b9da01fa14879dfe904a47f5f585e1203
5
5
  SHA512:
6
- metadata.gz: d8e3c139f6303c2845fdeea770cd3d1515e7c10fa4a54a7e6892b7abe556c982061fbf90b8a68878d28d00469c83c59b0a4b53f8b5b8ee9d52d62f9ec8fc5555
7
- data.tar.gz: 173e75bf9d20f30f1f29b978d68d6d7105fdffb9f30432f4d6e8a73cc785a7da02e5e02f37f23664d0d2cd11b39b3ea285fc45af55798d585dc568ff55cf0924
6
+ metadata.gz: 0bcd8d57689bae9e6b78508701f93e77d52f4e194c838d01af4651043934545bf317f806ece0bc742aa6151126c64d805eb9e0dc853764d58484f025e21d3e3a
7
+ data.tar.gz: 38ed26a879641a12add9054c8ad2bb19b9df561fa58eb0de9509fc1f40a3c2b58342dd9a0a2164af74638ae18d68e2b78dafe7abc55801b4cb5d43d11b8d353a
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "integration-test"]
2
+ path = integration-test
3
+ url = https://github.com/serverspec/serverspec-integration-test.git
data/README.md CHANGED
@@ -97,7 +97,7 @@ Finished in 0.99715 seconds
97
97
  ----
98
98
  ## Multi OS support
99
99
 
100
- Serverspec supports Darwin based OS, Red Hat based OS, Debian based OS, Gentoo and Solaris.
100
+ Serverspec supports Darwin based OS, Red Hat based OS, Debian based OS, Gentoo, Solaris and Arch.
101
101
 
102
102
  Serverspec can detect target host's OS automatically.
103
103
 
@@ -135,6 +135,7 @@ You can select from:
135
135
  * SpecInfra::Helper::Gentoo
136
136
  * SpecInfra::Helper::Solaris
137
137
  * SpecInfra::Helper::Darwin
138
+ * SpecInfra::Helper::Arch
138
139
 
139
140
  ## Vagrant support
140
141
 
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require "octorelease"
5
5
  task :spec => 'spec:all'
6
6
 
7
7
  namespace :spec do
8
- oses = %w( darwin debian gentoo plamo redhat aix solaris solaris10 solaris11 smartos windows freebsd freebsd10)
8
+ oses = %w( darwin debian gentoo plamo redhat aix solaris solaris10 solaris11 smartos windows freebsd freebsd10 arch)
9
9
  backends = %w( exec ssh cmd winrm powershell )
10
10
 
11
11
  task :all => [ oses.map {|os| "spec:#{os}" }, backends, :helper, :unit ].flatten
@@ -3,6 +3,7 @@ module Serverspec
3
3
  [
4
4
  'DetectOS',
5
5
  'AIX',
6
+ 'Arch',
6
7
  'Darwin',
7
8
  'Debian',
8
9
  'FreeBSD',
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -31,7 +31,7 @@ end
31
31
 
32
32
  describe host('127.0.0.1') do
33
33
  it { should be_reachable }
34
- its(:command) { should eq "ping -n 127.0.0.1 -w 5 -c 2" }
34
+ its(:command) { should eq "ping -w 5 -c 2 -n 127.0.0.1" }
35
35
  end
36
36
 
37
37
  describe host('invalid-host') do
@@ -40,7 +40,7 @@ end
40
40
 
41
41
  describe host('127.0.0.1') do
42
42
  it { should be_reachable.with(:proto => "icmp", :timeout=> 1) }
43
- its(:command) { should eq "ping -n 127.0.0.1 -w 1 -c 2" }
43
+ its(:command) { should eq "ping -w 1 -c 2 -n 127.0.0.1" }
44
44
  end
45
45
 
46
46
  describe host('127.0.0.1') do
@@ -11,10 +11,6 @@ describe package('invalid-package') do
11
11
  it { should_not be_installed }
12
12
  end
13
13
 
14
- package('invalid-package') do
15
- it { should_not be_installed.by('rpm') }
16
- end
17
-
18
14
  describe package('httpd') do
19
15
  it { should be_installed.with_version('2.2.15-28.el6') }
20
16
  its(:command) { should eq "lslpp -L httpd | awk '{print $2}' | grep -w -- 2.2.15-28.el6" }
@@ -0,0 +1,413 @@
1
+ require 'spec_helper'
2
+
3
+ include SpecInfra::Helper::Arch
4
+
5
+ describe file('/etc/ssh/sshd_config') do
6
+ it { should be_file }
7
+ its(:command) { should eq "test -f /etc/ssh/sshd_config" }
8
+ end
9
+
10
+ describe file('/etc/invalid_file') do
11
+ it { should_not be_file }
12
+ end
13
+
14
+ describe file('/etc/ssh') do
15
+ it { should be_directory }
16
+ its(:command) { should eq "test -d /etc/ssh" }
17
+ end
18
+
19
+ describe file('/etc/invalid_directory') do
20
+ it { should_not be_directory }
21
+ end
22
+
23
+ describe file('/var/run/unicorn.sock') do
24
+ it { should be_socket }
25
+ its(:command) { should eq "test -S /var/run/unicorn.sock" }
26
+ end
27
+
28
+ describe file('/etc/invalid_socket') do
29
+ it { should_not be_socket }
30
+ end
31
+
32
+ describe file('/etc/ssh/sshd_config') do
33
+ it { should contain 'This is the sshd server system-wide configuration file' }
34
+ its(:command) { should eq "grep -q -- This\\ is\\ the\\ sshd\\ server\\ system-wide\\ configuration\\ file /etc/ssh/sshd_config || grep -qF -- This\\ is\\ the\\ sshd\\ server\\ system-wide\\ configuration\\ file /etc/ssh/sshd_config" }
35
+ end
36
+
37
+ describe file('/etc/ssh/sshd_config') do
38
+ it { should contain /^This is the sshd server system-wide configuration file/ }
39
+ its(:command) { should eq "grep -q -- \\^This\\ is\\ the\\ sshd\\ server\\ system-wide\\ configuration\\ file /etc/ssh/sshd_config || grep -qF -- \\^This\\ is\\ the\\ sshd\\ server\\ system-wide\\ configuration\\ file /etc/ssh/sshd_config" }
40
+ end
41
+
42
+ describe file('/etc/ssh/sshd_config') do
43
+ it { should_not contain 'This is invalid text!!' }
44
+ end
45
+
46
+ describe file('Gemfile') do
47
+ it { should contain('rspec').from(/^group :test do/).to(/^end/) }
48
+ its(:command) { should eq "sed -n /\\^group\\ :test\\ do/,/\\^end/p Gemfile | grep -q -- rspec - || sed -n /\\^group\\ :test\\ do/,/\\^end/p Gemfile | grep -qF -- rspec -" }
49
+ end
50
+
51
+ describe file('/etc/ssh/sshd_config') do
52
+ it { should_not contain('This is invalid text!!').from(/^group :test do/).to(/^end/) }
53
+ end
54
+
55
+ describe file('Gemfile') do
56
+ it { should contain('rspec').after(/^group :test do/) }
57
+ its(:command) { should eq "sed -n /\\^group\\ :test\\ do/,\\$p Gemfile | grep -q -- rspec - || sed -n /\\^group\\ :test\\ do/,\\$p Gemfile | grep -qF -- rspec -" }
58
+ end
59
+
60
+ describe file('/etc/ssh/sshd_config') do
61
+ it { should_not contain('This is invalid text!!').after(/^group :test do/) }
62
+ end
63
+
64
+ describe file('Gemfile') do
65
+ it { should contain('rspec').before(/^end/) }
66
+ its(:command) { should eq "sed -n 1,/\\^end/p Gemfile | grep -q -- rspec - || sed -n 1,/\\^end/p Gemfile | grep -qF -- rspec -" }
67
+ end
68
+
69
+ describe file('/etc/ssh/sshd_config') do
70
+ it { should_not contain('This is invalid text!!').before(/^end/) }
71
+ end
72
+
73
+ describe file('/etc/passwd') do
74
+ it { should be_mode 644 }
75
+ its(:command) { should eq "stat -c %a /etc/passwd | grep -- \\^644\\$" }
76
+ end
77
+
78
+ describe file('/etc/passwd') do
79
+ it { should_not be_mode 'invalid' }
80
+ end
81
+
82
+ describe file('/etc/passwd') do
83
+ it { should be_owned_by 'root' }
84
+ its(:command) { should eq "stat -c %U /etc/passwd | grep -- \\^root\\$" }
85
+ end
86
+
87
+ describe file('/etc/passwd') do
88
+ it { should_not be_owned_by 'invalid-owner' }
89
+ end
90
+
91
+ describe file('/etc/passwd') do
92
+ it { should be_grouped_into 'root' }
93
+ its(:command) { should eq "stat -c %G /etc/passwd | grep -- \\^root\\$" }
94
+ end
95
+
96
+ describe file('/etc/passwd') do
97
+ it { should_not be_grouped_into 'invalid-group' }
98
+ end
99
+
100
+ describe file('/etc/pam.d/system-auth') do
101
+ it { should be_linked_to '/etc/pam.d/system-auth-ac' }
102
+ its(:command) { should eq "stat -c %N /etc/pam.d/system-auth | egrep -e \"-> ./etc/pam.d/system-auth-ac.\"" }
103
+ end
104
+
105
+ describe file('dummy-link') do
106
+ it { should_not be_linked_to '/invalid/target' }
107
+ end
108
+
109
+ describe file('/dev') do
110
+ let(:stdout) { "755\r\n" }
111
+ it { should be_readable }
112
+ its(:command) { should eq "stat -c %a /dev" }
113
+ end
114
+
115
+ describe file('/dev') do
116
+ let(:stdout) { "333\r\n" }
117
+ it { should_not be_readable }
118
+ end
119
+
120
+ describe file('/dev') do
121
+ let(:stdout) { "400\r\n" }
122
+ it { should be_readable.by('owner') }
123
+ end
124
+
125
+ describe file('/dev') do
126
+ let(:stdout) { "044\r\n" }
127
+ it { should_not be_readable.by('owner') }
128
+ end
129
+
130
+ describe file('/dev') do
131
+ let(:stdout) { "040\r\n" }
132
+ it { should be_readable.by('group') }
133
+ end
134
+
135
+ describe file('/dev') do
136
+ let(:stdout) { "404\r\n" }
137
+ it { should_not be_readable.by('group') }
138
+ end
139
+
140
+ describe file('/dev') do
141
+ let(:stdout) { "044\r\n" }
142
+ it { should be_readable.by('others') }
143
+ end
144
+
145
+ describe file('/dev') do
146
+ let(:stdout) { "443\r\n" }
147
+ it { should_not be_readable.by('others') }
148
+ end
149
+
150
+ describe file('/tmp') do
151
+ it { should be_readable.by_user('mail') }
152
+ its(:command) { should eq "runuser -s /bin/sh -c \"test -r /tmp\" mail" }
153
+ end
154
+
155
+ describe file('/tmp') do
156
+ it { should_not be_readable.by_user('invalid-user') }
157
+ end
158
+
159
+ describe file('/dev') do
160
+ let(:stdout) { "755\r\n" }
161
+ it { should be_writable }
162
+ its(:command) { should eq "stat -c %a /dev" }
163
+ end
164
+
165
+ describe file('/dev') do
166
+ let(:stdout) { "555\r\n" }
167
+ it { should_not be_writable }
168
+ end
169
+
170
+ describe file('/dev') do
171
+ let(:stdout) { "200\r\n" }
172
+ it { should be_writable.by('owner') }
173
+ end
174
+
175
+ describe file('/dev') do
176
+ let(:stdout) { "555\r\n" }
177
+ it { should_not be_writable.by('owner') }
178
+ end
179
+
180
+ describe file('/dev') do
181
+ let(:stdout) { "030\r\n" }
182
+ it { should be_writable.by('group') }
183
+ end
184
+
185
+ describe file('/dev') do
186
+ let(:stdout) { "555\r\n" }
187
+ it { should_not be_writable.by('group') }
188
+ end
189
+
190
+ describe file('/dev') do
191
+ let(:stdout) { "666\r\n" }
192
+ it { should be_writable.by('others') }
193
+ end
194
+
195
+ describe file('/dev') do
196
+ let(:stdout) { "555\r\n" }
197
+ it { should_not be_writable.by('others') }
198
+ end
199
+
200
+ describe file('/tmp') do
201
+ it { should be_writable.by_user('mail') }
202
+ its(:command) { should eq "runuser -s /bin/sh -c \"test -w /tmp\" mail" }
203
+ end
204
+
205
+ describe file('/tmp') do
206
+ it { should_not be_writable.by_user('invalid-user') }
207
+ end
208
+
209
+ describe file('/dev') do
210
+ let(:stdout) { "755\r\n" }
211
+ it { should be_executable }
212
+ its(:command) { should eq "stat -c %a /dev" }
213
+ end
214
+
215
+ describe file('/dev') do
216
+ let(:stdout) { "666\r\n" }
217
+ it { should_not be_executable }
218
+ end
219
+
220
+ describe file('/dev') do
221
+ let(:stdout) { "100\r\n" }
222
+ it { should be_executable.by('owner') }
223
+ end
224
+
225
+ describe file('/dev') do
226
+ let(:stdout) { "666\r\n" }
227
+ it { should_not be_executable.by('owner') }
228
+ end
229
+
230
+ describe file('/dev') do
231
+ let(:stdout) { "070\r\n" }
232
+ it { should be_executable.by('group') }
233
+ end
234
+
235
+ describe file('/dev') do
236
+ let(:stdout) { "666\r\n" }
237
+ it { should_not be_executable.by('group') }
238
+ end
239
+
240
+ describe file('/dev') do
241
+ let(:stdout) { "001\r\n" }
242
+ it { should be_executable.by('others') }
243
+ end
244
+
245
+ describe file('/dev') do
246
+ let(:stdout) { "666\r\n" }
247
+ it { should_not be_executable.by('others') }
248
+ end
249
+
250
+ describe file('/tmp') do
251
+ it { should be_executable.by_user('mail') }
252
+ its(:command) { should eq "runuser -s /bin/sh -c \"test -x /tmp\" mail" }
253
+ end
254
+
255
+ describe file('/tmp') do
256
+ it { should_not be_executable.by_user('invalid-user') }
257
+ end
258
+
259
+ describe file('/') do
260
+ it { should be_mounted }
261
+ its(:command) { should eq "mount | grep -w -- on\\ /" }
262
+ end
263
+
264
+ describe file('/etc/invalid-mount') do
265
+ it { should_not be_mounted }
266
+ end
267
+
268
+ describe file('/') do
269
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
270
+ it { should be_mounted.with( :type => 'ext4' ) }
271
+ end
272
+
273
+ describe file('/') do
274
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
275
+ it { should be_mounted.with( :type => 'ext4', :options => { :rw => true } ) }
276
+ end
277
+
278
+ describe file('/') do
279
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
280
+ it { should be_mounted.with( :type => 'ext4', :options => { :mode => 620 } ) }
281
+ end
282
+
283
+ describe file('/') do
284
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
285
+ it { should be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_root' ) }
286
+ end
287
+
288
+ describe file('/') do
289
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
290
+ it { should_not be_mounted.with( :type => 'xfs' ) }
291
+ end
292
+
293
+ describe file('/') do
294
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
295
+ it { should_not be_mounted.with( :type => 'ext4', :options => { :rw => false } ) }
296
+ end
297
+
298
+ describe file('/') do
299
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
300
+ it { should_not be_mounted.with( :type => 'ext4', :options => { :mode => 600 } ) }
301
+ end
302
+
303
+ describe file('/') do
304
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
305
+ it { should_not be_mounted.with( :type => 'xfs', :device => '/dev/mapper/VolGroup-lv_root' ) }
306
+ end
307
+
308
+ describe file('/') do
309
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
310
+ it { should_not be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_r00t' ) }
311
+ end
312
+
313
+ describe file('/etc/invalid-mount') do
314
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
315
+ it { should_not be_mounted.with( :type => 'ext4' ) }
316
+ end
317
+
318
+ describe file('/') do
319
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
320
+ it do
321
+ should be_mounted.only_with(
322
+ :device => '/dev/mapper/VolGroup-lv_root',
323
+ :type => 'ext4',
324
+ :options => {
325
+ :rw => true,
326
+ :mode => 620,
327
+ }
328
+ )
329
+ end
330
+ end
331
+
332
+ describe file('/') do
333
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
334
+ it do
335
+ should_not be_mounted.only_with(
336
+ :device => '/dev/mapper/VolGroup-lv_root',
337
+ :type => 'ext4',
338
+ :options => {
339
+ :rw => true,
340
+ :mode => 620,
341
+ :bind => true,
342
+ }
343
+ )
344
+ end
345
+ end
346
+
347
+ describe file('/') do
348
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
349
+ it do
350
+ should_not be_mounted.only_with(
351
+ :device => '/dev/mapper/VolGroup-lv_root',
352
+ :type => 'ext4',
353
+ :options => {
354
+ :rw => true,
355
+ }
356
+ )
357
+ end
358
+ end
359
+
360
+ describe file('/') do
361
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
362
+ it do
363
+ should_not be_mounted.only_with(
364
+ :device => '/dev/mapper/VolGroup-lv_roooooooooot',
365
+ :type => 'ext4',
366
+ :options => {
367
+ :rw => true,
368
+ :mode => 620,
369
+ }
370
+ )
371
+ end
372
+ end
373
+
374
+ describe file('/etc/invalid-mount') do
375
+ let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
376
+ it { should_not be_mounted.only_with( :type => 'ext4' ) }
377
+ end
378
+
379
+ describe file('/etc/services') do
380
+ it { should match_md5checksum '35435ea447c19f0ea5ef971837ab9ced' }
381
+ its(:command) { should eq "md5sum /etc/services | grep -iw -- \\^35435ea447c19f0ea5ef971837ab9ced" }
382
+ end
383
+
384
+ describe file('invalid-file') do
385
+ it { should_not match_md5checksum 'INVALIDMD5CHECKSUM' }
386
+ end
387
+
388
+ describe file('/etc/services') do
389
+ it { should match_sha256checksum '0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a' }
390
+ its(:command) { should eq "sha256sum /etc/services | grep -iw -- \\^0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a" }
391
+ end
392
+
393
+ describe file('invalid-file') do
394
+ it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
395
+ end
396
+
397
+ describe file('/etc/passwd') do
398
+ let(:stdout) {<<EOF
399
+ root:x:0:0:root:/root:/bin/bash
400
+ bin:x:1:1:bin:/bin:/sbin/nologin
401
+ daemon:x:2:2:daemon:/sbin:/sbin/nologin
402
+ sync:x:5:0:sync:/sbin:/bin/sync
403
+ shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
404
+ halt:x:7:0:halt:/sbin:/sbin/halt
405
+ mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
406
+ operator:x:11:0:operator:/root:/sbin/nologin
407
+ nobody:x:99:99:Nobody:/:/sbin/nologin
408
+ dbus:x:81:81:System message bus:/:/sbin/nologin
409
+ EOF
410
+ }
411
+
412
+ its(:content) { should match /root:x:0:0/ }
413
+ end
@@ -0,0 +1,95 @@
1
+ require 'spec_helper'
2
+
3
+ include SpecInfra::Helper::Arch
4
+
5
+ describe package('curl') do
6
+ it { should be_installed }
7
+ its(:command) { should eq "pacman -Q | grep curl" }
8
+ end
9
+
10
+ describe package('invalid-package') do
11
+ it { should_not be_installed }
12
+ end
13
+
14
+ package('invalid-package') do
15
+ it { should_not be_installed.by('pacman') }
16
+ end
17
+
18
+ describe package('jekyll') do
19
+ it { should be_installed.by('gem') }
20
+ its(:command) { should eq "gem list --local | grep -w -- \\^jekyll" }
21
+ end
22
+
23
+ describe package('invalid-gem') do
24
+ it { should_not be_installed.by('gem') }
25
+ end
26
+
27
+ describe package('jekyll') do
28
+ it { should be_installed.by('gem').with_version('1.1.1') }
29
+ its(:command) { should eq "gem list --local | grep -w -- \\^jekyll | grep -w -- 1.1.1" }
30
+ end
31
+
32
+ describe package('jekyll') do
33
+ it { should_not be_installed.by('gem').with_version('invalid-version') }
34
+ end
35
+
36
+ describe package('bower') do
37
+ it { should be_installed.by('npm') }
38
+ its(:command) { should eq "npm ls bower -g" }
39
+ end
40
+
41
+ describe package('invalid-npm-package') do
42
+ it { should_not be_installed.by('npm') }
43
+ end
44
+
45
+ describe package('bower') do
46
+ it { should be_installed.by('npm').with_version('0.9.2') }
47
+ its(:command) { should eq "npm ls bower -g | grep -w -- 0.9.2" }
48
+ end
49
+
50
+ describe package('bower') do
51
+ it { should_not be_installed.by('npm').with_version('invalid-version') }
52
+ end
53
+
54
+
55
+ describe package('mongo') do
56
+ it { should be_installed.by('pecl') }
57
+ its(:command) { should eq "pecl list | grep -w -- \\^mongo" }
58
+ end
59
+
60
+ describe package('invalid-pecl') do
61
+ it { should_not be_installed.by('pecl') }
62
+ end
63
+
64
+ describe package('mongo') do
65
+ it { should be_installed.by('pecl').with_version('1.4.1') }
66
+ its(:command) { should eq "pecl list | grep -w -- \\^mongo | grep -w -- 1.4.1" }
67
+ end
68
+
69
+ describe package('mongo') do
70
+ it { should_not be_installed.by('pecl').with_version('invalid-version') }
71
+ end
72
+
73
+ describe package('XML_Util') do
74
+ it { should be_installed.by('pear').with_version('1.2.1') }
75
+ its(:command) { should eq "pear list | grep -w -- \\^XML_Util | grep -w -- 1.2.1" }
76
+ end
77
+
78
+ describe package('supervisor') do
79
+ it { should be_installed.by('pip').with_version('3.0') }
80
+ its(:command) { should eq "pip list | grep -w -- \\^supervisor | grep -w -- 3.0" }
81
+ end
82
+
83
+ describe package('invalid-pip') do
84
+ it { should_not be_installed.by('pip').with_version('invalid-version') }
85
+ end
86
+
87
+ describe package('App::Ack') do
88
+ it { should be_installed.by('cpan') }
89
+ its(:command) { should eq "cpan -l | grep -w -- \\^App::Ack" }
90
+ end
91
+
92
+ describe package('App::Ack') do
93
+ it { should be_installed.by('cpan').with_version('2.04') }
94
+ its(:command) { should eq "cpan -l | grep -w -- \\^App::Ack | grep -w -- 2.04" }
95
+ end
@@ -0,0 +1,84 @@
1
+ require 'spec_helper'
2
+
3
+ include SpecInfra::Helper::Arch
4
+
5
+ describe service('sshd') do
6
+ it { should be_enabled }
7
+ its(:command) { should eq "systemctl --plain list-dependencies multiuser.target | grep '^sshd.service$'" }
8
+ end
9
+
10
+ describe service('invalid-service') do
11
+ it { should_not be_enabled }
12
+ end
13
+
14
+ describe service('sshd') do
15
+ it { should be_enabled.with_level("graphical.target") }
16
+ its(:command) { should eq "systemctl --plain list-dependencies graphical.target | grep '^sshd.service$'" }
17
+ end
18
+
19
+ describe service('invalid-service') do
20
+ it { should_not be_enabled.with_level(4) }
21
+ end
22
+
23
+ describe service('sshd') do
24
+ it { should be_running }
25
+ its(:command) { should eq "systemctl is-active sshd.service" }
26
+ end
27
+
28
+ describe service('invalid-daemon') do
29
+ it { should_not be_running }
30
+ end
31
+
32
+ describe service('sshd') do
33
+ let(:stdout) { "sshd is stopped\r\n" }
34
+ it { should be_running }
35
+ end
36
+
37
+ describe service('sshd') do
38
+ it { should be_running.under('supervisor') }
39
+ its(:command) { should eq "supervisorctl status sshd | grep RUNNING" }
40
+ end
41
+
42
+ describe service('invalid-daemon') do
43
+ it { should_not be_running.under('supervisor') }
44
+ end
45
+
46
+ describe service('sshd') do
47
+ it {
48
+ expect {
49
+ should be_running.under('not implemented')
50
+ }.to raise_error(ArgumentError, %r/\A`be_running` matcher doesn\'t support/)
51
+ }
52
+ end
53
+
54
+ describe service('sshd') do
55
+ let(:stdout) { "Process 'sshd'\r\n status running\r\n monitoring status monitored" }
56
+ it { should be_monitored_by('monit') }
57
+ its(:command) { should eq "monit status" }
58
+ end
59
+
60
+ describe service('sshd') do
61
+ let(:stdout) { "Process 'sshd'\r\n status not monitored\r\n monitoring status not monitored" }
62
+ it { should_not be_monitored_by('monit') }
63
+ end
64
+
65
+ describe service('invalid-daemon') do
66
+ it { should_not be_monitored_by('monit') }
67
+ end
68
+
69
+ describe service('unicorn') do
70
+ it { should be_monitored_by('god') }
71
+ its(:command) { should eq "god status unicorn" }
72
+ end
73
+
74
+ describe service('invalid-daemon') do
75
+ it { should_not be_monitored_by('god') }
76
+ end
77
+
78
+ describe service('sshd') do
79
+ it {
80
+ expect {
81
+ should be_monitored_by('not implemented')
82
+ }.to raise_error(ArgumentError, %r/\A`be_monitored_by` matcher doesn\'t support/)
83
+ }
84
+ end
@@ -86,6 +86,7 @@ describe 'script creation' do
86
86
  script = create_script command
87
87
  script.should == <<-eof
88
88
  $exitCode = 1
89
+ $ProgressPreference = "SilentlyContinue"
89
90
  try {
90
91
  function test1
91
92
  $success = (test command)
@@ -31,7 +31,7 @@ end
31
31
 
32
32
  describe host('127.0.0.1') do
33
33
  it { should be_reachable }
34
- its(:command) { should eq "ping -n 127.0.0.1 -w 5 -c 2" }
34
+ its(:command) { should eq "ping -w 5 -c 2 -n 127.0.0.1" }
35
35
  end
36
36
 
37
37
  describe host('invalid-host') do
@@ -40,7 +40,7 @@ end
40
40
 
41
41
  describe host('127.0.0.1') do
42
42
  it { should be_reachable.with(:proto => "icmp", :timeout=> 1) }
43
- its(:command) { should eq "ping -n 127.0.0.1 -w 1 -c 2" }
43
+ its(:command) { should eq "ping -w 1 -c 2 -n 127.0.0.1" }
44
44
  end
45
45
 
46
46
  describe host('127.0.0.1') do
@@ -31,7 +31,7 @@ end
31
31
 
32
32
  describe host('127.0.0.1') do
33
33
  it { should be_reachable }
34
- its(:command) { should eq "ping -n 127.0.0.1 -w 5 -c 2" }
34
+ its(:command) { should eq "ping -w 5 -c 2 -n 127.0.0.1" }
35
35
  end
36
36
 
37
37
  describe host('invalid-host') do
@@ -40,7 +40,7 @@ end
40
40
 
41
41
  describe host('127.0.0.1') do
42
42
  it { should be_reachable.with(:proto => "icmp", :timeout=> 1) }
43
- its(:command) { should eq "ping -n 127.0.0.1 -w 1 -c 2" }
43
+ its(:command) { should eq "ping -w 1 -c 2 -n 127.0.0.1" }
44
44
  end
45
45
 
46
46
  describe host('127.0.0.1') do
@@ -31,7 +31,7 @@ end
31
31
 
32
32
  describe host('127.0.0.1') do
33
33
  it { should be_reachable }
34
- its(:command) { should eq "ping -n 127.0.0.1 -w 5 -c 2" }
34
+ its(:command) { should eq "ping -w 5 -c 2 -n 127.0.0.1" }
35
35
  end
36
36
 
37
37
  describe host('invalid-host') do
@@ -40,7 +40,7 @@ end
40
40
 
41
41
  describe host('127.0.0.1') do
42
42
  it { should be_reachable.with(:proto => "icmp", :timeout=> 1) }
43
- its(:command) { should eq "ping -n 127.0.0.1 -w 1 -c 2" }
43
+ its(:command) { should eq "ping -w 1 -c 2 -n 127.0.0.1" }
44
44
  end
45
45
 
46
46
  describe host('127.0.0.1') do
@@ -31,7 +31,7 @@ end
31
31
 
32
32
  describe host('127.0.0.1') do
33
33
  it { should be_reachable }
34
- its(:command) { should eq "ping -n 127.0.0.1 -w 5 -c 2" }
34
+ its(:command) { should eq "ping -w 5 -c 2 -n 127.0.0.1" }
35
35
  end
36
36
 
37
37
  describe host('invalid-host') do
@@ -40,7 +40,7 @@ end
40
40
 
41
41
  describe host('127.0.0.1') do
42
42
  it { should be_reachable.with(:proto => "icmp", :timeout=> 1) }
43
- its(:command) { should eq "ping -n 127.0.0.1 -w 1 -c 2" }
43
+ its(:command) { should eq "ping -w 1 -c 2 -n 127.0.0.1" }
44
44
  end
45
45
 
46
46
  describe host('127.0.0.1') do
@@ -31,7 +31,7 @@ end
31
31
 
32
32
  describe host('127.0.0.1') do
33
33
  it { should be_reachable }
34
- its(:command) { should eq "ping -n 127.0.0.1 -w 5 -c 2" }
34
+ its(:command) { should eq "ping -w 5 -c 2 -n 127.0.0.1" }
35
35
  end
36
36
 
37
37
  describe host('invalid-host') do
@@ -40,7 +40,7 @@ end
40
40
 
41
41
  describe host('127.0.0.1') do
42
42
  it { should be_reachable.with(:proto => "icmp", :timeout=> 1) }
43
- its(:command) { should eq "ping -n 127.0.0.1 -w 1 -c 2" }
43
+ its(:command) { should eq "ping -w 1 -c 2 -n 127.0.0.1" }
44
44
  end
45
45
 
46
46
  describe host('127.0.0.1') do
@@ -31,7 +31,7 @@ end
31
31
 
32
32
  describe host('127.0.0.1') do
33
33
  it { should be_reachable }
34
- its(:command) { should eq "ping -n 127.0.0.1 -w 5 -c 2" }
34
+ its(:command) { should eq "ping -w 5 -c 2 -n 127.0.0.1" }
35
35
  end
36
36
 
37
37
  describe host('invalid-host') do
@@ -40,7 +40,7 @@ end
40
40
 
41
41
  describe host('127.0.0.1') do
42
42
  it { should be_reachable.with(:proto => "icmp", :timeout=> 1) }
43
- its(:command) { should eq "ping -n 127.0.0.1 -w 1 -c 2" }
43
+ its(:command) { should eq "ping -w 1 -c 2 -n 127.0.0.1" }
44
44
  end
45
45
 
46
46
  describe host('127.0.0.1') do
@@ -11,7 +11,7 @@ describe package('invalid-package') do
11
11
  it { should_not be_installed }
12
12
  end
13
13
 
14
- package('invalid-package') do
14
+ describe package('invalid-package') do
15
15
  it { should_not be_installed.by('rpm') }
16
16
  end
17
17
 
data/wercker.yml ADDED
@@ -0,0 +1,40 @@
1
+ box: wercker/ruby
2
+ build:
3
+ steps:
4
+ - script:
5
+ name: Make $HOME/.ssh directory
6
+ code: mkdir -p $HOME/.ssh
7
+ - create-file:
8
+ name: Put SSH public key
9
+ filename: $HOME/.ssh/id_rsa.pub
10
+ overwrite: true
11
+ hide-from-log: true
12
+ content: $DIGITALOCEAN_SSH_KEY_PUBLIC
13
+ - create-file:
14
+ name: Put SSH private key
15
+ filename: $HOME/.ssh/id_rsa
16
+ overwrite: true
17
+ hide-from-log: true
18
+ content: $DIGITALOCEAN_SSH_KEY_PRIVATE
19
+ - script:
20
+ name: Run chmod 0400 $HOME/.ssh/id_rsa
21
+ code: chmod 0400 $HOME/.ssh/id_rsa
22
+ - script:
23
+ name: Run setup.sh
24
+ code: $WORKING_DIR/setup.sh
25
+ - script:
26
+ name: Run vagrant up centos65
27
+ code: vagrant up centos65 --provider=digital_ocean
28
+ cwd: $WORKING_DIR
29
+ - script:
30
+ name: Run rake spec:centos65
31
+ code: rake spec:centos65
32
+ cwd: $WORKING_DIR
33
+
34
+ after-steps:
35
+ - script:
36
+ name: Run vagrant destroy
37
+ code: vagrant destroy centos65 --force
38
+ cwd: $WORKING_DIR
39
+ - 1syo/idobata-notify@0.1.1:
40
+ token: $IDOBATA_TOKEN
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-04 00:00:00.000000000 Z
11
+ date: 2014-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -131,6 +131,7 @@ extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
133
  - ".gitignore"
134
+ - ".gitmodules"
134
135
  - ".travis.yml"
135
136
  - Gemfile
136
137
  - Guardfile
@@ -213,6 +214,9 @@ files:
213
214
  - spec/aix/routing_table_spec.rb
214
215
  - spec/aix/service_spec.rb
215
216
  - spec/aix/user_spec.rb
217
+ - spec/arch/file_spec.rb
218
+ - spec/arch/package_spec.rb
219
+ - spec/arch/service_spec.rb
216
220
  - spec/backend/cmd/configuration_spec.rb
217
221
  - spec/backend/exec/configuration_spec.rb
218
222
  - spec/backend/powershell/script_helper_spec.rb
@@ -388,6 +392,7 @@ files:
388
392
  - spec/windows/service_spec.rb
389
393
  - spec/windows/user_spec.rb
390
394
  - spec/windows/windows_registry_key_spec.rb
395
+ - wercker.yml
391
396
  homepage: http://serverspec.org/
392
397
  licenses:
393
398
  - MIT
@@ -426,6 +431,9 @@ test_files:
426
431
  - spec/aix/routing_table_spec.rb
427
432
  - spec/aix/service_spec.rb
428
433
  - spec/aix/user_spec.rb
434
+ - spec/arch/file_spec.rb
435
+ - spec/arch/package_spec.rb
436
+ - spec/arch/service_spec.rb
429
437
  - spec/backend/cmd/configuration_spec.rb
430
438
  - spec/backend/exec/configuration_spec.rb
431
439
  - spec/backend/powershell/script_helper_spec.rb