Serverspec and Testinfra are some ways to test your infrastructure configuration code. Molecule is somewhat of a newer system that could possibly be useful. And now we have another name in our game: Inspec. Inspec supports Serverspec-style testing, but it is better and provides other doodads and widgets that I am not entirely familiar with. Nevertheless, our team is using it.
20190531/https://www.inspec.io/