summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-06-18 21:56:11 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-06-18 21:56:11 +0000
commit01420acae6d02a54dcc1f1a823fac2b73e8353dc (patch)
treefd40e59673befbb6f47e1c0f3f03e698b86a5963 /test
parentfa39488560cac2d71461931ab4174387234137ea (diff)
Adding tracing to prefetch failures, and Fixing the environment support in the cron type (#669).
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2621 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/ral/providers/cron/crontab.rb50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/ral/providers/cron/crontab.rb b/test/ral/providers/cron/crontab.rb
index 53327be9a..790a63de8 100755
--- a/test/ral/providers/cron/crontab.rb
+++ b/test/ral/providers/cron/crontab.rb
@@ -342,6 +342,56 @@ class TestCronParsedProvider < Test::Unit::TestCase
@provider.clear
end
end
+
+ def test_prefetch
+ cron = @type.create :command => "/bin/echo yay", :name => "test", :hour => 4
+
+ assert_nothing_raised("Could not prefetch cron") do
+ cron.provider.class.prefetch("test" => cron)
+ end
+ end
+
+ # Testing #669.
+ def test_environment_settings
+ @provider.filetype = :ram
+ setme
+
+ target = @provider.target_object(@me)
+
+ # First with no env settings
+ cron = @type.create :command => "/bin/echo yay", :name => "test", :hour => 4
+
+ assert_apply(cron)
+
+ props = cron.retrieve.inject({}) { |hash, ary| hash[ary[0]] = ary[1]; hash }
+
+ # Now set the env
+ cron[:environment] = "TEST=foo"
+ assert_apply(cron)
+
+ props = cron.retrieve.inject({}) { |hash, ary| hash[ary[0]] = ary[1]; hash }
+ assert(target.read.include?("TEST=foo"), "Did not get environment setting")
+ #assert_equal(["TEST=foo"], props[:environment], "Did not get environment setting")
+
+ # Modify it
+ cron[:environment] = ["TEST=foo", "BLAH=yay"]
+ assert_apply(cron)
+
+ props = cron.retrieve.inject({}) { |hash, ary| hash[ary[0]] = ary[1]; hash }
+ assert(target.read.include?("TEST=foo"), "Did not keep environment setting")
+ assert(target.read.include?("BLAH=yay"), "Did not get second environment setting")
+ #assert_equal(["TEST=foo", "BLAH=yay"], props[:environment], "Did not modify environment setting")
+
+ # And remove it
+ cron[:environment] = :absent
+ assert_apply(cron)
+
+ props = cron.retrieve.inject({}) { |hash, ary| hash[ary[0]] = ary[1]; hash }
+ assert(! target.read.include?("TEST=foo"), "Did not remove environment setting")
+ assert(! target.read.include?("BLAH=yay"), "Did not remove second environment setting")
+ #assert_nil(props[:environment], "Did not modify environment setting")
+
+ end
end
# $Id$