We have learnt how to setup tests with ServerSpec in Quick start for ServerSpec and Testinfra, also comparison of them, but the folder structure can only support testing against one host. In the real world, we need to reuse the tests to test against multiple hosts, so we will see how we can do that.
ServerSpec setup is completed according to the steps in Quick start for ServerSpec and Testinfra, also comparison of them.
Actually we only need to change the Rakefile in the test folder. And its content should be changed to following:
host2 are the hosts we would like to run our tests against, the reason we put
host_server in above lines is because we have the folder named “host_server” in our test scripts structure.
You can reference the script here.