I want to test my control repo (having profiles and roles in it) with rspec-puppet and beaker-rspec. I am still having some trouble with beaker-rspec:
- I would like to test the profiles individually, for example
profile::postgresql
and see if the database has been installed. - Then I would also like to test my roles individually, e.g.
role::fileserver
orrole::webserver
.
I have set-up beaker-rspec and it works, but it takes a considerable amount of time because it will apply all the profiles one after another. I see the following problems in this:
- If too many profiles get applied to the Vagrant VM, it will get polluted (leftover packages, files etc. from another run, so that the test is not representative anymore)
- Some profiles do not have anything in common or might even contradict them (e.g. nginx vs. apache; they will never be in one role, but are both defined in the control-repo).
What I rather would do is:
- beaker-rspec should check which roles have been defined and then spin up an individual virtual machine for each of the roles.
- These should be done either serially or (better) in parallel.
- How can I reduce the time for each run, especially if having a rather large Puppet setup with multiple roles and different OS versions etc. Maybe select the type of tests (“only role tests” or “only profile tests”).
It would also be ok if beaker-rspec tested every profile in a new VM (but then I would like to switch of the tests for other usage).
How can I accomplish this? Thanks :)