diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-18 03:43:48 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-18 03:43:48 +0000 |
| commit | d77d6d4f9ec20c830c4e9ed34c8e2f1197386f4c (patch) | |
| tree | 45586ffa96a086414c8b729757ce3b61fca7534e /test | |
| parent | f1ebef038b12231e876510c7247a82f6367a8d45 (diff) | |
| download | puppet-d77d6d4f9ec20c830c4e9ed34c8e2f1197386f4c.tar.gz puppet-d77d6d4f9ec20c830c4e9ed34c8e2f1197386f4c.tar.xz puppet-d77d6d4f9ec20c830c4e9ed34c8e2f1197386f4c.zip | |
Adding prefetch of providers to transactions. Nothing is using it yet. I wrote it for cron jobs, but it is too much work to fix this for cron jobs right now.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1806 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/other/transactions.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/other/transactions.rb b/test/other/transactions.rb index dc654994e..3abc84f1b 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -52,6 +52,44 @@ class TestTransactions < Test::Unit::TestCase end end + def test_prefetch + # Create a type just for testing prefetch + name = :prefetchtesting + $prefetched = false + type = Puppet::Type.newtype(name) do + newparam(:name) {} + end + + # Now create a provider + type.provide(:prefetch) do + def self.prefetch + $prefetched = true + end + end + + # Now create an instance + inst = type.create :name => "yay" + + + # Create a transaction + trans = Puppet::Transaction.new([inst]) + + # Make sure prefetch works + assert_nothing_raised do + trans.prefetch + end + + assert_equal(true, $prefetched, "type prefetch was not called") + + # Now make sure it gets called from within evaluate() + $prefetched = false + assert_nothing_raised do + trans.evaluate + end + + assert_equal(true, $prefetched, "evaluate did not call prefetch") + end + def test_refreshes_generate_events path = tempfile() firstpath = tempfile() |
