When using rspec-puopet we mock the puppetdb_query function.
Example can be found here: 
https://github.com/rodjek/rspec-puppet/issues/102#issuecomment-35568335

hth,
Martin


> On 17. Jul 2018, at 17:54, Russell Anderson <[email protected]> wrote:
> 
> Hopefully someone here can point me at the right solution.  I'd like to 
> include this puppetdb_query command in our suite of rspec tests, but can't 
> seem to get the right package requirements.  Please note, this isn't using 
> the Dalen mod, but rather the puppetdb api.
> 
> Code in question, functional on a test system:
> 
> 75: $_nodes = puppetdb_query("nodes[certname] {certname in 
> inventory[certname] {resources {type = 'Service' and title = 'alfresco'} } 
> and deactivated is null and expired is null}")
> 76: warning($_nodes)
> 
> On the test system, this produces a list of nodes as expected.  However, I 
> can't find the right combination of gems or ubuntu packages to get rspec to 
> pass.  I've tried adding a few gems by hand, so the list below is longer than 
> usual:
> 
> $ gem list --local | grep puppet
> md-puppetdb-terminus (2.0.0.3)
> ml-puppetdb-terminus (3.2.1.1)
> puppet (5.5.0)
> puppet-lint (2.3.6)
> puppet-strings (2.1.0)
> puppet-syntax (2.4.1)
> puppetdb-ruby (1.1.1)
> puppetdb-terminus (1.0)
> puppetdb_query (0.1.2)
> puppetlabs_spec_helper (2.9.1)
> quixoten-puppetdb-terminus (4.3.0)
> rspec-puppet (2.6.14)
> ruby-puppetdb (3.0.1)
> semantic_puppet (1.0.2)
> 
> error during compilation: Evaluation Error: Unknown function: 
> 'puppetdb_query'. (file: blah/blah/blah.pp, line: 75, column: 13)
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/3f545c61-fb83-4d36-a236-0f145780ba7b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/E8836061-3BA4-4AC2-908A-329ED382717B%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to