diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-02-07 02:31:00 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-02-07 02:31:00 +0000 |
| commit | 4ecfa7bf4a0f88334afdec359f317b3bf7b44c21 (patch) | |
| tree | 02dd9e06b7d7dc4ca29aa4523a3ada56c9f1be6c /test | |
| parent | 9114cbe18b11d2a4f3f58c4799f615721f4c2d71 (diff) | |
| download | puppet-4ecfa7bf4a0f88334afdec359f317b3bf7b44c21.tar.gz puppet-4ecfa7bf4a0f88334afdec359f317b3bf7b44c21.tar.xz puppet-4ecfa7bf4a0f88334afdec359f317b3bf7b44c21.zip | |
Config files now seem to work, so I am ready to start incorporating them.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@868 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/other/config.rb | 98 | ||||
| -rw-r--r-- | test/puppettest.rb | 1 |
2 files changed, 96 insertions, 3 deletions
diff --git a/test/other/config.rb b/test/other/config.rb index ae3392edd..639fb38f7 100755 --- a/test/other/config.rb +++ b/test/other/config.rb @@ -24,7 +24,14 @@ class TestConfig < Test::Unit::TestCase c = mkconfig assert_nothing_raised { - c.setdefaults(:booltest => true) + c.setdefaults(:testing, :booltest => true) + } + + assert(c[:booltest]) + c = mkconfig + + assert_nothing_raised { + c.setdefaults(:testing, :booltest => "true") } assert(c[:booltest]) @@ -33,11 +40,98 @@ class TestConfig < Test::Unit::TestCase c[:booltest] = false } - assert(! c[:booltest]) + assert(! c[:booltest], "Booltest is not false") + + assert_nothing_raised { + c[:booltest] = "false" + } + + assert(! c[:booltest], "Booltest is not false") assert_raise(Puppet::Error) { c[:booltest] = "yayness" } + + assert_raise(Puppet::Error) { + c[:booltest] = "/some/file" + } + end + + def test_strings + c = mkconfig + val = "this is a string" + assert_nothing_raised { + c.setdefaults(:testing, :strtest => val) + } + + assert_equal(val, c[:strtest]) + end + + def test_files + c = mkconfig + + parent = "/puppet" + assert_nothing_raised { + c.setdefaults(:testing, :parentdir => parent) + } + + assert_nothing_raised { + c.setdefaults(:testing, :child => "$parent/child") + } + + assert_equal(parent, c[:parentdir]) + assert_equal("/puppet/child", File.join(c[:parentdir], "child")) + end + + def test_getset + c = mkconfig + initial = "an initial value" + assert_nothing_raised { + c[:yayness] = initial + } + assert_equal(initial, c[:yayness]) + + default = "this is a default" + assert_nothing_raised { + c.setdefaults(:testing, :yayness => default) + } + + assert_equal(initial, c[:yayness]) + + assert_nothing_raised { + c.clear + } + + assert_equal(default, c[:yayness]) + + assert_nothing_raised { + c[:yayness] = "not default" + } + assert_equal("not default", c[:yayness]) + end + + def test_parse + text = %{one = this is a test + two = another test + +[section1] + attr = value + attr2 = /some/dir + attr3 = $attr2/other + } + + file = tempfile() + File.open(file, "w") { |f| f.puts text } + + c = mkconfig + + assert_nothing_raised { + c.parse(file) + } + + assert_equal("value", c[:attr]) + assert_equal("/some/dir", c[:attr2]) + assert_equal("/some/dir/other", c[:attr3]) end end diff --git a/test/puppettest.rb b/test/puppettest.rb index ec7b1b104..439e5b085 100644 --- a/test/puppettest.rb +++ b/test/puppettest.rb @@ -80,7 +80,6 @@ module TestPuppet # stop any services that might be hanging around def stopservices - Puppet.info "Clearing services" if stype = Puppet::Type.type(:service) stype.each { |service| service[:running] = false |
