Puppet Module Testing With External Module Dependencies

From Kyle's Wiki
Jump to: navigation, search

Setup Fixtures

Say you have a module Foo that depends on the concat module. Your .fixtures.yml file would look like:

fixtures:
  repositories:
    concat: "git://github.com/puppetlabs/puppetlabs-concat.git"
  symlinks:
    foo: "#{source_dir}"

Example: concat facts

At this point you would get errors because of the missing facts:

     Failure/Error: )
     Puppet::Error:
       $concat_basedir not defined. Try running again with pluginsync=true on the [master] and/or [main] section of your node's '/etc/puppet/puppet.conf'. at /home/kyle/Projects/puppet_modules/btsync/spec/fixtures/modules/concat/manifests/setup.pp:30 on node remina
     # ./spec/classes/btsync_spec.rb:7:in `block (2 levels) in <top (required)>'

On any spec, you must setup this fact for the concat module to work:

    let :facts do
      {
        :osfamily               => 'Debian',
        :concat_basedir         => '/dne',
      }
    end
Personal tools
Namespaces

Variants
Actions
Efforts
Toolbox
Meta