I have a puppet module that I am not sure hot to write a test for: Example below:
class appsuite (
$param1,
$param2,
$param3,
$param4,
) {
include appsuite::params
include appsuite::repo
include appsuite::preconfig
}
#nothing in params, repo or preconfig really matter, other then preconfig lays down a shared settings file: /etc/appsuite/settings
# /etc/appsuite/settings is required to be in place during the install of any component of appsuite as it is sued to do its own setup.
So then I have a seperate class
class appsuite::component1 (
$component_param1,
$component_param2,
) {
...
package { 'component1': ensure => installed }
...
}
Now, class appsuite::component1 requires appsuite to be defined and all those classes to be ran before it starts all it's magic. How do I test that?
I got this
describe 'appsuite' do
context "test appsuite" do
let :params do {
param1 = 'blah1',
param2 = 'blah2',
param3 = 'blah3',
param4 = 'blah4',
}
end
it
{ is_expected.to contain_file('/etc/appsuite/settings').with({'mode' => '0644'}) } end
end
Now the above works fine, but I do not understand how to then call appsuite::component1 from that test with those parameters, I tried nesting in the descibe, but it then says i need to pass params to appsuite. Seems like this would be a pretty common thing to do so I hope I am just missing something.
Any ideas?
Thanks
Trey