Information Technology Reference
In-Depth Information
The
set
statement lets us configure how
serverspec
runs. In this case, we set the
:backend
property to
:exec
to tell
serverspec
that the test code will be running on the
same machine as where it is being evaluated.
Tests are written using the RSpec DSL using
describe
and
it
statements. In this case,
we're using the RSpec DSL to write a test that checks to see if our website is listening on
port 80 using the TCP protocol (the standard port/protocol for an HTTP website).
We'll go over the RSpec DSL and test syntax in more detail in
RSpec DSL Syntax
. For now,
just accept that this is the syntax to specify a test that checks to see if something is listening
on port 80.
In order to run this test code, you first need to make sure all the necessary gem files are
loaded on the test node. We do that with the
kitchen setup
command. Go ahead and run
kitchen setup
now:
$
kitchen setup
-----> Starting Kitchen (v1.2.1)
-----> Setting up <default-centos65>...
Fetching: thor-0.19.0.gem (100%)
Fetching: busser-0.6.2.gem (100%)
Successfully installed thor-0.19.0
Successfully installed busser-0.6.2
2 gems installed
-----> Setting up Busser
Creating BUSSER_ROOT in /tmp/busser
Creating busser binstub
Plugin serverspec installed (version 0.4.0)
-----> Running postinstall for serverspec plugin
Finished setting up <default-centos65> (0m14.02s).
-----> Kitchen is finished. (0m14.64s)
When the
kitchen setup
command runs, it inspects the directory structure in the
test/integ-
ration/<suite>/<plugin>
subfolder on your development host. Test Kitchen will then load
any plugins required for testing
in your sandbox instance
as indicated by the
<plugin>
dir-
ectory name. Because we created the directory subfolder
test/integration/default/serverspec
,
Test Kitchen makes sure that the test node has all the necessary libraries and gems for run-
ning
serverspec
tests.