rodjek/rspec-puppet

Mock up exported resources from PuppetDB

kg4zow opened this issue · 0 comments

Is there a way to mock up resources which would have been exported to PuppetDB by other nodes, so that the "collecting" of those resources can be tested? https://pastebin.com/USd0BinG illustrates what I'm trying to do.

In the real world, the target machines (the ones which are being monitored by nagios) export the tests they need done, and the nagios server collects them to build its nagios config files.

I am able to test that the target machines are exporting their resources using tests like:

it { expect(exported_resources).to contain_nagios_host( 'thisbox.domain.xyz' ) }

However, I haven't been able to find a way to test the "collecting" part of it, other than just throwing the exported resources (without @@) into a :pre_condition... which doesn't really test the "collecting" functionality, it just tests for typos between the :pre_condition and the it{} blocks in the test.

If there's not already a way to do this, please consider this a feature request.