diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-11 18:16:52 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-11 18:16:52 +0000 |
| commit | 37a059be9538bc90e09a17a45573fc44da6861b4 (patch) | |
| tree | 466169ebd128df3d08ab561081e65f864dc8f208 /test | |
| parent | 374c830a217cd69f28797d8a771b725a0346b32e (diff) | |
| download | puppet-37a059be9538bc90e09a17a45573fc44da6861b4.tar.gz puppet-37a059be9538bc90e09a17a45573fc44da6861b4.tar.xz puppet-37a059be9538bc90e09a17a45573fc44da6861b4.zip | |
Most tests now pass in the whole system, but there are still about 8 cases that do not work. I am working on those now.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1904 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/client/master.rb | 16 | ||||
| -rwxr-xr-x | test/other/events.rb | 15 | ||||
| -rw-r--r-- | test/other/pgraph.rb | 16 | ||||
| -rwxr-xr-x | test/other/transactions.rb | 6 |
4 files changed, 51 insertions, 2 deletions
diff --git a/test/client/master.rb b/test/client/master.rb index ddbee8467..f89d2cae8 100755 --- a/test/client/master.rb +++ b/test/client/master.rb @@ -128,6 +128,22 @@ class TestMasterClient < Test::Unit::TestCase client.run } end + + def test_download + source = tempfile() + dest = tempfile() + sfile = File.join(source, "file") + Dir.mkdir(source) + File.open(sfile, "w") {|f| f.puts "yay"} + + files = [] + assert_nothing_raised do + + Puppet::Client::Master.download(:dest => dest, :source => source, :name => "testing") do |path| + files << path + end + end + end def test_getplugins Puppet[:pluginsource] = tempfile() diff --git a/test/other/events.rb b/test/other/events.rb index a6d5d0e6c..10099fa46 100755 --- a/test/other/events.rb +++ b/test/other/events.rb @@ -125,27 +125,40 @@ class TestEvents < Test::Unit::TestCase assert(FileTest.exists?(fname), "Exec file did not get created") end + # Make sure refreshing happens mid-transaction, rather than at the end. def test_refreshordering file = tempfile() exec1 = Puppet.type(:exec).create( + :title => "one", :name => "echo one >> %s" % file, :path => "/usr/bin:/bin" ) exec2 = Puppet.type(:exec).create( + :title => "two", :name => "echo two >> %s" % file, :path => "/usr/bin:/bin", :refreshonly => true, - :subscribe => ["exec", exec1.name] + :subscribe => exec1 ) exec3 = Puppet.type(:exec).create( + :title => "three", :name => "echo three >> %s" % file, :path => "/usr/bin:/bin" ) + execs = [exec1, exec2, exec3] comp = newcomp(exec1,exec2,exec3) + + trans = comp.evaluate + execs.each do |e| assert(trans.resources.vertex?(e), "%s is not in graph" % e.title) end + trans.prepare + execs.each do |e| assert(trans.relgraph.vertex?(e), "%s is not in relgraph" % e.title) end + reverse = trans.relgraph.reversal + execs.each do |e| assert(reverse.vertex?(e), "%s is not in reversed graph" % e.title) end + assert_apply(comp) diff --git a/test/other/pgraph.rb b/test/other/pgraph.rb index adf290b34..3dc232670 100644 --- a/test/other/pgraph.rb +++ b/test/other/pgraph.rb @@ -54,6 +54,10 @@ class TestPGraph < Test::Unit::TestCase # Test that we can take a containment graph and rearrange it by dependencies def test_splice one, two, middle, top = build_tree + empty = Container.new("empty", []) + # Also, add an empty container to top + top.push empty + contgraph = top.to_graph # Now add a couple of child files, so that we can test whether all containers @@ -66,7 +70,9 @@ class TestPGraph < Test::Unit::TestCase deps.add_vertex(v) end - {one => two, "f" => "c", "h" => middle}.each do |source, target| + # We have to specify a relationship to our empty container, else it never makes it + # into the dep graph in the first place. + {one => two, "f" => "c", "h" => middle, "c" => empty}.each do |source, target| deps.add_edge!(source, target, :callback => :refresh) end @@ -86,6 +92,10 @@ class TestPGraph < Test::Unit::TestCase end end + # Make sure there are no container objects remaining + c = deps.vertices.find_all { |v| v.is_a?(Container) } + assert(c.empty?, "Still have containers %s" % c.inspect) + nons = deps.vertices.find_all { |v| ! v.is_a?(String) } assert(nons.empty?, "still contain non-strings %s" % nons.inspect) @@ -97,6 +107,10 @@ class TestPGraph < Test::Unit::TestCase "Label was not copied on splice") end end + + # Make sure empty containers are also removed + def test_empty_splice + end end # $Id$
\ No newline at end of file diff --git a/test/other/transactions.rb b/test/other/transactions.rb index 9fc58526a..67a2daea9 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -553,6 +553,12 @@ class TestTransactions < Test::Unit::TestCase assert(graph.vertex?(f(:g)), "Lost vertexes with no relations") + # Now make the reversal graph and make sure all of the vertices made it into that + reverse = graph.reversal + %w{a b c d e f g h}.each do |letter| + file = f(letter) + assert(reverse.vertex?(file), "%s did not make it into reversal" % letter) + end graph.to_jpg("normal_relations") end |
