serverspec 2.0.0.beta2 → 2.0.0.beta3
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 +4 -4
- data/README.md +7 -6
- data/Rakefile +2 -27
- data/lib/serverspec/helper.rb +0 -1
- data/lib/serverspec/helper/os.rb +2 -0
- data/lib/serverspec/helper/type.rb +1 -1
- data/lib/serverspec/setup.rb +11 -12
- data/lib/serverspec/type/base.rb +2 -1
- data/lib/serverspec/type/cgroup.rb +1 -1
- data/lib/serverspec/type/command.rb +1 -1
- data/lib/serverspec/type/cron.rb +1 -1
- data/lib/serverspec/type/default_gateway.rb +2 -2
- data/lib/serverspec/type/file.rb +22 -22
- data/lib/serverspec/type/group.rb +2 -2
- data/lib/serverspec/type/host.rb +3 -3
- data/lib/serverspec/type/iis_app_pool.rb +2 -2
- data/lib/serverspec/type/iis_website.rb +5 -5
- data/lib/serverspec/type/interface.rb +2 -2
- data/lib/serverspec/type/ipfilter.rb +1 -1
- data/lib/serverspec/type/ipnat.rb +1 -1
- data/lib/serverspec/type/iptables.rb +1 -1
- data/lib/serverspec/type/kernel_module.rb +1 -1
- data/lib/serverspec/type/linux_kernel_parameter.rb +1 -1
- data/lib/serverspec/type/lxc.rb +2 -2
- data/lib/serverspec/type/mail_alias.rb +1 -1
- data/lib/serverspec/type/package.rb +4 -4
- data/lib/serverspec/type/php_config.rb +1 -1
- data/lib/serverspec/type/port.rb +2 -2
- data/lib/serverspec/type/process.rb +2 -2
- data/lib/serverspec/type/routing_table.rb +1 -1
- data/lib/serverspec/type/selinux.rb +3 -3
- data/lib/serverspec/type/service.rb +7 -8
- data/lib/serverspec/type/user.rb +6 -6
- data/lib/serverspec/type/windows_feature.rb +1 -1
- data/lib/serverspec/type/windows_hot_fix.rb +1 -1
- data/lib/serverspec/type/windows_registry_key.rb +4 -4
- data/lib/serverspec/type/windows_scheduled_task.rb +9 -0
- data/lib/serverspec/type/yumrepo.rb +2 -2
- data/lib/serverspec/type/zfs.rb +2 -2
- data/lib/serverspec/version.rb +1 -1
- data/spec/spec_helper.rb +2 -33
- data/spec/type/cgroup_spec.rb +13 -0
- data/spec/type/command_spec.rb +64 -0
- data/spec/type/cron_spec.rb +19 -0
- data/spec/type/default_gateway_spec.rb +14 -0
- data/spec/type/file_spec.rb +392 -0
- data/spec/type/group_spec.rb +19 -0
- data/spec/type/host_spec.rb +56 -0
- data/spec/type/interface_spec.rb +21 -0
- data/spec/type/iptables_spec.rb +19 -0
- data/spec/type/kernel_module_spec.rb +11 -0
- data/spec/type/linux_kernel_parameter_spec.rb +33 -0
- data/spec/type/lxc_spec.rb +20 -0
- data/spec/type/mail_alias_spec.rb +11 -0
- data/spec/type/package_spec.rb +104 -0
- data/spec/type/php_config_spec.rb +33 -0
- data/spec/type/port_spec.rb +27 -0
- data/spec/type/process_spec.rb +35 -0
- data/spec/type/routing_table_spec.rb +118 -0
- data/spec/type/selinux_spec.rb +15 -0
- data/spec/type/service_spec.rb +94 -0
- data/spec/type/user_spec.rb +51 -0
- data/spec/type/yumrepo_spec.rb +25 -0
- data/spec/type/zfs_spec.rb +15 -0
- metadata +49 -3
- data/lib/serverspec/helper/backend.rb +0 -11
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Specinfra::Helper::RedHat
|
4
|
+
|
5
|
+
describe cron do
|
6
|
+
it { should have_entry '* * * * * /usr/local/bin/batch.sh' }
|
7
|
+
end
|
8
|
+
|
9
|
+
describe cron do
|
10
|
+
it { should_not have_entry 'invalid entry' }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe cron do
|
14
|
+
it { should have_entry('* * * * * /usr/local/bin/batch.sh').with_user('root') }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe cron do
|
18
|
+
it { should_not have_entry('* * * * * /usr/local/bin/batch.sh').with_user('invalid-user') }
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Specinfra::Helper::RedHat
|
4
|
+
|
5
|
+
describe default_gateway do
|
6
|
+
let(:stdout) { "default via 192.168.1.1 dev eth1 \r\n" }
|
7
|
+
|
8
|
+
its(:ipaddress) { should eq '192.168.1.1' }
|
9
|
+
|
10
|
+
its(:interface) { should eq 'eth1' }
|
11
|
+
|
12
|
+
its(:ipaddress) { should_not eq '192.168.1.2' }
|
13
|
+
its(:interface) { should_not eq 'eth0' }
|
14
|
+
end
|
@@ -0,0 +1,392 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Specinfra::Helper::RedHat
|
4
|
+
|
5
|
+
describe file('/etc/ssh/sshd_config') do
|
6
|
+
it { should be_file }
|
7
|
+
end
|
8
|
+
|
9
|
+
describe file('/etc/invalid_file') do
|
10
|
+
it { should_not be_file }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe file('/etc/ssh') do
|
14
|
+
it { should be_directory }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe file('/etc/invalid_directory') do
|
18
|
+
it { should_not be_directory }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe file('/var/run/unicorn.sock') do
|
22
|
+
it { should be_socket }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe file('/etc/invalid_socket') do
|
26
|
+
it { should_not be_socket }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe file('/etc/ssh/sshd_config') do
|
30
|
+
it { should contain 'This is the sshd server system-wide configuration file' }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe file('/etc/ssh/sshd_config') do
|
34
|
+
it { should contain /^This is the sshd server system-wide configuration file/ }
|
35
|
+
end
|
36
|
+
|
37
|
+
describe file('/etc/ssh/sshd_config') do
|
38
|
+
it { should_not contain 'This is invalid text!!' }
|
39
|
+
end
|
40
|
+
|
41
|
+
describe file('Gemfile') do
|
42
|
+
it { should contain('rspec').from(/^group :test do/).to(/^end/) }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe file('/etc/ssh/sshd_config') do
|
46
|
+
it { should_not contain('This is invalid text!!').from(/^group :test do/).to(/^end/) }
|
47
|
+
end
|
48
|
+
|
49
|
+
describe file('Gemfile') do
|
50
|
+
it { should contain('rspec').after(/^group :test do/) }
|
51
|
+
end
|
52
|
+
|
53
|
+
describe file('/etc/ssh/sshd_config') do
|
54
|
+
it { should_not contain('This is invalid text!!').after(/^group :test do/) }
|
55
|
+
end
|
56
|
+
|
57
|
+
describe file('Gemfile') do
|
58
|
+
it { should contain('rspec').before(/^end/) }
|
59
|
+
end
|
60
|
+
|
61
|
+
describe file('/etc/ssh/sshd_config') do
|
62
|
+
it { should_not contain('This is invalid text!!').before(/^end/) }
|
63
|
+
end
|
64
|
+
|
65
|
+
describe file('/etc/passwd') do
|
66
|
+
it { should be_mode 644 }
|
67
|
+
end
|
68
|
+
|
69
|
+
describe file('/etc/passwd') do
|
70
|
+
it { should_not be_mode 'invalid' }
|
71
|
+
end
|
72
|
+
|
73
|
+
describe file('/etc/passwd') do
|
74
|
+
it { should be_owned_by 'root' }
|
75
|
+
end
|
76
|
+
|
77
|
+
describe file('/etc/passwd') do
|
78
|
+
it { should_not be_owned_by 'invalid-owner' }
|
79
|
+
end
|
80
|
+
|
81
|
+
describe file('/etc/passwd') do
|
82
|
+
it { should be_grouped_into 'root' }
|
83
|
+
end
|
84
|
+
|
85
|
+
describe file('/etc/passwd') do
|
86
|
+
it { should_not be_grouped_into 'invalid-group' }
|
87
|
+
end
|
88
|
+
|
89
|
+
describe file('/etc/pam.d/system-auth') do
|
90
|
+
it { should be_linked_to '/etc/pam.d/system-auth-ac' }
|
91
|
+
end
|
92
|
+
|
93
|
+
describe file('dummy-link') do
|
94
|
+
it { should_not be_linked_to '/invalid/target' }
|
95
|
+
end
|
96
|
+
|
97
|
+
describe file('/dev') do
|
98
|
+
let(:stdout) { "755\r\n" }
|
99
|
+
it { should be_readable }
|
100
|
+
end
|
101
|
+
|
102
|
+
describe file('/dev') do
|
103
|
+
let(:stdout) { "333\r\n" }
|
104
|
+
it { should_not be_readable }
|
105
|
+
end
|
106
|
+
|
107
|
+
describe file('/dev') do
|
108
|
+
let(:stdout) { "400\r\n" }
|
109
|
+
it { should be_readable.by('owner') }
|
110
|
+
end
|
111
|
+
|
112
|
+
describe file('/dev') do
|
113
|
+
let(:stdout) { "044\r\n" }
|
114
|
+
it { should_not be_readable.by('owner') }
|
115
|
+
end
|
116
|
+
|
117
|
+
describe file('/dev') do
|
118
|
+
let(:stdout) { "040\r\n" }
|
119
|
+
it { should be_readable.by('group') }
|
120
|
+
end
|
121
|
+
|
122
|
+
describe file('/dev') do
|
123
|
+
let(:stdout) { "404\r\n" }
|
124
|
+
it { should_not be_readable.by('group') }
|
125
|
+
end
|
126
|
+
|
127
|
+
describe file('/dev') do
|
128
|
+
let(:stdout) { "044\r\n" }
|
129
|
+
it { should be_readable.by('others') }
|
130
|
+
end
|
131
|
+
|
132
|
+
describe file('/dev') do
|
133
|
+
let(:stdout) { "443\r\n" }
|
134
|
+
it { should_not be_readable.by('others') }
|
135
|
+
end
|
136
|
+
|
137
|
+
describe file('/tmp') do
|
138
|
+
it { should be_readable.by_user('mail') }
|
139
|
+
end
|
140
|
+
|
141
|
+
describe file('/tmp') do
|
142
|
+
it { should_not be_readable.by_user('invalid-user') }
|
143
|
+
end
|
144
|
+
|
145
|
+
describe file('/dev') do
|
146
|
+
let(:stdout) { "755\r\n" }
|
147
|
+
it { should be_writable }
|
148
|
+
end
|
149
|
+
|
150
|
+
describe file('/dev') do
|
151
|
+
let(:stdout) { "555\r\n" }
|
152
|
+
it { should_not be_writable }
|
153
|
+
end
|
154
|
+
|
155
|
+
describe file('/dev') do
|
156
|
+
let(:stdout) { "200\r\n" }
|
157
|
+
it { should be_writable.by('owner') }
|
158
|
+
end
|
159
|
+
|
160
|
+
describe file('/dev') do
|
161
|
+
let(:stdout) { "555\r\n" }
|
162
|
+
it { should_not be_writable.by('owner') }
|
163
|
+
end
|
164
|
+
|
165
|
+
describe file('/dev') do
|
166
|
+
let(:stdout) { "030\r\n" }
|
167
|
+
it { should be_writable.by('group') }
|
168
|
+
end
|
169
|
+
|
170
|
+
describe file('/dev') do
|
171
|
+
let(:stdout) { "555\r\n" }
|
172
|
+
it { should_not be_writable.by('group') }
|
173
|
+
end
|
174
|
+
|
175
|
+
describe file('/dev') do
|
176
|
+
let(:stdout) { "666\r\n" }
|
177
|
+
it { should be_writable.by('others') }
|
178
|
+
end
|
179
|
+
|
180
|
+
describe file('/dev') do
|
181
|
+
let(:stdout) { "555\r\n" }
|
182
|
+
it { should_not be_writable.by('others') }
|
183
|
+
end
|
184
|
+
|
185
|
+
describe file('/tmp') do
|
186
|
+
it { should be_writable.by_user('mail') }
|
187
|
+
end
|
188
|
+
|
189
|
+
describe file('/tmp') do
|
190
|
+
it { should_not be_writable.by_user('invalid-user') }
|
191
|
+
end
|
192
|
+
|
193
|
+
describe file('/dev') do
|
194
|
+
let(:stdout) { "755\r\n" }
|
195
|
+
it { should be_executable }
|
196
|
+
end
|
197
|
+
|
198
|
+
describe file('/dev') do
|
199
|
+
let(:stdout) { "666\r\n" }
|
200
|
+
it { should_not be_executable }
|
201
|
+
end
|
202
|
+
|
203
|
+
describe file('/dev') do
|
204
|
+
let(:stdout) { "100\r\n" }
|
205
|
+
it { should be_executable.by('owner') }
|
206
|
+
end
|
207
|
+
|
208
|
+
describe file('/dev') do
|
209
|
+
let(:stdout) { "666\r\n" }
|
210
|
+
it { should_not be_executable.by('owner') }
|
211
|
+
end
|
212
|
+
|
213
|
+
describe file('/dev') do
|
214
|
+
let(:stdout) { "070\r\n" }
|
215
|
+
it { should be_executable.by('group') }
|
216
|
+
end
|
217
|
+
|
218
|
+
describe file('/dev') do
|
219
|
+
let(:stdout) { "666\r\n" }
|
220
|
+
it { should_not be_executable.by('group') }
|
221
|
+
end
|
222
|
+
|
223
|
+
describe file('/dev') do
|
224
|
+
let(:stdout) { "001\r\n" }
|
225
|
+
it { should be_executable.by('others') }
|
226
|
+
end
|
227
|
+
|
228
|
+
describe file('/dev') do
|
229
|
+
let(:stdout) { "666\r\n" }
|
230
|
+
it { should_not be_executable.by('others') }
|
231
|
+
end
|
232
|
+
|
233
|
+
describe file('/tmp') do
|
234
|
+
it { should be_executable.by_user('mail') }
|
235
|
+
end
|
236
|
+
|
237
|
+
describe file('/tmp') do
|
238
|
+
it { should_not be_executable.by_user('invalid-user') }
|
239
|
+
end
|
240
|
+
|
241
|
+
describe file('/') do
|
242
|
+
it { should be_mounted }
|
243
|
+
end
|
244
|
+
|
245
|
+
describe file('/etc/invalid-mount') do
|
246
|
+
it { should_not be_mounted }
|
247
|
+
end
|
248
|
+
|
249
|
+
describe file('/') do
|
250
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
251
|
+
it { should be_mounted.with( :type => 'ext4' ) }
|
252
|
+
end
|
253
|
+
|
254
|
+
describe file('/') do
|
255
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
256
|
+
it { should be_mounted.with( :type => 'ext4', :options => { :rw => true } ) }
|
257
|
+
end
|
258
|
+
|
259
|
+
describe file('/') do
|
260
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
261
|
+
it { should be_mounted.with( :type => 'ext4', :options => { :mode => 620 } ) }
|
262
|
+
end
|
263
|
+
|
264
|
+
describe file('/') do
|
265
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
266
|
+
it { should be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_root' ) }
|
267
|
+
end
|
268
|
+
|
269
|
+
describe file('/') do
|
270
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
271
|
+
it { should_not be_mounted.with( :type => 'xfs' ) }
|
272
|
+
end
|
273
|
+
|
274
|
+
describe file('/') do
|
275
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
276
|
+
it { should_not be_mounted.with( :type => 'ext4', :options => { :rw => false } ) }
|
277
|
+
end
|
278
|
+
|
279
|
+
describe file('/') do
|
280
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
281
|
+
it { should_not be_mounted.with( :type => 'ext4', :options => { :mode => 600 } ) }
|
282
|
+
end
|
283
|
+
|
284
|
+
describe file('/') do
|
285
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
286
|
+
it { should_not be_mounted.with( :type => 'xfs', :device => '/dev/mapper/VolGroup-lv_root' ) }
|
287
|
+
end
|
288
|
+
|
289
|
+
describe file('/') do
|
290
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
291
|
+
it { should_not be_mounted.with( :type => 'ext4', :device => '/dev/mapper/VolGroup-lv_r00t' ) }
|
292
|
+
end
|
293
|
+
|
294
|
+
describe file('/etc/invalid-mount') do
|
295
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
296
|
+
it { should_not be_mounted.with( :type => 'ext4' ) }
|
297
|
+
end
|
298
|
+
|
299
|
+
describe file('/') do
|
300
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
301
|
+
it do
|
302
|
+
should be_mounted.only_with(
|
303
|
+
:device => '/dev/mapper/VolGroup-lv_root',
|
304
|
+
:type => 'ext4',
|
305
|
+
:options => {
|
306
|
+
:rw => true,
|
307
|
+
:mode => 620,
|
308
|
+
}
|
309
|
+
)
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
describe file('/') do
|
314
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
315
|
+
it do
|
316
|
+
should_not be_mounted.only_with(
|
317
|
+
:device => '/dev/mapper/VolGroup-lv_root',
|
318
|
+
:type => 'ext4',
|
319
|
+
:options => {
|
320
|
+
:rw => true,
|
321
|
+
:mode => 620,
|
322
|
+
:bind => true,
|
323
|
+
}
|
324
|
+
)
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
describe file('/') do
|
329
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
330
|
+
it do
|
331
|
+
should_not be_mounted.only_with(
|
332
|
+
:device => '/dev/mapper/VolGroup-lv_root',
|
333
|
+
:type => 'ext4',
|
334
|
+
:options => {
|
335
|
+
:rw => true,
|
336
|
+
}
|
337
|
+
)
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
describe file('/') do
|
342
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
343
|
+
it do
|
344
|
+
should_not be_mounted.only_with(
|
345
|
+
:device => '/dev/mapper/VolGroup-lv_roooooooooot',
|
346
|
+
:type => 'ext4',
|
347
|
+
:options => {
|
348
|
+
:rw => true,
|
349
|
+
:mode => 620,
|
350
|
+
}
|
351
|
+
)
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
describe file('/etc/invalid-mount') do
|
356
|
+
let(:stdout) { "/dev/mapper/VolGroup-lv_root on / type ext4 (rw,mode=620)\r\n" }
|
357
|
+
it { should_not be_mounted.only_with( :type => 'ext4' ) }
|
358
|
+
end
|
359
|
+
|
360
|
+
describe file('/etc/services') do
|
361
|
+
it { should match_md5checksum '35435ea447c19f0ea5ef971837ab9ced' }
|
362
|
+
end
|
363
|
+
|
364
|
+
describe file('invalid-file') do
|
365
|
+
it { should_not match_md5checksum 'INVALIDMD5CHECKSUM' }
|
366
|
+
end
|
367
|
+
|
368
|
+
describe file('/etc/services') do
|
369
|
+
it { should match_sha256checksum '0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a' }
|
370
|
+
end
|
371
|
+
|
372
|
+
describe file('invalid-file') do
|
373
|
+
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
374
|
+
end
|
375
|
+
|
376
|
+
describe file('/etc/passwd') do
|
377
|
+
let(:stdout) {<<EOF
|
378
|
+
root:x:0:0:root:/root:/bin/bash
|
379
|
+
bin:x:1:1:bin:/bin:/sbin/nologin
|
380
|
+
daemon:x:2:2:daemon:/sbin:/sbin/nologin
|
381
|
+
sync:x:5:0:sync:/sbin:/bin/sync
|
382
|
+
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
|
383
|
+
halt:x:7:0:halt:/sbin:/sbin/halt
|
384
|
+
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
|
385
|
+
operator:x:11:0:operator:/root:/sbin/nologin
|
386
|
+
nobody:x:99:99:Nobody:/:/sbin/nologin
|
387
|
+
dbus:x:81:81:System message bus:/:/sbin/nologin
|
388
|
+
EOF
|
389
|
+
}
|
390
|
+
|
391
|
+
its(:content) { should match /root:x:0:0/ }
|
392
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Specinfra::Helper::RedHat
|
4
|
+
|
5
|
+
describe group('root') do
|
6
|
+
it { should exist }
|
7
|
+
end
|
8
|
+
|
9
|
+
describe group('invalid-group') do
|
10
|
+
it { should_not exist }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe group('root') do
|
14
|
+
it { should have_gid 0 }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe group('root') do
|
18
|
+
it { should_not have_gid 'invalid-gid' }
|
19
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Specinfra::Helper::RedHat
|
4
|
+
|
5
|
+
describe host('127.0.0.1') do
|
6
|
+
it { should be_resolvable }
|
7
|
+
end
|
8
|
+
|
9
|
+
describe host('invalid-name') do
|
10
|
+
it { should_not be_resolvable }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe host('127.0.0.1') do
|
14
|
+
it { should be_resolvable.by('hosts') }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe host('invalid-name') do
|
18
|
+
it { should_not be_resolvable.by('hosts') }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe host('127.0.0.1') do
|
22
|
+
it { should be_resolvable.by('dns') }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe host('invalid-name') do
|
26
|
+
it { should_not be_resolvable.by('dns') }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe host('127.0.0.1') do
|
30
|
+
it { should be_reachable }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe host('invalid-host') do
|
34
|
+
it { should_not be_reachable }
|
35
|
+
end
|
36
|
+
|
37
|
+
describe host('127.0.0.1') do
|
38
|
+
it { should be_reachable.with(:proto => "icmp", :timeout=> 1) }
|
39
|
+
end
|
40
|
+
|
41
|
+
describe host('127.0.0.1') do
|
42
|
+
it { should be_reachable.with(:proto => "tcp", :port => 22, :timeout=> 1) }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe host('127.0.0.1') do
|
46
|
+
it { should be_reachable.with(:proto => "udp", :port => 53, :timeout=> 1) }
|
47
|
+
end
|
48
|
+
|
49
|
+
describe host('invalid-host') do
|
50
|
+
it { should_not be_reachable.with(:proto => "udp", :port => 53, :timeout=> 1) }
|
51
|
+
end
|
52
|
+
|
53
|
+
describe host('example.jp') do
|
54
|
+
let(:stdout) { "1.2.3.4\r\n" }
|
55
|
+
its(:ipaddress) { should eq '1.2.3.4' }
|
56
|
+
end
|