Test::Puppet::Compile - Puppet catalog testing
use Test::Puppet::Compile; my $TPC = Test::Puppet::Compile::->new({ 'name' => 'synopsis', 'manifests' => [glob 'manifests/*.pp'], 'basedir' => `pwd`, 'tpldir' => '/your/template/dir', # must contain: hiera.yaml.tt, node.yaml.tt and puppet.conf.tt 'reqenvs' => [qw(development staging superlive)], 'moduledirs' => [qw(modules supermodules services subservices)], 'warnings' => 1, 'domainpattern' => [ { match => qr/^int-/, domain => 'integrationdomain', } ], 'defaultdomain' => 'localdomain', }); $TPC->test();
After successfull initializtation call this method to detect all nodes and compile a catalog for each node.
See the synopsis
If you want to simulate another OS just copy all templates to a directory of your choice and adjust them acording to your needs.
Then set tpldir to point to that directory.
Because I'm most prolific with perl.
Because it does lots of computations.
Some performance hints:
Your temp directory, usually /tmp, should be located on a sufficiently large ramdisk
You should split your tests into multiple t files, each testing on environment, and process them w/ forkprove, e.g. forkprove -j<NUMCORES> -MMoose -MTest::More -MTest::Puppet::Compile t/
Dominik Schulz <dominik.schulz@gauner.org>
This software is copyright (c) 2013 by Dominik Schulz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Test::Puppet::Compile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Puppet::Compile
CPAN shell
perl -MCPAN -e shell install Test::Puppet::Compile
For more information on module installation, please visit the detailed CPAN module installation guide.