diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-31 22:10:42 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-31 22:10:42 +0000 |
| commit | b8f798f0ad88c990b5f9fe4c2d7b830aeb36a446 (patch) | |
| tree | b39ef323763b33e3b82bbdb80954e92388e680c1 /test | |
| parent | 0a1dd1ae8e5d77c22596579fbedfbe1db19b4445 (diff) | |
Fixing #390. You can now add --graph to produce dot files, and you can then produce pngs or whatever from those.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2007 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/other/transactions.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/other/transactions.rb b/test/other/transactions.rb index 89b1fd8e2..4a5fee9a0 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -888,6 +888,46 @@ class TestTransactions < Test::Unit::TestCase assert(trans.triggered?(c, :refresh), "Transaction did not store the trigger") end + + def test_graph + Puppet.config.use(:puppet) + # Make a graph + graph = Puppet::PGraph.new + graph.add_edge!("a", "b") + + # Create our transaction + trans = Puppet::Transaction.new(graph) + + assert_nothing_raised do + trans.graph(graph, :testing) + end + + dotfile = File.join(Puppet[:graphdir], "testing.dot") + assert(! FileTest.exists?(dotfile), "Enabled graphing even tho disabled") + + # Now enable graphing + Puppet[:graph] = true + + assert_nothing_raised do + trans.graph(graph, :testing) + end + assert(FileTest.exists?(dotfile), "Did not create graph.") + end + + def test_created_graphs + FileUtils.mkdir_p(Puppet[:graphdir]) + file = Puppet::Type.newfile(:path => tempfile, :content => "yay") + exec = Puppet::Type.type(:exec).create(:command => "echo yay", :path => ENV['PATH'], + :require => file) + + Puppet[:graph] = true + assert_apply(file, exec) + + %w{resources relationships expanded_relationships}.each do |name| + file = File.join(Puppet[:graphdir], "%s.dot" % name) + assert(FileTest.exists?(file), "graph for %s was not created" % name) + end + end end # $Id$ |
