diff options
| author | Luke Kanies <luke@madstop.com> | 2008-01-15 19:41:38 -0800 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-01-15 19:41:38 -0800 |
| commit | 4165edaeb71ee2883b1bb85ff39a52d5628b259f (patch) | |
| tree | af3392f3d72d46c279d531ff4837161260dd91d6 | |
| parent | cfda651f88d12249f29706d2bedbfddce7a2e6f7 (diff) | |
| download | puppet-4165edaeb71ee2883b1bb85ff39a52d5628b259f.tar.gz puppet-4165edaeb71ee2883b1bb85ff39a52d5628b259f.tar.xz puppet-4165edaeb71ee2883b1bb85ff39a52d5628b259f.zip | |
More fixes to the testing.
| -rw-r--r-- | lib/puppet/type/yumrepo.rb | 2 | ||||
| -rwxr-xr-x | lib/puppet/util/filetype.rb | 1 | ||||
| -rwxr-xr-x | test/ral/types/sshkey.rb | 18 | ||||
| -rwxr-xr-x | test/ral/types/yumrepo.rb | 4 |
4 files changed, 11 insertions, 14 deletions
diff --git a/lib/puppet/type/yumrepo.rb b/lib/puppet/type/yumrepo.rb index acb3b9b83..558ad7929 100644 --- a/lib/puppet/type/yumrepo.rb +++ b/lib/puppet/type/yumrepo.rb @@ -181,11 +181,11 @@ module Puppet inifile.store end + # This is only used during testing. def self.clear @inifile = nil @yumconf = "/etc/yum.conf" @defaultrepodir = nil - super end # Return the Puppet::Util::IniConfig::Section for this yumrepo resource diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb index cddfc4689..95f48e10e 100755 --- a/lib/puppet/util/filetype.rb +++ b/lib/puppet/util/filetype.rb @@ -106,6 +106,7 @@ class Puppet::Util::FileType # Overwrite the file. def write(text) backup() + raise("Cannot create file %s in absent directory" % @path) unless FileTest.exist?(File.dirname(@path)) File.open(@path, "w") { |f| f.print text; f.flush } end end diff --git a/test/ral/types/sshkey.rb b/test/ral/types/sshkey.rb index c68e4a271..333bc377d 100755 --- a/test/ral/types/sshkey.rb +++ b/test/ral/types/sshkey.rb @@ -102,18 +102,17 @@ class TestSSHKey < Test::Unit::TestCase def test_moddingkey key = mkkey() - assert_events([:sshkey_created], key) + @catalog.apply key.retrieve aliases = %w{madstop kirby yayness} key[:alias] = aliases - assert_events([:sshkey_changed], key) + @catalog.apply aliases.each do |name| - assert_equal(key, @catalog.resource(:sshkey, name), - "alias was not set") + assert_equal(key.object_id, @catalog.resource(:sshkey, name).object_id, "alias %s was not set" % name) end end @@ -182,16 +181,9 @@ class TestSSHKey < Test::Unit::TestCase # Verify we can retrieve that info assert_nothing_raised("Could not retrieve after second write") { - newkey.provider.class.prefetch - newkey.retrieve + newkey.provider.prefetch } - # And verify that we have data for everything - names.each { |name| - key = @catalog.resource(:sshkey, name) - assert(key, "Could not retrieve key for %s" % name) - assert(key.provider.exists?, "key %s is missing" % name) - } + assert(newkey.provider.exists?, "Did not see key in file") end end - diff --git a/test/ral/types/yumrepo.rb b/test/ral/types/yumrepo.rb index 899a02135..65c4cb50c 100755 --- a/test/ral/types/yumrepo.rb +++ b/test/ral/types/yumrepo.rb @@ -19,6 +19,10 @@ class TestYumRepo < Test::Unit::TestCase Puppet.type(:yumrepo).yumconf = @yumconf end + def teardown + Puppet.type(:yumrepo).clear + end + # Modify one existing section def test_modify copy_datafiles |
