serverspec 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/serverspec/backend/exec.rb +2 -0
- data/lib/serverspec/commands/aix.rb +69 -0
- data/lib/serverspec/helper/aix.rb +9 -0
- data/lib/serverspec/helper.rb +1 -0
- data/lib/serverspec/version.rb +1 -1
- data/lib/serverspec.rb +2 -0
- data/spec/aix/command_spec.rb +48 -0
- data/spec/aix/commands_spec.rb +13 -0
- data/spec/aix/cron_spec.rb +21 -0
- data/spec/aix/default_gateway_spec.rb +16 -0
- data/spec/aix/file_spec.rb +395 -0
- data/spec/aix/group_spec.rb +21 -0
- data/spec/aix/host_spec.rb +58 -0
- data/spec/aix/interface_spec.rb +24 -0
- data/spec/aix/iptables_spec.rb +21 -0
- data/spec/aix/kernel_module_spec.rb +12 -0
- data/spec/aix/linux_kernel_parameter_spec.rb +36 -0
- data/spec/aix/package_spec.rb +94 -0
- data/spec/aix/php_config_spec.rb +36 -0
- data/spec/aix/port_spec.rb +30 -0
- data/spec/aix/routing_table_spec.rb +120 -0
- data/spec/aix/selinux_spec.rb +18 -0
- data/spec/aix/service_spec.rb +93 -0
- data/spec/aix/user_spec.rb +58 -0
- data/spec/aix/yumrepo_spec.rb +25 -0
- data/spec/aix/zfs_spec.rb +18 -0
- metadata +43 -1
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Serverspec::Helper::RedHat
|
4
|
+
|
5
|
+
describe selinux do
|
6
|
+
it { should be_enforcing }
|
7
|
+
its(:command) { should eq "getenforce | grep -i -- enforcing && grep -i -- ^SELINUX=enforcing$ /etc/selinux/config" }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe selinux do
|
11
|
+
it { should be_permissive }
|
12
|
+
its(:command) { should eq "getenforce | grep -i -- permissive && grep -i -- ^SELINUX=permissive$ /etc/selinux/config" }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe selinux do
|
16
|
+
it { should be_disabled }
|
17
|
+
its(:command) { should eq "test ! -f /etc/selinux/config || (getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config)" }
|
18
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Serverspec::Helper::RedHat
|
4
|
+
|
5
|
+
describe service('sshd') do
|
6
|
+
it { should be_enabled }
|
7
|
+
its(:command) { should eq "chkconfig --list sshd | grep 3:on" }
|
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 "chkconfig --list sshd | grep 4:on" }
|
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 "service sshd status" }
|
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 { should be_running.under('upstart') }
|
48
|
+
its(:command) { should eq "initctl status sshd | grep running" }
|
49
|
+
end
|
50
|
+
|
51
|
+
describe service('invalid-daemon') do
|
52
|
+
it { should_not be_running.under('upstart') }
|
53
|
+
end
|
54
|
+
|
55
|
+
describe service('sshd') do
|
56
|
+
it {
|
57
|
+
expect {
|
58
|
+
should be_running.under('not implemented')
|
59
|
+
}.to raise_error(ArgumentError, %r/\A`be_running` matcher doesn\'t support/)
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
describe service('sshd') do
|
64
|
+
let(:stdout) { "Process 'sshd'\r\n status running\r\n monitoring status monitored" }
|
65
|
+
it { should be_monitored_by('monit') }
|
66
|
+
its(:command) { should eq "monit status" }
|
67
|
+
end
|
68
|
+
|
69
|
+
describe service('sshd') do
|
70
|
+
let(:stdout) { "Process 'sshd'\r\n status not monitored\r\n monitoring status not monitored" }
|
71
|
+
it { should_not be_monitored_by('monit') }
|
72
|
+
end
|
73
|
+
|
74
|
+
describe service('invalid-daemon') do
|
75
|
+
it { should_not be_monitored_by('monit') }
|
76
|
+
end
|
77
|
+
|
78
|
+
describe service('unicorn') do
|
79
|
+
it { should be_monitored_by('god') }
|
80
|
+
its(:command) { should eq "god status unicorn" }
|
81
|
+
end
|
82
|
+
|
83
|
+
describe service('invalid-daemon') do
|
84
|
+
it { should_not be_monitored_by('god') }
|
85
|
+
end
|
86
|
+
|
87
|
+
describe service('sshd') do
|
88
|
+
it {
|
89
|
+
expect {
|
90
|
+
should be_monitored_by('not implemented')
|
91
|
+
}.to raise_error(ArgumentError, %r/\A`be_monitored_by` matcher doesn\'t support/)
|
92
|
+
}
|
93
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Serverspec::Helper::RedHat
|
4
|
+
|
5
|
+
|
6
|
+
describe user('root') do
|
7
|
+
it { should exist }
|
8
|
+
its(:command) { should eq "id root" }
|
9
|
+
end
|
10
|
+
|
11
|
+
describe user('invalid-user') do
|
12
|
+
it { should_not exist }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe user('root') do
|
16
|
+
it { should belong_to_group 'root' }
|
17
|
+
its(:command) { should eq "id root | awk '{print $3}' | grep -- root" }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe user('root') do
|
21
|
+
it { should_not belong_to_group 'invalid-group' }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe user('root') do
|
25
|
+
it { should have_uid 0 }
|
26
|
+
its(:command) { should eq "id root | grep -- \\^uid\\=0\\(" }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe user('root') do
|
30
|
+
it { should_not have_uid 'invalid-uid' }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe user('root') do
|
34
|
+
it { should have_login_shell '/bin/bash' }
|
35
|
+
its(:command) { should eq "getent passwd root | cut -f 7 -d ':' | grep -w -- /bin/bash" }
|
36
|
+
end
|
37
|
+
|
38
|
+
describe user('root') do
|
39
|
+
it { should_not have_login_shell 'invalid-login-shell' }
|
40
|
+
end
|
41
|
+
|
42
|
+
describe user('root') do
|
43
|
+
it { should have_home_directory '/root' }
|
44
|
+
its(:command) { should eq "getent passwd root | cut -f 6 -d ':' | grep -w -- /root" }
|
45
|
+
end
|
46
|
+
|
47
|
+
describe user('root') do
|
48
|
+
it { should_not have_home_directory 'invalid-home-directory' }
|
49
|
+
end
|
50
|
+
|
51
|
+
describe user('root') do
|
52
|
+
it { should have_authorized_key 'ssh-rsa ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH foo@bar.local' }
|
53
|
+
its(:command) { should eq "grep -w -- ssh-rsa\\ ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH ~root/.ssh/authorized_keys" }
|
54
|
+
end
|
55
|
+
|
56
|
+
describe user('root') do
|
57
|
+
it { should_not have_authorized_key 'invalid-key' }
|
58
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Serverspec::Helper::RedHat
|
4
|
+
|
5
|
+
describe 'Serverspec yumrepo matchers of Red Hat family' do
|
6
|
+
describe 'exist' do
|
7
|
+
describe yumrepo('epel') do
|
8
|
+
it { should exist }
|
9
|
+
end
|
10
|
+
|
11
|
+
describe yumrepo('invalid-repository') do
|
12
|
+
it { should_not exist }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'be_enabled' do
|
17
|
+
describe yumrepo('epel') do
|
18
|
+
it { should be_enabled }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe yumrepo('invalid-repository') do
|
22
|
+
it { should_not be_enabled }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Serverspec::Helper::RedHat
|
4
|
+
|
5
|
+
describe zfs('rpool') do
|
6
|
+
it { should exist }
|
7
|
+
its(:command) { should eq "zfs list -H rpool" }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe zfs('rpool') do
|
11
|
+
it { should have_property 'mountpoint' => '/rpool' }
|
12
|
+
its(:command) { should eq "zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe zfs('rpool') do
|
16
|
+
it { should have_property 'mountpoint' => '/rpool', 'compression' => 'off' }
|
17
|
+
its(:command) { should eq "zfs list -H -o compression rpool | grep -- \\^off\\$ && zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
|
18
|
+
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.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- lib/serverspec/backend/powershell/support/is_port_listening.ps1
|
144
144
|
- lib/serverspec/backend/ssh.rb
|
145
145
|
- lib/serverspec/backend/winrm.rb
|
146
|
+
- lib/serverspec/commands/aix.rb
|
146
147
|
- lib/serverspec/commands/base.rb
|
147
148
|
- lib/serverspec/commands/darwin.rb
|
148
149
|
- lib/serverspec/commands/debian.rb
|
@@ -156,6 +157,7 @@ files:
|
|
156
157
|
- lib/serverspec/commands/windows.rb
|
157
158
|
- lib/serverspec/configuration.rb
|
158
159
|
- lib/serverspec/helper.rb
|
160
|
+
- lib/serverspec/helper/aix.rb
|
159
161
|
- lib/serverspec/helper/attributes.rb
|
160
162
|
- lib/serverspec/helper/base.rb
|
161
163
|
- lib/serverspec/helper/cmd.rb
|
@@ -223,6 +225,26 @@ files:
|
|
223
225
|
- lib/serverspec/type/zfs.rb
|
224
226
|
- lib/serverspec/version.rb
|
225
227
|
- serverspec.gemspec
|
228
|
+
- spec/aix/command_spec.rb
|
229
|
+
- spec/aix/commands_spec.rb
|
230
|
+
- spec/aix/cron_spec.rb
|
231
|
+
- spec/aix/default_gateway_spec.rb
|
232
|
+
- spec/aix/file_spec.rb
|
233
|
+
- spec/aix/group_spec.rb
|
234
|
+
- spec/aix/host_spec.rb
|
235
|
+
- spec/aix/interface_spec.rb
|
236
|
+
- spec/aix/iptables_spec.rb
|
237
|
+
- spec/aix/kernel_module_spec.rb
|
238
|
+
- spec/aix/linux_kernel_parameter_spec.rb
|
239
|
+
- spec/aix/package_spec.rb
|
240
|
+
- spec/aix/php_config_spec.rb
|
241
|
+
- spec/aix/port_spec.rb
|
242
|
+
- spec/aix/routing_table_spec.rb
|
243
|
+
- spec/aix/selinux_spec.rb
|
244
|
+
- spec/aix/service_spec.rb
|
245
|
+
- spec/aix/user_spec.rb
|
246
|
+
- spec/aix/yumrepo_spec.rb
|
247
|
+
- spec/aix/zfs_spec.rb
|
226
248
|
- spec/backend/cmd/configuration_spec.rb
|
227
249
|
- spec/backend/exec/build_command_spec.rb
|
228
250
|
- spec/backend/exec/configuration_spec.rb
|
@@ -373,6 +395,26 @@ signing_key:
|
|
373
395
|
specification_version: 4
|
374
396
|
summary: RSpec tests for your servers configured by Puppet, Chef or anything else
|
375
397
|
test_files:
|
398
|
+
- spec/aix/command_spec.rb
|
399
|
+
- spec/aix/commands_spec.rb
|
400
|
+
- spec/aix/cron_spec.rb
|
401
|
+
- spec/aix/default_gateway_spec.rb
|
402
|
+
- spec/aix/file_spec.rb
|
403
|
+
- spec/aix/group_spec.rb
|
404
|
+
- spec/aix/host_spec.rb
|
405
|
+
- spec/aix/interface_spec.rb
|
406
|
+
- spec/aix/iptables_spec.rb
|
407
|
+
- spec/aix/kernel_module_spec.rb
|
408
|
+
- spec/aix/linux_kernel_parameter_spec.rb
|
409
|
+
- spec/aix/package_spec.rb
|
410
|
+
- spec/aix/php_config_spec.rb
|
411
|
+
- spec/aix/port_spec.rb
|
412
|
+
- spec/aix/routing_table_spec.rb
|
413
|
+
- spec/aix/selinux_spec.rb
|
414
|
+
- spec/aix/service_spec.rb
|
415
|
+
- spec/aix/user_spec.rb
|
416
|
+
- spec/aix/yumrepo_spec.rb
|
417
|
+
- spec/aix/zfs_spec.rb
|
376
418
|
- spec/backend/cmd/configuration_spec.rb
|
377
419
|
- spec/backend/exec/build_command_spec.rb
|
378
420
|
- spec/backend/exec/configuration_spec.rb
|