Sha256: cd6199bd42bbf0650151eb30e6d8a1bb85afd2472a3dd0bb7e978bc352435acc
Contents?: true
Size: 1.99 KB
Versions: 10
Compression:
Stored size: 1.99 KB
Contents
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../lib/puppettest' require 'puppet' require 'puppettest' class TestPuppetDefaults < Test::Unit::TestCase include PuppetTest @@dirs = %w{rrddir confdir vardir logdir statedir} @@files = %w{statefile manifest masterlog} @@normals = %w{puppetport masterport server} @@booleans = %w{rrdgraph noop} def testVersion assert( Puppet.version =~ /^[0-9]+(\.[0-9]+)*/, "got invalid version number %s" % Puppet.version ) end def testStringOrParam [@@dirs,@@files,@@booleans].flatten.each { |param| assert_nothing_raised { Puppet[param] } assert_nothing_raised { Puppet[param.intern] } } end def test_valuesForEach [@@dirs,@@files,@@booleans].flatten.each { |param| param = param.intern assert_nothing_raised { Puppet[param] } } end def testValuesForEach [@@dirs,@@files,@@booleans].flatten.each { |param| assert_nothing_raised { Puppet[param] } } end # we don't want user defaults in /, or root defaults in ~ def testDefaultsInCorrectRoots notval = nil if Puppet::Util::SUIDManager.uid == 0 notval = Regexp.new(File.expand_path("~")) else notval = /^\/var|^\/etc/ end [@@dirs,@@files].flatten.each { |param| value = Puppet[param] unless value !~ notval assert_nothing_raised { raise "%s is incorrectly set to %s" % [param,value] } end } end def test_settingdefaults testvals = { :fakeparam => "$confdir/yaytest", :anotherparam => "$vardir/goodtest", :string => "a yay string", :boolean => true } testvals.each { |param, default| assert_nothing_raised { Puppet.setdefaults("testing", param => [default, "a value"]) } } end end
Version data entries
10 entries across 10 versions & 1 rubygems