Spec testing and dalen-puppetdbquery

81 views
Skip to first unread message

Peter Berghold

unread,
Nov 1, 2016, 4:04:10 PM11/1/16
to puppet-users
I have a module that I am writing spec tests for that uses the Puppet Forge module cited in the subject line to query for a list of nodes fitting a particular criteria.  When I run the spec test it bombs out with a message: "cannot load such file -- puppet/util/puppetdb"

After a bit of searching I am still left wondering package or gem this is looking for.  Anybody know? 

Garrett Honeycutt

unread,
Nov 1, 2016, 5:25:34 PM11/1/16
to puppet...@googlegroups.com
Hi,

Do you have dalen/puppet-puppetdbquery in your .fixtures.yml? A link to
your project would make debugging easier.

Best regards,
-g


--
Garrett Honeycutt
@learnpuppet
Puppet Training with LearnPuppet.com
Mobile: +1.206.414.8658

Andrew Grimberg

unread,
Nov 1, 2016, 5:38:05 PM11/1/16
to puppet...@googlegroups.com
On 11/01/2016 02:25 PM, Garrett Honeycutt wrote:
> On 11/1/16 4:03 PM, Peter Berghold wrote:
>> I have a module that I am writing spec tests for that uses the Puppet
>> Forge module cited in the subject line to query for a list of nodes
>> fitting a particular criteria. When I run the spec test it bombs out
>> with a message: "cannot load such file -- puppet/util/puppetdb"
>>
>> After a bit of searching I am still left wondering package or gem this
>> is looking for. Anybody know?
>>
>
> Hi,
>
> Do you have dalen/puppet-puppetdbquery in your .fixtures.yml? A link to
> your project would make debugging easier.

It's probably related to the fact that dalen-puppetdbquery requires
PuppetDB Terminus installed. Not certain how you get around that for
spec tests.

-Andy-

signature.asc

Peter Berghold

unread,
Nov 1, 2016, 6:11:52 PM11/1/16
to puppet...@googlegroups.com
That's what I was beginning to suspect Andy.  Now I have to go find the Ubuntu version of that....

--
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 puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/ea142093-9c29-2fe2-8202-0ae09709ef21%40bardicgrove.org.
For more options, visit https://groups.google.com/d/optout.

Peter Berghold

unread,
Nov 1, 2016, 6:13:03 PM11/1/16
to puppet...@googlegroups.com
Garret:  I do have dalen-puppetdb in my .fixtures.yaml file.   A link to my project?  unfortunately I'm developing all this work inside my client's cloud and can't provide a link.

Jordan Conway

unread,
Dec 19, 2016, 12:23:22 PM12/19/16
to Puppet Users
I was running into the same issue with that module, and I found that including the puppetdb mock class from the source module helped.
It may be more involved, but at first glance, this helps me quiet a bunch of the errors to get down to spec testing my actual module.

Cheers,
Jordan

Erik Dalén

unread,
Mar 30, 2017, 4:02:29 PM3/30/17
to Puppet Users
A bit late to the party here, but in my (rspec-puppet) tests I have created a mock version of the function in a before(:each) block in the unit test for the class, like this:

  before(:each) do
    Puppet::Parser::Functions.newfunction(:query_nodes, :type => :rvalue) { |_| ["foo.example.com", "bar.example.com"] }
  end



Reply all
Reply to author
Forward
0 new messages