I am writing a simple cookbook that will be used to deploy an SSL proxy onto a server. This cookbook will ultimately be used by other cookbooks that deploy web services in order to set up an SSL proxy in front of them, but for the purpose of testing the proxy cookbook itself, there is no such service behind it. My basic testing strategy for this cookbook is as follows:
- Converge the box with test-kitchen
- Use ServerSpec (or possibly Bats) with test-kitchen to
- Setup test by starting a python SimpleHTTPServer on the box listing on the port that the proxy was configured to forward to, and create in index.html file for it to serve.
- Assert that when I hit https://localhost I get the file that SimpleHTTPServer is serving.
- Assert a few more things about the proxy (all of which require that there be a service behind it.)
- Teardown. No real need to tear anything down, just let test-kitchen destroy the box.
So my question is, what is the right way to set up these sort of test preconditions using test-kitchen and ServerSpec and/or bats?