e9370fee7b
This patch includes some very basic and initial unit testing using rspec-puppet and for the case of facts, just normal rspec. I've taken a very light approach here as rspec-puppet can be quite combinatorial when one gets carried away. For now I've just added basic compile failure detection effectively for classes and defined resources. As we continue to work on the code and find regressions this work can be expanded. For facts and functions I've also taken a basic approach for now. One little thing I did change, was the strange string that the fact returns when the default version is undefined. Instead of an error message I've just returned the string 'unknown' which is more in line with other facts I've seen in the wild, and to be quite honest 'unknown' is fairly self-explantory. Since a fact isn't an error reporting message this seemed more appropriate, and looked nicer in the rspec test. As far as travis-ci support, I've added the same configuration that @jmmcune came up with for stdlib which is pretty light and reasonable standard now we propogated that to 4 or so other modules in the puppetlabs/ namespace. It should work out of the box. Signed-off-by: Ken Barber <ken@bob.sh>
21 lines
1,005 B
Ruby
21 lines
1,005 B
Ruby
def apply_common_vagrant_config(config)
|
|
# Resolve DNS via NAT
|
|
config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
|
|
|
# Share the various required modules
|
|
# TODO: it would be better to install this via the puppet module tool
|
|
config.vm.share_folder "puppetlabs-stdlib-module", "/usr/share/puppet/modules/stdlib", "../../../../../puppetlabs-stdlib"
|
|
config.vm.share_folder "puppetlabs-apt-module", "/usr/share/puppet/modules/apt", "../../../../../puppetlabs-apt"
|
|
|
|
# Share the postgressql module
|
|
config.vm.share_folder "puppet-postgresql-module", "/usr/share/puppet/modules/postgresql", "../../../.."
|
|
|
|
# Share the module of test classes
|
|
config.vm.share_folder "puppet-postgresql-tests", "/usr/share/puppet/modules/postgresql_tests", "../../test_module"
|
|
|
|
# Provision with a base puppet config just so we don't have to repeat the puppet user/group
|
|
config.vm.provision :puppet do |puppet|
|
|
puppet.manifests_path = "../../"
|
|
puppet.manifest_file = "base.pp"
|
|
end
|
|
end
|