Wazuh-ansible: adding molecule tests

Created on 10 Jan 2019  ·  13Comments  ·  Source: wazuh/wazuh-ansible

It would be convenient to have molecule scenarios to verify the roles works as expected. Such scenarios could run on every pull request via Travis CI and reduce the works required from reviewers.

test

Most helpful comment

Hi @manuasir

Is there a way/need that I can help/assist with adding molecule? If so, let me know.

I know my Ossec roles needs some love as well, but maybe https://github.com/dj-wasabi/ansible-ossec-agent/tree/master/molecule/default and https://github.com/dj-wasabi/ansible-ossec-server/tree/master/molecule/default helps?

All 13 comments

Unless someone is already doing this I'm willing to give it a try.

I was thinking the same. I'm actually using Test-Kitchen (https://kitchen.ci) atm.
This creates VMs in AWS for me for different platforms we're using here, configures them, runs InSpec tests, reports, and then tears them down. Is Molecule similar in that regard?

@paulcalabro yes. With the upside that molecule is now widely adopted as a test method for roles since it became part of the ansible project.

Happy to learn something new. If folks are onboard, let's give it a whirl!

One thought I just had is testing across Wazuh projects, like Wazuh Puppet. It might make sense to use something that supports multiple configuration mgmt languages. Might not matter. Either way works for me.

FWIW we use both test-kitchen and molecule for testing our ansible work https://github.com/gsa/datagov-deploy.

While test-kitchen is great for testing puppet/chef and that yes it does support ansible; molecule is much better at running with a docker based setup and is purpose-built for ansible as we've learned through using both. If you decide to go with test-kitchen here are some great examples of using test-kitchen to support multiple configuration management solutions: https://github.com/dev-sec

If that PR is useful happy to work more on it

Thanks for the insight as well as sharing those repos @JJediny. I'll make sure to check them out. Also, I had no idea about data.gov. That's pretty awesome. I think I might have some fun with that!

Hello @paulcalabro, @JJediny and @singuliere ,

We're planning to add tests on each repository (wazuh-chef, wazuh-puppet and wazuh-ansible) very soon, so we will try your molecule PR for ansible.
I'd like to thank you guys for your amazing work on this repository, your collaboration is very valuable for us.

Cheers

Hi @manuasir

Is there a way/need that I can help/assist with adding molecule? If so, let me know.

I know my Ossec roles needs some love as well, but maybe https://github.com/dj-wasabi/ansible-ossec-agent/tree/master/molecule/default and https://github.com/dj-wasabi/ansible-ossec-server/tree/master/molecule/default helps?

Hello @dj-wasabi ,

You're always welcome to open a new PR adding new improvements, features, and tests. We're currently testing this PR https://github.com/wazuh/wazuh-ansible/pull/151 , if you wanted to add more tests to it, it would be really awesome. Thanks!

Hi @singuliere / @manuasir

Do you want to use a single scenario (With several containers started, where all of the roles are applied on) or multiple ones (A scenario for each role for example) with Molecule.

But I will create a PR, it might be a "big" one to make sure you can run Molecule without any errors (Seems some linting issues, some packages are not installed while they are required, etc).

Thanks @dj-wasabi ! It could be interesting to explore the idea of having multiple scenarios, but any contribution of your choice will be much appreciated.

I think we can already close this issue.
Thanks a lot to @JJediny , who kindly contributed to add the first molecule structure (https://github.com/wazuh/wazuh-ansible/pull/151), and of course thanks a lot to @dj-wasabi for the awesome work adding the different testing scenarios (https://github.com/wazuh/wazuh-ansible/pull/169, https://github.com/wazuh/wazuh-ansible/pull/174 and https://github.com/wazuh/wazuh-ansible/pull/179). Your efforts and great work for making these Ansible components better and more reliable are really much appreciated.

Don't hesitate to open a new issue whenever you may consider it.

Regards

Was this page helpful?
0 / 5 - 0 ratings