diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-01-28 23:40:50 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-01-28 23:40:50 +0000 |
| commit | dd502db3a976ef6b5091d9cb514427a5de21ff8f (patch) | |
| tree | 1ee5bfcc22ba025b5c73f39a012794026221b7b8 /test | |
| parent | bf46e7d363bbedc683abd63ab159ed170803009a (diff) | |
Fixing #113. I added support in the transaction for self-refreshing, which just creates a special trigger for resources that have self-refreshing enabled. Logging is a bit different for them, so it is clear why they are refreshing. I still need to verify the remount methods work in the providers.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2107 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/other/transactions.rb | 25 | ||||
| -rwxr-xr-x | test/types/mount.rb | 28 |
2 files changed, 49 insertions, 4 deletions
diff --git a/test/other/transactions.rb b/test/other/transactions.rb index 308bcfeea..c9d0cec1c 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -1002,6 +1002,31 @@ class TestTransactions < Test::Unit::TestCase assert_apply(obj) end + + def test_self_refresh_causes_triggering + type = Puppet::Type.newtype(:refresher, :self_refresh => true) do + attr_accessor :refreshed, :testing + newparam(:name) {} + newstate(:testing) do + def sync + self.is = self.should + :ran_testing + end + end + def refresh + @refreshed = true + end + end + cleanup { Puppet::Type.rmtype(:refresher)} + + obj = type.create(:name => "yay", :testing => "cool") + + assert(! obj.insync?, "fake object is already in sync") + + # Now make sure it gets refreshed when the change happens + assert_apply(obj) + assert(obj.refreshed, "object was not refreshed during transaction") + end end # $Id$ diff --git a/test/types/mount.rb b/test/types/mount.rb index 949253b5e..df1a71d71 100755 --- a/test/types/mount.rb +++ b/test/types/mount.rb @@ -94,10 +94,7 @@ class TestMounts < Test::Unit::TestCase } [@mount.validstates, @mount.parameters].flatten.each do |field| - next if field == :path - next if field == :provider - next if field == :target - next if field == :ensure + next if [:path, :provider, :target, :ensure, :remounts].include?(field) unless args.include? field args[field] = "fake%s" % @pcount end @@ -266,6 +263,29 @@ class TestMounts < Test::Unit::TestCase assert_equal("mount_path", mount[:name], "Name did not get copied over") end + + def test_refresh + mount = mkmount + + remounted = false + mount.provider.meta_def(:remount) do + remounted = true + end + + # First make sure we correctly call the provider + assert_nothing_raised do + mount.refresh + end + assert(remounted, "did not call remount on provider") + + # then make sure it gets called during transactions + remounted = false + mount[:device] = "/dev/yayness" + + assert_apply(mount) + + assert(remounted, "did not remount when mount changed") + end end # $Id$ |
