serverspec 0.6.24 → 0.6.25

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ include Serverspec::Helper::Solaris11
4
+
5
+ describe php_config('default_mimetype') do
6
+ let(:stdout) { 'text/html' }
7
+ its(:value) { should eq 'text/html' }
8
+ its(:command) { should eq "php -r 'echo get_cfg_var( \"default_mimetype\" );'" }
9
+ end
10
+
11
+ describe php_config('default_mimetype') do
12
+ let(:stdout) { 'text/html' }
13
+ its(:value) { should_not eq 'text/plain' }
14
+ end
15
+
16
+ describe php_config('session.cache_expire') do
17
+ let(:stdout) { '180' }
18
+ its(:value) { should eq 180 }
19
+ its(:command) { should eq "php -r 'echo get_cfg_var( \"session.cache_expire\" );'" }
20
+ end
21
+
22
+ describe php_config('session.cache_expire') do
23
+ let(:stdout) { '180' }
24
+ its(:value) { should_not eq 360 }
25
+ end
26
+
27
+ describe php_config('mbstring.http_output_conv_mimetypes') do
28
+ let(:stdout) { 'application' }
29
+ its(:value) { should match /application/ }
30
+ its(:command) { should eq "php -r 'echo get_cfg_var( \"mbstring.http_output_conv_mimetypes\" );'" }
31
+ end
32
+
33
+ describe php_config('mbstring.http_output_conv_mimetypes') do
34
+ let(:stdout) { 'application' }
35
+ its(:value) { should_not match /html/ }
36
+ end
@@ -2,12 +2,93 @@ require 'spec_helper'
2
2
 
3
3
  include Serverspec::Helper::Solaris11
4
4
 
5
- describe 'Serverspec service matchers of Solaris11' do
6
- it_behaves_like 'support service enabled matcher', 'sshd'
7
- it_behaves_like 'support service enabled with level matcher', 'sshd', 3
8
- it_behaves_like 'support service running matcher', 'sshd'
9
- it_behaves_like 'support service running under supervisor matcher', 'sshd'
10
- it_behaves_like 'support service running under unimplemented matcher', 'sshd'
11
- it_behaves_like 'support service monitored by monit matcher', 'unicorn'
12
- it_behaves_like 'support service monitored by unimplemented matcher', 'unicorn'
5
+ describe service('sshd') do
6
+ it { should be_enabled }
7
+ its(:command) { should eq "svcs -l sshd 2> /dev/null | egrep '^enabled *true$'" }
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(4) }
16
+ its(:command) { should eq "svcs -l sshd 2> /dev/null | egrep '^enabled *true$'" }
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 "svcs -l sshd status 2> /dev/null | egrep '^state *online$'" }
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
+ let(:stdout) { "sshd RUNNING\r\n" }
39
+ it { should be_running.under('supervisor') }
40
+ end
41
+
42
+ describe service('sshd') do
43
+ let(:stdout) { "sshd STOPPED\r\n" }
44
+ it { should_not be_running.under('supervisor') }
45
+ end
46
+
47
+ describe service('invalid-daemon') do
48
+ it { should_not be_running.under('supervisor') }
49
+ end
50
+
51
+ describe service('sshd') do
52
+ let(:stdout) { "sshd running\r\n" }
53
+ it { should be_running.under('upstart') }
54
+ end
55
+
56
+ describe service('sshd') do
57
+ let(:stdout) { "sshd waiting\r\n" }
58
+ it { should_not be_running.under('upstart') }
59
+ end
60
+
61
+ describe service('invalid-daemon') do
62
+ it { should_not be_running.under('upstart') }
63
+ end
64
+
65
+ describe service('sshd') do
66
+ it {
67
+ expect {
68
+ should be_running.under('not implemented')
69
+ }.to raise_error(ArgumentError, %r/\A`be_running` matcher doesn\'t support/)
70
+ }
71
+ end
72
+
73
+ describe service('sshd') do
74
+ let(:stdout) { "Process 'sshd'\r\n status running\r\n monitoring status monitored" }
75
+ it { should be_monitored_by('monit') }
76
+ its(:command) { should eq "monit status" }
77
+ end
78
+
79
+ describe service('sshd') do
80
+ let(:stdout) { "Process 'sshd'\r\n status not monitored\r\n monitoring status not monitored" }
81
+ it { should_not be_monitored_by('monit') }
82
+ end
83
+
84
+ describe service('invalid-daemon') do
85
+ it { should_not be_monitored_by('monit') }
86
+ end
87
+
88
+ describe service('sshd') do
89
+ it {
90
+ expect {
91
+ should be_monitored_by('not implemented')
92
+ }.to raise_error(ArgumentError, %r/\A`be_monitored_by` matcher doesn\'t support/)
93
+ }
13
94
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.24
4
+ version: 0.6.25
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-05 00:00:00.000000000 Z
12
+ date: 2013-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh
@@ -207,6 +207,7 @@ files:
207
207
  - lib/serverspec/type/kernel_module.rb
208
208
  - lib/serverspec/type/linux_kernel_parameter.rb
209
209
  - lib/serverspec/type/package.rb
210
+ - lib/serverspec/type/php_config.rb
210
211
  - lib/serverspec/type/port.rb
211
212
  - lib/serverspec/type/routing_table.rb
212
213
  - lib/serverspec/type/selinux.rb
@@ -219,19 +220,18 @@ files:
219
220
  - spec/backend/exec/configuration_spec.rb
220
221
  - spec/backend/ssh/configuration_spec.rb
221
222
  - spec/darwin/command_spec.rb
222
- - spec/darwin/commands_spec.rb
223
223
  - spec/darwin/cron_spec.rb
224
224
  - spec/darwin/default_gateway_spec.rb
225
225
  - spec/darwin/file_spec.rb
226
226
  - spec/darwin/group_spec.rb
227
227
  - spec/darwin/host_spec.rb
228
228
  - spec/darwin/package_spec.rb
229
+ - spec/darwin/php_config_spec.rb
229
230
  - spec/darwin/port_spec.rb
230
231
  - spec/darwin/routing_table_spec.rb
231
232
  - spec/darwin/service_spec.rb
232
233
  - spec/darwin/user_spec.rb
233
234
  - spec/debian/command_spec.rb
234
- - spec/debian/commands_spec.rb
235
235
  - spec/debian/cron_spec.rb
236
236
  - spec/debian/default_gateway_spec.rb
237
237
  - spec/debian/file_spec.rb
@@ -242,13 +242,13 @@ files:
242
242
  - spec/debian/kernel_module_spec.rb
243
243
  - spec/debian/linux_kernel_parameter_spec.rb
244
244
  - spec/debian/package_spec.rb
245
+ - spec/debian/php_config_spec.rb
245
246
  - spec/debian/port_spec.rb
246
247
  - spec/debian/routing_table_spec.rb
247
248
  - spec/debian/selinux_spec.rb
248
249
  - spec/debian/service_spec.rb
249
250
  - spec/debian/user_spec.rb
250
251
  - spec/gentoo/command_spec.rb
251
- - spec/gentoo/commands_spec.rb
252
252
  - spec/gentoo/cron_spec.rb
253
253
  - spec/gentoo/default_gateway_spec.rb
254
254
  - spec/gentoo/file_spec.rb
@@ -259,6 +259,7 @@ files:
259
259
  - spec/gentoo/kernel_module_spec.rb
260
260
  - spec/gentoo/linux_kernel_parameter_spec.rb
261
261
  - spec/gentoo/package_spec.rb
262
+ - spec/gentoo/php_config_spec.rb
262
263
  - spec/gentoo/port_spec.rb
263
264
  - spec/gentoo/routing_table_spec.rb
264
265
  - spec/gentoo/selinux_spec.rb
@@ -277,6 +278,7 @@ files:
277
278
  - spec/redhat/kernel_module_spec.rb
278
279
  - spec/redhat/linux_kernel_parameter_spec.rb
279
280
  - spec/redhat/package_spec.rb
281
+ - spec/redhat/php_config_spec.rb
280
282
  - spec/redhat/port_spec.rb
281
283
  - spec/redhat/routing_table_spec.rb
282
284
  - spec/redhat/selinux_spec.rb
@@ -294,6 +296,7 @@ files:
294
296
  - spec/solaris/ipfilter_spec.rb
295
297
  - spec/solaris/ipnat_spec.rb
296
298
  - spec/solaris/package_spec.rb
299
+ - spec/solaris/php_config_spec.rb
297
300
  - spec/solaris/port_spec.rb
298
301
  - spec/solaris/routing_table_spec.rb
299
302
  - spec/solaris/service_spec.rb
@@ -301,6 +304,7 @@ files:
301
304
  - spec/solaris/user_spec.rb
302
305
  - spec/solaris/zfs_spec.rb
303
306
  - spec/solaris10/commands_spec.rb
307
+ - spec/solaris10/php_config_spec.rb
304
308
  - spec/solaris11/command_spec.rb
305
309
  - spec/solaris11/commands_spec.rb
306
310
  - spec/solaris11/cron_spec.rb
@@ -311,6 +315,7 @@ files:
311
315
  - spec/solaris11/ipfilter_spec.rb
312
316
  - spec/solaris11/ipnat_spec.rb
313
317
  - spec/solaris11/package_spec.rb
318
+ - spec/solaris11/php_config_spec.rb
314
319
  - spec/solaris11/port_spec.rb
315
320
  - spec/solaris11/routing_table_spec.rb
316
321
  - spec/solaris11/service_spec.rb
@@ -318,8 +323,6 @@ files:
318
323
  - spec/solaris11/user_spec.rb
319
324
  - spec/solaris11/zfs_spec.rb
320
325
  - spec/spec_helper.rb
321
- - spec/support/shared_commands_examples.rb
322
- - spec/support/shared_service_examples.rb
323
326
  homepage: http://serverspec.org/
324
327
  licenses:
325
328
  - MIT
@@ -349,19 +352,18 @@ test_files:
349
352
  - spec/backend/exec/configuration_spec.rb
350
353
  - spec/backend/ssh/configuration_spec.rb
351
354
  - spec/darwin/command_spec.rb
352
- - spec/darwin/commands_spec.rb
353
355
  - spec/darwin/cron_spec.rb
354
356
  - spec/darwin/default_gateway_spec.rb
355
357
  - spec/darwin/file_spec.rb
356
358
  - spec/darwin/group_spec.rb
357
359
  - spec/darwin/host_spec.rb
358
360
  - spec/darwin/package_spec.rb
361
+ - spec/darwin/php_config_spec.rb
359
362
  - spec/darwin/port_spec.rb
360
363
  - spec/darwin/routing_table_spec.rb
361
364
  - spec/darwin/service_spec.rb
362
365
  - spec/darwin/user_spec.rb
363
366
  - spec/debian/command_spec.rb
364
- - spec/debian/commands_spec.rb
365
367
  - spec/debian/cron_spec.rb
366
368
  - spec/debian/default_gateway_spec.rb
367
369
  - spec/debian/file_spec.rb
@@ -372,13 +374,13 @@ test_files:
372
374
  - spec/debian/kernel_module_spec.rb
373
375
  - spec/debian/linux_kernel_parameter_spec.rb
374
376
  - spec/debian/package_spec.rb
377
+ - spec/debian/php_config_spec.rb
375
378
  - spec/debian/port_spec.rb
376
379
  - spec/debian/routing_table_spec.rb
377
380
  - spec/debian/selinux_spec.rb
378
381
  - spec/debian/service_spec.rb
379
382
  - spec/debian/user_spec.rb
380
383
  - spec/gentoo/command_spec.rb
381
- - spec/gentoo/commands_spec.rb
382
384
  - spec/gentoo/cron_spec.rb
383
385
  - spec/gentoo/default_gateway_spec.rb
384
386
  - spec/gentoo/file_spec.rb
@@ -389,6 +391,7 @@ test_files:
389
391
  - spec/gentoo/kernel_module_spec.rb
390
392
  - spec/gentoo/linux_kernel_parameter_spec.rb
391
393
  - spec/gentoo/package_spec.rb
394
+ - spec/gentoo/php_config_spec.rb
392
395
  - spec/gentoo/port_spec.rb
393
396
  - spec/gentoo/routing_table_spec.rb
394
397
  - spec/gentoo/selinux_spec.rb
@@ -407,6 +410,7 @@ test_files:
407
410
  - spec/redhat/kernel_module_spec.rb
408
411
  - spec/redhat/linux_kernel_parameter_spec.rb
409
412
  - spec/redhat/package_spec.rb
413
+ - spec/redhat/php_config_spec.rb
410
414
  - spec/redhat/port_spec.rb
411
415
  - spec/redhat/routing_table_spec.rb
412
416
  - spec/redhat/selinux_spec.rb
@@ -424,6 +428,7 @@ test_files:
424
428
  - spec/solaris/ipfilter_spec.rb
425
429
  - spec/solaris/ipnat_spec.rb
426
430
  - spec/solaris/package_spec.rb
431
+ - spec/solaris/php_config_spec.rb
427
432
  - spec/solaris/port_spec.rb
428
433
  - spec/solaris/routing_table_spec.rb
429
434
  - spec/solaris/service_spec.rb
@@ -431,6 +436,7 @@ test_files:
431
436
  - spec/solaris/user_spec.rb
432
437
  - spec/solaris/zfs_spec.rb
433
438
  - spec/solaris10/commands_spec.rb
439
+ - spec/solaris10/php_config_spec.rb
434
440
  - spec/solaris11/command_spec.rb
435
441
  - spec/solaris11/commands_spec.rb
436
442
  - spec/solaris11/cron_spec.rb
@@ -441,6 +447,7 @@ test_files:
441
447
  - spec/solaris11/ipfilter_spec.rb
442
448
  - spec/solaris11/ipnat_spec.rb
443
449
  - spec/solaris11/package_spec.rb
450
+ - spec/solaris11/php_config_spec.rb
444
451
  - spec/solaris11/port_spec.rb
445
452
  - spec/solaris11/routing_table_spec.rb
446
453
  - spec/solaris11/service_spec.rb
@@ -448,5 +455,3 @@ test_files:
448
455
  - spec/solaris11/user_spec.rb
449
456
  - spec/solaris11/zfs_spec.rb
450
457
  - spec/spec_helper.rb
451
- - spec/support/shared_commands_examples.rb
452
- - spec/support/shared_service_examples.rb
@@ -1,9 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Serverspec::Helper::Darwin
4
-
5
- describe 'Serverspec commands of Darwin family' do
6
- it_behaves_like 'support command check_running_under_supervisor', 'httpd'
7
- it_behaves_like 'support command check_monitored_by_monit', 'unicorn'
8
- it_behaves_like 'support command check_process', 'httpd'
9
- end
@@ -1,28 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Serverspec::Helper::Debian
4
-
5
- describe 'Serverspec commands of Debian family' do
6
- it_behaves_like 'support command check_running_under_supervisor', 'httpd'
7
-
8
- it_behaves_like 'support command check_running_under_upstart', 'monit'
9
-
10
- it_behaves_like 'support command check_monitored_by_monit', 'unicorn'
11
-
12
- it_behaves_like 'support command check_process', 'httpd'
13
- end
14
-
15
- describe 'check_enabled' do
16
- subject { commands.check_enabled('httpd') }
17
- it { should eq "ls /etc/rc3.d/ | grep -- httpd || grep 'start on' /etc/init/httpd.conf" }
18
- end
19
-
20
- describe 'check_enabled with run level 5' do
21
- subject { commands.check_enabled('httpd', 5) }
22
- it { should eq "ls /etc/rc5.d/ | grep -- httpd || grep 'start on' /etc/init/httpd.conf" }
23
- end
24
-
25
- describe 'check_running' do
26
- subject { commands.check_running('httpd') }
27
- it { should eq "service httpd status | grep 'running'" }
28
- end
@@ -1,20 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Serverspec::Helper::Gentoo
4
-
5
- describe 'Serverspec commands of Gentoo family' do
6
- it_behaves_like 'support command check_running_under_supervisor', 'httpd'
7
- it_behaves_like 'support command check_monitored_by_monit', 'unicorn'
8
- it_behaves_like 'support command check_process', 'httpd'
9
- end
10
-
11
- describe 'check_enabled' do
12
- subject { commands.check_enabled('httpd') }
13
- it { should eq "rc-update show | grep -- \\^\\\\s\\*httpd\\\\s\\*\\|\\\\s\\*\\\\\\(boot\\\\\\|default\\\\\\)" }
14
- end
15
-
16
- describe 'check_running' do
17
- subject { commands.check_running('httpd') }
18
- it { should eq '/etc/init.d/httpd status' }
19
- end
20
-
@@ -1,19 +0,0 @@
1
- shared_examples_for 'support command check_running_under_supervisor' do |service|
2
- subject { commands.check_running_under_supervisor(service) }
3
- it { should eq "supervisorctl status #{service}" }
4
- end
5
-
6
- shared_examples_for 'support command check_running_under_upstart' do |service|
7
- subject { commands.check_running_under_upstart(service) }
8
- it { should eq "initctl status #{service}" }
9
- end
10
-
11
- shared_examples_for 'support command check_monitored_by_monit' do |service|
12
- subject { commands.check_monitored_by_monit(service) }
13
- it { should eq "monit status" }
14
- end
15
-
16
- shared_examples_for 'support command check_process' do |process|
17
- subject { commands.check_process(process) }
18
- it { should eq "ps aux | grep -w -- #{process} | grep -qv grep" }
19
- end
@@ -1,118 +0,0 @@
1
- shared_examples_for 'support service enabled matcher' do |valid_service|
2
- describe 'be_enabled' do
3
- describe service(valid_service) do
4
- it { should be_enabled }
5
- end
6
-
7
- describe service('invalid-service') do
8
- it { should_not be_enabled }
9
- end
10
- end
11
- end
12
-
13
- shared_examples_for 'support service enabled with level matcher' do |valid_service, level|
14
- describe 'be_enabled' do
15
- describe service(valid_service) do
16
- it { should be_enabled.with_level(level) }
17
- end
18
-
19
- describe service('invalid-service') do
20
- it { should_not be_enabled.with_level(level) }
21
- end
22
- end
23
- end
24
-
25
- shared_examples_for 'support service running matcher' do |valid_service|
26
- describe 'be_running' do
27
- describe service(valid_service) do
28
- it { should be_running }
29
- end
30
-
31
- describe service('invalid-daemon') do
32
- it { should_not be_running }
33
- end
34
-
35
- describe service(valid_service) do
36
- let(:stdout) { "#{valid_service} is stopped\r\n" }
37
- it { should be_running }
38
- end
39
- end
40
- end
41
-
42
- shared_examples_for 'support service running under supervisor matcher' do |valid_service|
43
- describe 'be_running.under("supervisor")' do
44
- describe service(valid_service) do
45
- let(:stdout) { "#{valid_service} RUNNING\r\n" }
46
- it { should be_running.under('supervisor') }
47
- end
48
-
49
- describe service(valid_service) do
50
- let(:stdout) { "#{valid_service} STOPPED\r\n" }
51
- it { should_not be_running.under('supervisor') }
52
- end
53
-
54
- describe service('invalid-daemon') do
55
- it { should_not be_running.under('supervisor') }
56
- end
57
- end
58
- end
59
-
60
- shared_examples_for 'support service running under upstart matcher' do |valid_service|
61
- describe 'be_running.under("upstart")' do
62
- describe service(valid_service) do
63
- let(:stdout) { "#{valid_service} running\r\n" }
64
- it { should be_running.under('upstart') }
65
- end
66
-
67
- describe service(valid_service) do
68
- let(:stdout) { "#{valid_service} waiting\r\n" }
69
- it { should_not be_running.under('upstart') }
70
- end
71
-
72
- describe service('invalid-daemon') do
73
- it { should_not be_running.under('upstart') }
74
- end
75
- end
76
- end
77
-
78
- shared_examples_for 'support service running under unimplemented matcher' do |valid_service|
79
- describe 'be_running.under("not implemented")' do
80
- describe service(valid_service) do
81
- it {
82
- expect {
83
- should be_running.under('not implemented')
84
- }.to raise_error(ArgumentError, %r/\A`be_running` matcher doesn\'t support/)
85
- }
86
- end
87
- end
88
- end
89
-
90
- shared_examples_for 'support service monitored by monit matcher' do |valid_service|
91
- describe 'be_monitored_by("monit")' do
92
- describe service(valid_service) do
93
- let(:stdout) { "Process '#{valid_service}'\r\n status running\r\n monitoring status monitored" }
94
- it { should be_monitored_by('monit') }
95
- end
96
-
97
- describe service(valid_service) do
98
- let(:stdout) { "Process '#{valid_service}'\r\n status not monitored\r\n monitoring status not monitored" }
99
- it { should_not be_monitored_by('monit') }
100
- end
101
-
102
- describe service('invalid-daemon') do
103
- it { should_not be_monitored_by('monit') }
104
- end
105
- end
106
- end
107
-
108
- shared_examples_for 'support service monitored by unimplemented matcher' do |valid_service|
109
- describe 'be_monitored_by("not implemented")' do
110
- describe service(valid_service) do
111
- it {
112
- expect {
113
- should be_monitored_by('not implemented')
114
- }.to raise_error(ArgumentError, %r/\A`be_monitored_by` matcher doesn\'t support/)
115
- }
116
- end
117
- end
118
- end