Closed alexjfisher closed 8 years ago
I'll look at https://github.com/puppetlabs/puppetlabs_spec_helper#fixtures-examples for samples of how to use the forge modules. Is there any chance you can share your Puppetfile and .fixtures.yml so I have a model to match?
@alexjfisher Bump - can you share those files, or matching snippets, for comparison?
@alexjfisher This works for my needs now, but would like you to verify with your own Puppetfile. You can test this out in the fixtures
branch.
[rnelson0@build03 puppet-generate-puppetfile:fixtures]$ be generate-puppetfile rnelson0/certs rnelson0/local_user -f
Installing modules. This may take a few minutes.
Your Puppetfile has been generated. Copy and paste between the markers:
=======================================================================
forge 'http://forge.puppetlabs.com'
# Modules discovered by generate-puppetfile
mod rnelson0/certs, '0.7.0'
mod rnelson0/local_user, '1.0.8'
=======================================================================
Generating .fixtures.yml using module name profile
[rnelson0@build03 puppet-generate-puppetfile:fixtures]$ cat .fixtures.yml
fixtures:
symlinks:
profile: "#{source_dir}"
forge_modules:
certs:
repo: "rnelson0/certs"
ref: "0.7.0"
local_user:
repo: "rnelson0/local_user"
ref: "1.0.8"
[rnelson0@build03 profile:production±]$ be rake spec_prep
Notice: Preparing to install into /home/rnelson0/puppet/controlrepo/dist/profile/spec/fixtures/modules ...
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
/home/rnelson0/puppet/controlrepo/dist/profile/spec/fixtures/modules
└── rnelson0-certs (v0.7.0)
Notice: Preparing to install into /home/rnelson0/puppet/controlrepo/dist/profile/spec/fixtures/modules ...
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
/home/rnelson0/puppet/controlrepo/dist/profile/spec/fixtures/modules
└── rnelson0-local_user (v1.0.8)
[rnelson0@build03 profile:production±]$ ls spec/fixtures/modules
certs local_user profile
[rnelson0@build03 profile:production±]$ puppet module list --modulepath spec/fixtures/modules
/home/rnelson0/puppet/controlrepo/dist/profile/spec/fixtures/modules
├── rnelson0-certs (v0.7.0)
├── rnelson0-local_user (v1.0.8)
└── rnelson0-profile (v0.1.0)
My use case is spec testing my 'role' module. It'd be great if the exact versions of both git and forge modules that exist in a Puppetfile could be converted in to a .fixtures file that can be used.
My role spec tests are very simple. They just check that each role compiles.