diff options
author | Luke Kanies <luke@madstop.com> | 2005-05-30 03:08:16 +0000 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2005-05-30 03:08:16 +0000 |
commit | d42efbeb2b2772d8286756a2aedb40604a1b7f11 (patch) | |
tree | 3dd8f283a6c85e52256bd50d0ee9d3df146557a8 /test | |
parent | 0ab9685383bc21d9903a06d62a01f6cb72d25610 (diff) | |
download | puppet-d42efbeb2b2772d8286756a2aedb40604a1b7f11.tar.gz puppet-d42efbeb2b2772d8286756a2aedb40604a1b7f11.tar.xz puppet-d42efbeb2b2772d8286756a2aedb40604a1b7f11.zip |
done some more work on making components act like normal objects, but now i need to figure out how to spread events up the tree, rather than just point to point
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@284 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rw-r--r-- | test/other/tc_transactions.rb | 65 | ||||
-rw-r--r-- | test/types/tc_basic.rb | 2 | ||||
-rw-r--r-- | test/types/tc_query.rb | 12 |
3 files changed, 70 insertions, 9 deletions
diff --git a/test/other/tc_transactions.rb b/test/other/tc_transactions.rb index 710ee5a16..1ac5b4edb 100644 --- a/test/other/tc_transactions.rb +++ b/test/other/tc_transactions.rb @@ -24,6 +24,8 @@ class TestTransactions < Test::Unit::TestCase assert_nothing_raised() { Blink::Type.allclear } + + print "\n\n" end def newfile @@ -54,10 +56,10 @@ class TestTransactions < Test::Unit::TestCase } end - def newcomp(*args) + def newcomp(name,*args) comp = nil assert_nothing_raised() { - comp = Blink::Component.new + comp = Blink::Component.new(:name => name) } args.each { |arg| @@ -84,7 +86,7 @@ class TestTransactions < Test::Unit::TestCase states[state] = file[state] } - component = newcomp(file) + component = newcomp("file",file) assert_nothing_raised() { file[:group] = @groups[1] file[:mode] = "755" @@ -113,7 +115,7 @@ class TestTransactions < Test::Unit::TestCase service = newservice service[:check] = [:running] - component = newcomp(service) + component = newcomp("service",service) assert_nothing_raised() { service.retrieve @@ -150,7 +152,7 @@ class TestTransactions < Test::Unit::TestCase service[:running] = 1 service.sync - component = newcomp(file,service) + component = newcomp("both",file,service) # 'requires' expects an array of arrays service[:require] = [[file.class.name,file.name]] @@ -169,6 +171,7 @@ class TestTransactions < Test::Unit::TestCase } assert_nothing_raised() { transaction = component.evaluate + transaction.toplevel = true } # this should cause a restart of the service @@ -185,7 +188,59 @@ class TestTransactions < Test::Unit::TestCase } file.sync } + end + + def test_twocomps + transaction = nil + file = newfile() + service = newservice() + states = {} + check = [:group,:mode] + file[:check] = check + + service[:running] = 1 + service.sync + + fcomp = newcomp("file",file) + scomp = newcomp("service",service) + + component = newcomp("both",fcomp,scomp) + + # 'requires' expects an array of arrays + #component[:require] = [[file.class.name,file.name]] + service[:require] = [[fcomp.class.name,fcomp.name]] + + assert_nothing_raised() { + file.retrieve + service.retrieve + } + + check.each { |state| + states[state] = file[state] + } + assert_nothing_raised() { + file[:group] = @groups[1] + file[:mode] = "755" + } + assert_nothing_raised() { + transaction = component.evaluate + transaction.toplevel = true + } + # this should cause a restart of the service + assert_nothing_raised() { + transaction.evaluate + } + + # now set everything back to how it was + assert_nothing_raised() { + service[:running] = 0 + service.sync + check.each { |state| + file[state] = states[state] + } + file.sync + } end end diff --git a/test/types/tc_basic.rb b/test/types/tc_basic.rb index b67cc0599..eed483e5d 100644 --- a/test/types/tc_basic.rb +++ b/test/types/tc_basic.rb @@ -21,7 +21,7 @@ class TestBasic < Test::Unit::TestCase Blink[:debug] = 1 assert_nothing_raised() { - @component = Blink::Component.new + @component = Blink::Component.new(:name => "component") } assert_nothing_raised() { diff --git a/test/types/tc_query.rb b/test/types/tc_query.rb index 9b18b86ac..66fb50b05 100644 --- a/test/types/tc_query.rb +++ b/test/types/tc_query.rb @@ -14,6 +14,12 @@ class TestBasic < Test::Unit::TestCase Blink[:debug] = true end + def teardown + assert_nothing_raised() { + Blink::Type.allclear + } + end + # hmmm # this is complicated, because we store references to the created # objects in a central store @@ -48,9 +54,9 @@ class TestBasic < Test::Unit::TestCase return @sleeper end - def component(*args) + def component(name,*args) assert_nothing_raised() { - @component = Blink::Component.new + @component = Blink::Component.new(:name => name) } args.each { |arg| @@ -94,7 +100,7 @@ class TestBasic < Test::Unit::TestCase end def test_component - component = component(file(),service()) + component = component("a",file(),service()) assert_nothing_raised() { component.retrieve |