-
Notifications
You must be signed in to change notification settings - Fork 202
Closed
Description
In spacedog/puppet-wireguard#21 I've implemented support for Deferred functions. To make this complete, I'd like to test the functionally with rspec-puppet. After some discussion in #testing and #office-hours on the community Slack 2 solutions got found:
- Implement the testing based on manifest fixtures as suggested by @michaeltlombardi. Similar to what has been done in https://github.com/rodjek/rspec-puppet/pull/743/files#diff-fd749db586cffafe2365831dcc04992c for the initial Deferred support.
- Loading the Type somehow through
a_scope.call_function("new", Puppet::Pops::Types::TypeFactory.deferred(), "myfunc", [1,2,3])as suggested by @hlindberg.
Both solutions are, in my eyes, rather complicated to implemented for a core functionality of Puppet and I would love to see and easier way of doing this.
context "with private_key => Deferred('wireguard::genprivatekey', ['/etc/wireguard/wg0.key'])," do
let(:params) do
{
private_key: Deferred('wireguard::genprivatekey', ['/etc/wireguard/wg0.key']),
listen_port: 12345,
}
end
it { is_expected.to compile.with_all_deps }
it do
is_expected.to contain_file('/etc/wireguard/wg0.conf').with({
content: Deferred('inline_epp', [file('wireguard/interface.conf.epp'), $config])
})
end
endThanks! :)
Metadata
Metadata
Assignees
Labels
No labels