serverspec 0.10.1 → 0.10.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.rb +2 -0
- data/lib/serverspec/backend/exec.rb +2 -0
- data/lib/serverspec/commands/plamo.rb +21 -0
- data/lib/serverspec/helper.rb +1 -0
- data/lib/serverspec/helper/plamo.rb +9 -0
- data/lib/serverspec/version.rb +1 -1
- data/spec/plamo/command_spec.rb +50 -0
- data/spec/plamo/cron_spec.rb +23 -0
- data/spec/plamo/default_gateway_spec.rb +18 -0
- data/spec/plamo/file_spec.rb +397 -0
- data/spec/plamo/group_spec.rb +24 -0
- data/spec/plamo/host_spec.rb +60 -0
- data/spec/plamo/interface_spec.rb +26 -0
- data/spec/plamo/iptables_spec.rb +23 -0
- data/spec/plamo/kernel_module_spec.rb +14 -0
- data/spec/plamo/linux_kernel_parameter_spec.rb +38 -0
- data/spec/plamo/mail_alias_spec.rb +14 -0
- data/spec/plamo/package_spec.rb +102 -0
- data/spec/plamo/php_config_spec.rb +38 -0
- data/spec/plamo/port_spec.rb +32 -0
- data/spec/plamo/routing_table_spec.rb +122 -0
- data/spec/plamo/selinux_spec.rb +20 -0
- data/spec/plamo/service_spec.rb +86 -0
- data/spec/plamo/service_spec.rb.plamo +63 -0
- data/spec/plamo/user_spec.rb +59 -0
- data/spec/plamo/zfs_spec.rb +20 -0
- metadata +44 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a09c5844cbb0f43aaf74184167363bd48cae397
|
4
|
+
data.tar.gz: 28add9f65cc559f6bc36e9d8bb7da7f9120665a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a59a5962b663a92d429e36c8b9454f6e57fb6e2738099c3eaf3fe84bc68f993183ca7f6daac853f679286b4de2b3ed4c71ebd59848eba1ecc01d2eb37c13a5f
|
7
|
+
data.tar.gz: a9efa81fc07f0f88e6f569d57b3ce4d822d52c2ff53e1fe6d6c8101400bf2497007af0436d36193d805655f4951c493163456be7c4570da70d333137835d8929
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'rspec/core/rake_task'
|
|
4
4
|
task :spec => 'spec:all'
|
5
5
|
|
6
6
|
namespace :spec do
|
7
|
-
oses = %w( darwin debian gentoo redhat aix solaris solaris10 solaris11 smartos windows freebsd)
|
7
|
+
oses = %w( darwin debian gentoo plamo redhat aix solaris solaris10 solaris11 smartos windows freebsd)
|
8
8
|
|
9
9
|
task :all => [ oses.map {|os| "spec:#{os}" }, :helpers, :exec, :ssh, :cmd, :winrm, :powershell ].flatten
|
10
10
|
|
data/lib/serverspec.rb
CHANGED
@@ -11,6 +11,7 @@ require 'serverspec/commands/linux'
|
|
11
11
|
require 'serverspec/commands/redhat'
|
12
12
|
require 'serverspec/commands/debian'
|
13
13
|
require 'serverspec/commands/gentoo'
|
14
|
+
require 'serverspec/commands/plamo'
|
14
15
|
require 'serverspec/commands/aix'
|
15
16
|
require 'serverspec/commands/solaris'
|
16
17
|
require 'serverspec/commands/solaris10'
|
@@ -37,6 +38,7 @@ RSpec.configure do |c|
|
|
37
38
|
c.include(Serverspec::Helper::RedHat, :os => :redhat)
|
38
39
|
c.include(Serverspec::Helper::Debian, :os => :debian)
|
39
40
|
c.include(Serverspec::Helper::Gentoo, :os => :gentoo)
|
41
|
+
c.include(Serverspec::Helper::Plamo, :os => :plamo)
|
40
42
|
c.include(Serverspec::Helper::AIX, :os => :aix)
|
41
43
|
c.include(Serverspec::Helper::Solaris, :os => :solaris)
|
42
44
|
c.include(Serverspec::Helper::Solaris10, :os => :solaris10)
|
@@ -175,6 +175,8 @@ module Serverspec
|
|
175
175
|
'Debian'
|
176
176
|
elsif run_command('ls /etc/gentoo-release')[:exit_status] == 0
|
177
177
|
'Gentoo'
|
178
|
+
elsif run_command('ls /usr/lib/setup/Plamo-*')[:exit_status] == 0
|
179
|
+
'Plamo'
|
178
180
|
elsif run_command('uname -s')[:stdout] =~ /AIX/i
|
179
181
|
'AIX'
|
180
182
|
elsif (os = run_command('uname -sr')[:stdout]) && os =~ /SunOS/i
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Serverspec
|
2
|
+
module Commands
|
3
|
+
class Plamo < Linux
|
4
|
+
|
5
|
+
def check_enabled(service, level=3)
|
6
|
+
# This check is not necessarily detected whether service is enabled or not
|
7
|
+
# TODO: check rc.inet2 $SERV variable
|
8
|
+
"test -x /etc/rc.d/init.d/#{escape(service)}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def check_installed(package, version=nil)
|
12
|
+
cmd = "ls /var/log/packages/#{escape(package)}"
|
13
|
+
if version
|
14
|
+
cmd = "#{cmd} && grep -E \"PACKAGE NAME:.+#{escape(package)}-#{escape(version)}\" /var/log/packages/#{escape(package)}"
|
15
|
+
end
|
16
|
+
cmd
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/serverspec/helper.rb
CHANGED
@@ -11,6 +11,7 @@ require 'serverspec/helper/puppet'
|
|
11
11
|
require 'serverspec/helper/redhat'
|
12
12
|
require 'serverspec/helper/debian'
|
13
13
|
require 'serverspec/helper/gentoo'
|
14
|
+
require 'serverspec/helper/plamo'
|
14
15
|
require 'serverspec/helper/aix'
|
15
16
|
require 'serverspec/helper/solaris'
|
16
17
|
require 'serverspec/helper/solaris10'
|
data/lib/serverspec/version.rb
CHANGED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.configure do |c|
|
4
|
+
c.os = 'Plamo'
|
5
|
+
end
|
6
|
+
|
7
|
+
describe command('cat /etc/resolv.conf') do
|
8
|
+
let(:stdout) { "nameserver 127.0.0.1\r\n" }
|
9
|
+
it { should return_stdout("nameserver 127.0.0.1") }
|
10
|
+
its(:command) { should eq 'cat /etc/resolv.conf' }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'complete matching of stdout' do
|
14
|
+
context command('cat /etc/resolv.conf') do
|
15
|
+
let(:stdout) { "foocontent-should-be-includedbar\r\n" }
|
16
|
+
it { should_not return_stdout('content-should-be-included') }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'regexp matching of stdout' do
|
21
|
+
context command('cat /etc/resolv.conf') do
|
22
|
+
let(:stdout) { "nameserver 127.0.0.1\r\n" }
|
23
|
+
it { should return_stdout(/127\.0\.0\.1/) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe command('cat /etc/resolv.conf') do
|
28
|
+
let(:stdout) { "No such file or directory\r\n" }
|
29
|
+
it { should return_stderr("No such file or directory") }
|
30
|
+
its(:command) { should eq 'cat /etc/resolv.conf' }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'complete matching of stderr' do
|
34
|
+
context command('cat /etc/resolv.conf') do
|
35
|
+
let(:stdout) { "No such file or directory\r\n" }
|
36
|
+
it { should_not return_stdout('file') }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'regexp matching of stderr' do
|
41
|
+
context command('cat /etc/resolv.conf') do
|
42
|
+
let(:stdout) { "No such file or directory\r\n" }
|
43
|
+
it { should return_stderr(/file/) }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe command('cat /etc/resolv.conf') do
|
48
|
+
it { should return_exit_status 0 }
|
49
|
+
its(:command) { should eq 'cat /etc/resolv.conf' }
|
50
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.configure do |c|
|
4
|
+
c.os = 'Plamo'
|
5
|
+
end
|
6
|
+
|
7
|
+
describe cron do
|
8
|
+
it { should have_entry '* * * * * /usr/local/bin/batch.sh' }
|
9
|
+
its(:command) { should eq 'crontab -l | grep -- \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ /usr/local/bin/batch.sh' }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe cron do
|
13
|
+
it { should_not have_entry 'invalid entry' }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe cron do
|
17
|
+
it { should have_entry('* * * * * /usr/local/bin/batch.sh').with_user('root') }
|
18
|
+
its(:command) { should eq 'crontab -u root -l | grep -- \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ \\\\\\*\\ /usr/local/bin/batch.sh' }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe cron do
|
22
|
+
it { should_not have_entry('* * * * * /usr/local/bin/batch.sh').with_user('invalid-user') }
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.configure do |c|
|
4
|
+
c.os = 'Plamo'
|
5
|
+
end
|
6
|
+
|
7
|
+
describe default_gateway do
|
8
|
+
let(:stdout) { "default via 192.168.1.1 dev eth1 \r\n" }
|
9
|
+
|
10
|
+
its(:ipaddress) { should eq '192.168.1.1' }
|
11
|
+
its(:command) { should eq "ip route | grep -E '^default |^default '" }
|
12
|
+
|
13
|
+
its(:interface) { should eq 'eth1' }
|
14
|
+
its(:command) { should eq "ip route | grep -E '^default |^default '" }
|
15
|
+
|
16
|
+
its(:ipaddress) { should_not eq '192.168.1.2' }
|
17
|
+
its(:interface) { should_not eq 'eth0' }
|
18
|
+
end
|
@@ -0,0 +1,397 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.configure do |c|
|
4
|
+
c.os = 'Plamo'
|
5
|
+
end
|
6
|
+
|
7
|
+
describe file('/etc/ssh/sshd_config') do
|
8
|
+
it { should be_file }
|
9
|
+
its(:command) { should eq "test -f /etc/ssh/sshd_config" }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe file('/etc/invalid_file') do
|
13
|
+
it { should_not be_file }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe file('/etc/ssh') do
|
17
|
+
it { should be_directory }
|
18
|
+
its(:command) { should eq "test -d /etc/ssh" }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe file('/etc/invalid_directory') do
|
22
|
+
it { should_not be_directory }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe file('/var/run/unicorn.sock') do
|
26
|
+
it { should be_socket }
|
27
|
+
its(:command) { should eq "test -S /var/run/unicorn.sock" }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe file('/etc/invalid_socket') do
|
31
|
+
it { should_not be_socket }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe file('/etc/ssh/sshd_config') do
|
35
|
+
it { should contain 'This is the sshd server system-wide configuration file' }
|
36
|
+
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" }
|
37
|
+
end
|
38
|
+
|
39
|
+
describe file('/etc/ssh/sshd_config') do
|
40
|
+
it { should contain /^This is the sshd server system-wide configuration file/ }
|
41
|
+
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" }
|
42
|
+
end
|
43
|
+
|
44
|
+
describe file('/etc/ssh/sshd_config') do
|
45
|
+
it { should_not contain 'This is invalid text!!' }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe file('Gemfile') do
|
49
|
+
it { should contain('rspec').from(/^group :test do/).to(/^end/) }
|
50
|
+
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 -" }
|
51
|
+
end
|
52
|
+
|
53
|
+
describe file('/etc/ssh/sshd_config') do
|
54
|
+
it { should_not contain('This is invalid text!!').from(/^group :test do/).to(/^end/) }
|
55
|
+
end
|
56
|
+
|
57
|
+
describe file('Gemfile') do
|
58
|
+
it { should contain('rspec').after(/^group :test do/) }
|
59
|
+
its(:command) { should eq "sed -n /\\^group\\ :test\\ do/,\\$p Gemfile | grep -q -- rspec - || sed -n /\\^group\\ :test\\ do/,\\$p Gemfile | grep -qF -- rspec -" }
|
60
|
+
end
|
61
|
+
|
62
|
+
describe file('/etc/ssh/sshd_config') do
|
63
|
+
it { should_not contain('This is invalid text!!').after(/^group :test do/) }
|
64
|
+
end
|
65
|
+
|
66
|
+
describe file('Gemfile') do
|
67
|
+
it { should contain('rspec').before(/^end/) }
|
68
|
+
its(:command) { should eq "sed -n 1,/\\^end/p Gemfile | grep -q -- rspec - || sed -n 1,/\\^end/p Gemfile | grep -qF -- rspec -" }
|
69
|
+
end
|
70
|
+
|
71
|
+
describe file('/etc/ssh/sshd_config') do
|
72
|
+
it { should_not contain('This is invalid text!!').before(/^end/) }
|
73
|
+
end
|
74
|
+
|
75
|
+
describe file('/etc/passwd') do
|
76
|
+
it { should be_mode 644 }
|
77
|
+
its(:command) { should eq "stat -c %a /etc/passwd | grep -- \\^644\\$" }
|
78
|
+
end
|
79
|
+
|
80
|
+
describe file('/etc/passwd') do
|
81
|
+
it { should_not be_mode 'invalid' }
|
82
|
+
end
|
83
|
+
|
84
|
+
describe file('/etc/passwd') do
|
85
|
+
it { should be_owned_by 'root' }
|
86
|
+
its(:command) { should eq "stat -c %U /etc/passwd | grep -- \\^root\\$" }
|
87
|
+
end
|
88
|
+
|
89
|
+
describe file('/etc/passwd') do
|
90
|
+
it { should_not be_owned_by 'invalid-owner' }
|
91
|
+
end
|
92
|
+
|
93
|
+
describe file('/etc/passwd') do
|
94
|
+
it { should be_grouped_into 'root' }
|
95
|
+
its(:command) { should eq "stat -c %G /etc/passwd | grep -- \\^root\\$" }
|
96
|
+
end
|
97
|
+
|
98
|
+
describe file('/etc/passwd') do
|
99
|
+
it { should_not be_grouped_into 'invalid-group' }
|
100
|
+
end
|
101
|
+
|
102
|
+
describe file('/etc/pam.d/system-auth') do
|
103
|
+
it { should be_linked_to '/etc/pam.d/system-auth-ac' }
|
104
|
+
its(:command) { should eq "stat -c %N /etc/pam.d/system-auth | grep -- /etc/pam.d/system-auth-ac" }
|
105
|
+
end
|
106
|
+
|
107
|
+
describe file('dummy-link') do
|
108
|
+
it { should_not be_linked_to '/invalid/target' }
|
109
|
+
end
|
110
|
+
|
111
|
+
describe file('/dev') do
|
112
|
+
let(:stdout) { "755\r\n" }
|
113
|
+
it { should be_readable }
|
114
|
+
its(:command) { should eq "stat -c %a /dev" }
|
115
|
+
end
|
116
|
+
|
117
|
+
describe file('/dev') do
|
118
|
+
let(:stdout) { "333\r\n" }
|
119
|
+
it { should_not be_readable }
|
120
|
+
end
|
121
|
+
|
122
|
+
describe file('/dev') do
|
123
|
+
let(:stdout) { "400\r\n" }
|
124
|
+
it { should be_readable.by('owner') }
|
125
|
+
end
|
126
|
+
|
127
|
+
describe file('/dev') do
|
128
|
+
let(:stdout) { "044\r\n" }
|
129
|
+
it { should_not be_readable.by('owner') }
|
130
|
+
end
|
131
|
+
|
132
|
+
describe file('/dev') do
|
133
|
+
let(:stdout) { "040\r\n" }
|
134
|
+
it { should be_readable.by('group') }
|
135
|
+
end
|
136
|
+
|
137
|
+
describe file('/dev') do
|
138
|
+
let(:stdout) { "404\r\n" }
|
139
|
+
it { should_not be_readable.by('group') }
|
140
|
+
end
|
141
|
+
|
142
|
+
describe file('/dev') do
|
143
|
+
let(:stdout) { "044\r\n" }
|
144
|
+
it { should be_readable.by('others') }
|
145
|
+
end
|
146
|
+
|
147
|
+
describe file('/dev') do
|
148
|
+
let(:stdout) { "443\r\n" }
|
149
|
+
it { should_not be_readable.by('others') }
|
150
|
+
end
|
151
|
+
|
152
|
+
describe file('/tmp') do
|
153
|
+
it { should be_readable.by_user('mail') }
|
154
|
+
its(:command) { should eq "su -s /bin/sh -c \"test -r /tmp\" mail" }
|
155
|
+
end
|
156
|
+
|
157
|
+
describe file('/tmp') do
|
158
|
+
it { should_not be_readable.by_user('invalid-user') }
|
159
|
+
end
|
160
|
+
|
161
|
+
describe file('/dev') do
|
162
|
+
let(:stdout) { "755\r\n" }
|
163
|
+
it { should be_writable }
|
164
|
+
its(:command) { should eq "stat -c %a /dev" }
|
165
|
+
end
|
166
|
+
|
167
|
+
describe file('/dev') do
|
168
|
+
let(:stdout) { "555\r\n" }
|
169
|
+
it { should_not be_writable }
|
170
|
+
end
|
171
|
+
|
172
|
+
describe file('/dev') do
|
173
|
+
let(:stdout) { "200\r\n" }
|
174
|
+
it { should be_writable.by('owner') }
|
175
|
+
end
|
176
|
+
|
177
|
+
describe file('/dev') do
|
178
|
+
let(:stdout) { "555\r\n" }
|
179
|
+
it { should_not be_writable.by('owner') }
|
180
|
+
end
|
181
|
+
|
182
|
+
describe file('/dev') do
|
183
|
+
let(:stdout) { "030\r\n" }
|
184
|
+
it { should be_writable.by('group') }
|
185
|
+
end
|
186
|
+
|
187
|
+
describe file('/dev') do
|
188
|
+
let(:stdout) { "555\r\n" }
|
189
|
+
it { should_not be_writable.by('group') }
|
190
|
+
end
|
191
|
+
|
192
|
+
describe file('/dev') do
|
193
|
+
let(:stdout) { "666\r\n" }
|
194
|
+
it { should be_writable.by('others') }
|
195
|
+
end
|
196
|
+
|
197
|
+
describe file('/dev') do
|
198
|
+
let(:stdout) { "555\r\n" }
|
199
|
+
it { should_not be_writable.by('others') }
|
200
|
+
end
|
201
|
+
|
202
|
+
describe file('/tmp') do
|
203
|
+
it { should be_writable.by_user('mail') }
|
204
|
+
its(:command) { should eq "su -s /bin/sh -c \"test -w /tmp\" mail" }
|
205
|
+
end
|
206
|
+
|
207
|
+
describe file('/tmp') do
|
208
|
+
it { should_not be_writable.by_user('invalid-user') }
|
209
|
+
end
|
210
|
+
|
211
|
+
describe file('/dev') do
|
212
|
+
let(:stdout) { "755\r\n" }
|
213
|
+
it { should be_executable }
|
214
|
+
its(:command) { should eq "stat -c %a /dev" }
|
215
|
+
end
|
216
|
+
|
217
|
+
describe file('/dev') do
|
218
|
+
let(:stdout) { "666\r\n" }
|
219
|
+
it { should_not be_executable }
|
220
|
+
end
|
221
|
+
|
222
|
+
describe file('/dev') do
|
223
|
+
let(:stdout) { "100\r\n" }
|
224
|
+
it { should be_executable.by('owner') }
|
225
|
+
end
|
226
|
+
|
227
|
+
describe file('/dev') do
|
228
|
+
let(:stdout) { "666\r\n" }
|
229
|
+
it { should_not be_executable.by('owner') }
|
230
|
+
end
|
231
|
+
|
232
|
+
describe file('/dev') do
|
233
|
+
let(:stdout) { "070\r\n" }
|
234
|
+
it { should be_executable.by('group') }
|
235
|
+
end
|
236
|
+
|
237
|
+
describe file('/dev') do
|
238
|
+
let(:stdout) { "666\r\n" }
|
239
|
+
it { should_not be_executable.by('group') }
|
240
|
+
end
|
241
|
+
|
242
|
+
describe file('/dev') do
|
243
|
+
let(:stdout) { "001\r\n" }
|
244
|
+
it { should be_executable.by('others') }
|
245
|
+
end
|
246
|
+
|
247
|
+
describe file('/dev') do
|
248
|
+
let(:stdout) { "666\r\n" }
|
249
|
+
it { should_not be_executable.by('others') }
|
250
|
+
end
|
251
|
+
|
252
|
+
describe file('/tmp') do
|
253
|
+
it { should be_executable.by_user('mail') }
|
254
|
+
its(:command) { should eq "su -s /bin/sh -c \"test -x /tmp\" mail" }
|
255
|
+
end
|
256
|
+
|
257
|
+
describe file('/tmp') do
|
258
|
+
it { should_not be_executable.by_user('invalid-user') }
|
259
|
+
end
|
260
|
+
|
261
|
+
describe file('/') do
|
262
|
+
it { should be_mounted }
|
263
|
+
its(:command) { should eq "mount | grep -w -- on\\ /" }
|
264
|
+
end
|
265
|
+
|
266
|
+
describe file('/etc/invalid-mount') do
|
267
|
+
it { should_not be_mounted }
|
268
|
+
end
|
269
|
+
|
270
|
+
describe file('/') do
|
271
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
272
|
+
it { should be_mounted.with( :type => 'ext4' ) }
|
273
|
+
end
|
274
|
+
|
275
|
+
describe file('/') do
|
276
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
277
|
+
it { should be_mounted.with( :type => 'ext4', :options => { :rw => true } ) }
|
278
|
+
end
|
279
|
+
|
280
|
+
describe file('/') do
|
281
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
282
|
+
it { should be_mounted.with( :type => 'ext4', :options => { :mode => 620 } ) }
|
283
|
+
end
|
284
|
+
|
285
|
+
describe file('/') do
|
286
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
287
|
+
it { should be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_root' ) }
|
288
|
+
end
|
289
|
+
|
290
|
+
describe file('/') do
|
291
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
292
|
+
it { should_not be_mounted.with( :type => 'xfs' ) }
|
293
|
+
end
|
294
|
+
|
295
|
+
describe file('/') do
|
296
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
297
|
+
it { should_not be_mounted.with( :type => 'ext4', :options => { :rw => false } ) }
|
298
|
+
end
|
299
|
+
|
300
|
+
describe file('/') do
|
301
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
302
|
+
it { should_not be_mounted.with( :type => 'ext4', :options => { :mode => 600 } ) }
|
303
|
+
end
|
304
|
+
|
305
|
+
describe file('/') do
|
306
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
307
|
+
it { should_not be_mounted.with( :type => 'xfs', :device => '/dev/mapper/VolGroup-lv_root' ) }
|
308
|
+
end
|
309
|
+
|
310
|
+
describe file('/') do
|
311
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
312
|
+
it { should_not be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_r00t' ) }
|
313
|
+
end
|
314
|
+
|
315
|
+
describe file('/etc/invalid-mount') do
|
316
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
317
|
+
it { should_not be_mounted.with( :type => 'ext4' ) }
|
318
|
+
end
|
319
|
+
|
320
|
+
describe file('/') do
|
321
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
322
|
+
it do
|
323
|
+
should be_mounted.only_with(
|
324
|
+
:device => '/dev/mapper/VolGroup-lv_root',
|
325
|
+
:type => 'ext4',
|
326
|
+
:options => {
|
327
|
+
:rw => true,
|
328
|
+
:mode => 620,
|
329
|
+
}
|
330
|
+
)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
describe file('/') do
|
335
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
336
|
+
it do
|
337
|
+
should_not be_mounted.only_with(
|
338
|
+
:device => '/dev/mapper/VolGroup-lv_root',
|
339
|
+
:type => 'ext4',
|
340
|
+
:options => {
|
341
|
+
:rw => true,
|
342
|
+
:mode => 620,
|
343
|
+
:bind => true,
|
344
|
+
}
|
345
|
+
)
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
349
|
+
describe file('/') do
|
350
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
351
|
+
it do
|
352
|
+
should_not be_mounted.only_with(
|
353
|
+
:device => '/dev/mapper/VolGroup-lv_root',
|
354
|
+
:type => 'ext4',
|
355
|
+
:options => {
|
356
|
+
:rw => true,
|
357
|
+
}
|
358
|
+
)
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
describe file('/') do
|
363
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
364
|
+
it do
|
365
|
+
should_not be_mounted.only_with(
|
366
|
+
:device => '/dev/mapper/VolGroup-lv_roooooooooot',
|
367
|
+
:type => 'ext4',
|
368
|
+
:options => {
|
369
|
+
:rw => true,
|
370
|
+
:mode => 620,
|
371
|
+
}
|
372
|
+
)
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
describe file('/etc/invalid-mount') do
|
377
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
378
|
+
it { should_not be_mounted.only_with( :type => 'ext4' ) }
|
379
|
+
end
|
380
|
+
|
381
|
+
describe file('/etc/services') do
|
382
|
+
it { should match_md5checksum '35435ea447c19f0ea5ef971837ab9ced' }
|
383
|
+
its(:command) { should eq "md5sum /etc/services | grep -iw -- \\^35435ea447c19f0ea5ef971837ab9ced" }
|
384
|
+
end
|
385
|
+
|
386
|
+
describe file('invalid-file') do
|
387
|
+
it { should_not match_md5checksum 'INVALIDMD5CHECKSUM' }
|
388
|
+
end
|
389
|
+
|
390
|
+
describe file('/etc/services') do
|
391
|
+
it { should match_sha256checksum '0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a' }
|
392
|
+
its(:command) { should eq "sha256sum /etc/services | grep -iw -- \\^0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a" }
|
393
|
+
end
|
394
|
+
|
395
|
+
describe file('invalid-file') do
|
396
|
+
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
397
|
+
end
|