fixtures from Puppetfile in puppetlabs_spec_helper

286 views
Skip to first unread message

Rudy Gevaert

unread,
May 12, 2016, 7:39:36 AM5/12/16
to Puppet Users
Hi,

Does anyone know a way to integrate rspec-puppet and more specific puppetlabs_spec_helper to get its fixtures from a Puppetfile?

It's a PITA to each time update the fixtures file if you update your Puppetfile in your control repo. (Our context is that roles and profiles are located in our puppet control repo and we want to check against the versions of the modules defined in the Puppetfile)

By default we don't run deploy modules with r10k on our local machine.

thanks!

Rob Nelson

unread,
May 12, 2016, 12:17:15 PM5/12/16
to puppet...@googlegroups.com
That's unfortunately a complex task, though it doesn't look it immediately. How are you defining things in your Puppetfile? Are you pulling from git's master, a git tag or branch, or from the forge? Do you want your fixtures to be using HEAD or the specific version in your Puppetfile? If the latter, how can it correlate between forge versions and git branch/tags? I think that complexity has held up anyone from writing a full featured rake task to keep fixtures up to date, at least anything that I've seen advertised publicly.

There are some tools to update the Puppetfile, though - https://github.com/puppetlabs/r10k/blob/master/doc/updating-your-puppetfile.mkd. I wrote the last one, generate-puppetfile, which can create a very naive .fixtures.yml for you, assuming you want to test against HEAD. If you want to do specific versions, you'll have to do something else. PRs accepted :)

--
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/b8b49a24-e238-49e1-8571-0995ebf921c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nan Liu

unread,
May 13, 2016, 11:30:51 AM5/13/16
to Puppet Users
You can do it the other way around, because .fixtures.yml is yaml and Puppetfile is ruby. This basically loads .fixtures.yml and converts it to a working Puppetfile:


Nan 

Rudy Gevaert

unread,
May 17, 2016, 3:52:08 AM5/17/16
to Puppet Users
Hello Rob, thanks for your time


On Thursday, May 12, 2016 at 6:17:15 PM UTC+2, Rob Nelson wrote:
That's unfortunately a complex task, though it doesn't look it immediately. How are you defining things in your Puppetfile? Are you pulling from git's master, a git tag or branch, or from the forge? Do you want your fixtures to be using HEAD or the specific version in your Puppetfile? If the latter, how can it correlate between forge versions and git branch/tags? I think that complexity has held up anyone from writing a full featured rake task to keep fixtures up to date, at least anything that I've seen advertised publicly.


We are using a mixture of:
- forge, with specific version
- git repo with specific commit 
 
There are some tools to update the Puppetfile, though - https://github.com/puppetlabs/r10k/blob/master/doc/updating-your-puppetfile.mkd. I wrote the last one, generate-puppetfile, which can create a very naive .fixtures.yml for you, assuming you want to test against HEAD. If you want to do specific versions, you'll have to do something else. PRs accepted :)

Interesting.  I will inspect it! 

Rudy Gevaert

unread,
May 17, 2016, 3:53:01 AM5/17/16
to Puppet Users


On Friday, May 13, 2016 at 5:30:51 PM UTC+2, Nan Liu wrote:

You can do it the other way around, because .fixtures.yml is yaml and Puppetfile is ruby. This basically loads .fixtures.yml and converts it to a working Puppetfile:


Thanks Nan!  Interesting way to approach the problem. 
Reply all
Reply to author
Forward
0 new messages