From 955a8ff876e6476dd88b3502a8fa958180d0e0da Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Tue, 17 Jun 2008 09:46:47 +1000 Subject: Removed test/util/loadedfile.rb tests which fixes #1370 --- test/util/loadedfile.rb | 121 ------------------------------------------------ 1 file changed, 121 deletions(-) delete mode 100755 test/util/loadedfile.rb (limited to 'test') diff --git a/test/util/loadedfile.rb b/test/util/loadedfile.rb deleted file mode 100755 index fb640466a..000000000 --- a/test/util/loadedfile.rb +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env ruby - -require File.dirname(__FILE__) + '/../lib/puppettest' - -require 'puppet' -require 'puppet/util/loadedfile' -require 'puppettest' - -class TestLoadedFile < Test::Unit::TestCase - include PuppetTest - def test_file - Puppet[:filetimeout] = 0 - file = nil - path = tempfile() - File.open(path, "w") { |f| f.puts "yayness" } - assert_nothing_raised { - file = Puppet::Util::LoadedFile.new(path) - } - - assert(!file.changed?, "File incorrectly returned changed") - - File.open(path, "w") { |f| f.puts "booness" } - #file.tstamp = File.stat(path).ctime - 5 - new = File.stat(path).ctime - 5 - file.tstamp = new - - assert(file.changed?, "File did not catch change") - end - - def test_timeout - Puppet[:filetimeout] = 50 - path = tempfile() - - File.open(path, "w") { |f| f.puts "yay" } - file = nil - assert_nothing_raised { - file = Puppet::Util::LoadedFile.new(path) - } - - assert_nothing_raised { - assert(!file.changed?, - "File thought it changed immediately") - } - - sleep 1 - File.open(path, "w") { |f| f.puts "yay" } - #file.tstamp = File.stat(path).ctime - 5 - - assert(!file.changed?, - "File was marked as changed too soon") - - Puppet[:filetimeout] = 0 - assert(file.changed?, - "File was not marked as changed soon enough") - end - - def test_stamp - file = tempfile() - File.open(file, "w") { |f| f.puts "" } - obj = nil - assert_nothing_raised { - obj = Puppet::Util::LoadedFile.new(file) - } - - # Make sure we don't refresh - Puppet[:filetimeout] = 50 - - stamp = File.stat(file).ctime - - assert_equal(stamp, obj.stamp) - - sleep 1 - # Now change the file, and make sure the stamp doesn't update yet - File.open(file, "w") { |f| f.puts "" } - assert_equal(stamp, obj.stamp, - "File prematurely refreshed") - - Puppet[:filetimeout] = 0 - assert_equal(File.stat(file).ctime, obj.stamp, - "File did not refresh") - end - - # Testing #394. - def test_changed_missing_file - file = tempfile() - File.open(file, "w") { |f| f.puts "" } - obj = nil - assert_nothing_raised { - obj = Puppet::Util::LoadedFile.new(file) - } - Puppet[:filetimeout] = -10 - - assert_nothing_raised { - obj.changed? - } - - # Now remove the file - File.unlink(file) - - assert_nothing_raised("removed file threw an error") { - assert(obj.changed?, "File was not considered changed when missing") - } - end - - # Make sure negative values always result in change notifications. - def test_negative_always_changes - file = tempfile() - File.open(file, "w") { |f| f.puts "" } - obj = nil - assert_nothing_raised { - obj = Puppet::Util::LoadedFile.new(file) - } - - assert(! obj.changed?, "file with no change considered changed") - # Now set a negative value - Puppet[:filetimeout] = -1 - - assert(obj.changed?, "negative file timeout did not disable checking") - end -end - -- cgit From 00182ff96f18b54aa659a1909c23ba1aba253cd8 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Tue, 17 Jun 2008 00:53:30 -0500 Subject: Fixed #707 - special '@reboot'-style cron jobs work again. --- test/ral/providers/cron/crontab.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/ral/providers/cron/crontab.rb b/test/ral/providers/cron/crontab.rb index 900a0478e..d9f460258 100755 --- a/test/ral/providers/cron/crontab.rb +++ b/test/ral/providers/cron/crontab.rb @@ -530,8 +530,6 @@ class TestCronParsedProvider < Test::Unit::TestCase @provider.initvars str += "\n" target.write(str) - assert_equal(str, target.read, - "Did not write correctly") assert_nothing_raised("Could not prefetch with %s" % str.inspect) do @provider.prefetch end @@ -551,6 +549,11 @@ class TestCronParsedProvider < Test::Unit::TestCase end end + # #707 + def test_write_freebsd_special + assert_equal(@provider.to_line(:record_type => :crontab, :ensure => :present, :special => "reboot", :command => "/bin/echo something"), "@reboot /bin/echo something") + end + def test_prefetch cron = @type.create :command => "/bin/echo yay", :name => "test", :hour => 4 @@ -626,6 +629,4 @@ class TestCronParsedProvider < Test::Unit::TestCase assert_equal(v, is[p], "did not parse %s correctly" % p) end end - end - -- cgit From ee9d0025eeebda1522d450b5bd3cda769d7455d5 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Tue, 1 Jul 2008 12:57:56 -0500 Subject: Fixed #1114 - Facts in plugin directories should now be autoloaded, as long as you're using Facter 1.5. --- test/network/client/master.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/network/client/master.rb b/test/network/client/master.rb index 9f71247fa..0c1405217 100755 --- a/test/network/client/master.rb +++ b/test/network/client/master.rb @@ -177,10 +177,12 @@ end assert(File.exists?(destfile), "Did not get fact") - assert_equal(hostname, Facter.value(:hostname), + facts = Puppet::Network::Client.master.facts + + assert_equal(hostname, facts["hostname"], "Lost value to hostname") - assert_equal("yayness", Facter.value(:myfact), + assert_equal("yayness", facts["myfact"], "Did not get correct fact value") # Now modify the file and make sure the type is replaced @@ -194,20 +196,22 @@ end assert_nothing_raised { Puppet::Network::Client.master.getfacts } + facts = Puppet::Network::Client.master.facts - assert_equal("funtest", Facter.value(:myfact), + assert_equal("funtest", facts["myfact"], "Did not reload fact") - assert_equal(hostname, Facter.value(:hostname), + assert_equal(hostname, facts["hostname"], "Lost value to hostname") # Now run it again and make sure the fact still loads assert_nothing_raised { Puppet::Network::Client.master.getfacts } + facts = Puppet::Network::Client.master.facts - assert_equal("funtest", Facter.value(:myfact), + assert_equal("funtest", facts["myfact"], "Did not reload fact") - assert_equal(hostname, Facter.value(:hostname), + assert_equal(hostname, facts["hostname"], "Lost value to hostname") end -- cgit