Information Technology Reference
In-Depth Information
--default-path /tmp/busser/suites/serverspec
web site
responds on port 80
returns eth1 in the HTML body
has apache installed
Finished in 0.03944 seconds
3 examples, 0 failures
Finished verifying <default-centos65> (0m1.25s).
-----> Kitchen is finished. (0m1.74s)
If for some reason we need to tell Serverspec that we are specifically running CentOS 6 be-
cause of issues with a command, we can add the following
set
line as shown in
set
:os
,
:family
=>
'redhat'
,
:release
=>
6
CentOS is in the RedHat family of operating systems. Specifying a
:release
attribute is op-
tional.
Example 16-9. chefdk/apache-test/test/integration/default/serverspec/default_spec.rb
require
'spec_helper'
set
:os
,
:family
=>
'redhat'
,
:release
=>
6
describe
'web site'
ddo
it
'responds on port 80'
ddo
expect
(
port
80
)
.
to be_listening
'tcp'
end
end
it
'returns eth1 in the HTML body'
ddo
expect
(
command
(
'curl localhost:80'
)
.
stdout
)
.
to match
/eth1/
end
end
it
'has the apache web server installed'
ddo
expect
(
package
'httpd'
)
.
to be_installed
end
end
end
end