Problem

I found myself with the task of not only adding some Apache rewrite/redirect rules to a site configuration, but also TESTING that the created rules had the expected results. These rules would be moving from Varnish to Apache HTTPD, and Varnish had provided us with varnishtest as a means of testing the rules that were in the Varnish configuration. To my knowledge, Apache’s httpd software does not provide anything similar.

Solution

In order solve this issue, I created a method for pytest to tie into the YAML file used by Ansible for creating the redirects in order to generate tests that Molecule could run. It requires some custom configuration to Molecule and the test instance, but it seems to address the issue, and I’m pretty proud of it. I’ve created a GitHub repository named molecule-apache-rewrite-tests to store an example of this solution. See the README.md for more details.