From 0b95a8528e554df07efe970c9ecfc34535d17c92 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Thu, 10 Jun 2010 20:31:34 -0700 Subject: Working #3139 - scheduling moved to resource harness We previously had the schedule checking code in Puppet::Type, but it's more of a transactional function, and in order to do proper auditing in the transactional area, we need the cache checking done there. Scheduling is one of the few functions that actually uses cached data currently. Signed-off-by: Luke Kanies --- test/ral/manager/type.rb | 50 ------------------------------------------------ 1 file changed, 50 deletions(-) (limited to 'test') diff --git a/test/ral/manager/type.rb b/test/ral/manager/type.rb index 8b146b613..e373cde30 100755 --- a/test/ral/manager/type.rb +++ b/test/ral/manager/type.rb @@ -315,54 +315,4 @@ class TestType < Test::Unit::TestCase exec = Puppet::Type.newexec(:title => "yay", :command => "/bin/echo yay") assert_equal("Exec[yay]", exec.ref) end - - # Partially test #704, but also cover the rest of the schedule management bases. - def test_schedule - schedule = Puppet::Type.type(:schedule).new(:name => "maint") - catalog = mk_catalog(schedule) - - {"maint" => true, nil => false, :fail => :fail}.each do |name, should| - args = {:name => tempfile, :ensure => :file} - if name - args[:schedule] = name - end - resource = Puppet::Type.type(:file).new(args) - catalog.add_resource(resource) - - if should == :fail - assert_raise(Puppet::Error, "Did not fail on missing schedule") do - resource.schedule - end - elsif should == false - assert_nil(resource.schedule, "Set the schedule tho it is set to nil") - else - sched = nil - assert_nothing_raised("Failed when schedule was %s" % sched) do - sched = resource.schedule - end - - assert(sched, "Did not find schedule %s" % sched.inspect) - - if should - assert_equal(name, sched.name, "did not get correct schedule back") - end - end - catalog.remove_resource(resource) - end - end - - # #801 -- resources only checked in noop should be rescheduled immediately. - def test_reschedule_when_noop - Puppet::Type.type(:schedule).mkdefaultschedules - file = Puppet::Type.type(:file).new(:path => "/tmp/whatever", :mode => "755", :noop => true, :schedule => :daily, :ensure => :file) - catalog = Puppet::Resource::Catalog.new - catalog.add_resource - - assert(file.noop?, "File not considered in noop") - assert(file.scheduled?, "File is not considered scheduled") - - catalog.apply - - assert(file.scheduled?, "File is not considered scheduled even though only a noop run was made") - end end -- cgit