summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-29 00:01:52 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-29 00:01:52 +0000
commitc4c3d77c58ae07560eafe838abbbf8271d923e57 (patch)
tree75b3b6ed486bcf4d32b8d73fc286f4d572c5e606 /test
parentd07570b78d6c6cc670b4e6c770fb409b64c5b24d (diff)
Some tweaks to graph splicing, although I do not think it will be enough to handle some of the edge cases.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1981 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/other/pgraph.rb22
1 files changed, 16 insertions, 6 deletions
diff --git a/test/other/pgraph.rb b/test/other/pgraph.rb
index c83df93e4..c8a04cb8d 100755
--- a/test/other/pgraph.rb
+++ b/test/other/pgraph.rb
@@ -71,15 +71,15 @@ 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
+ one, two, three, 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
- # get spliced, rather than just components.
+ # Now add a couple of child files, so that we can test whether all
+ # containers get spliced, rather than just components.
# Now make a dependency graph
deps = Puppet::PGraph.new
@@ -90,14 +90,24 @@ class TestPGraph < Test::Unit::TestCase
# 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)
+ #{one => two, three => [middle, two, "c"], "f" => "c", "h" => middle, "c" => empty}.each do |source, targets|
+ {one => two, two => three, middle => three, "f" => "c", "h" => middle, "c" => [three, empty]}.each do |source, targets|
+ targets = [targets] unless targets.is_a?(Array)
+ targets.each do |target|
+ deps.add_edge!(source, target, :callback => :refresh)
+ end
end
+
+ #num = 6
+ #contgraph.to_jpg(File.expand_path("~/tmp/graphs"), "containers#{num}")
+ #contgraph.reversal.to_jpg(File.expand_path("~/tmp/graphs"), "reversal#{num}")
+ #deps.to_jpg(File.expand_path("~/tmp/graphs"), "relationships#{num}")
deps.splice!(contgraph, Container)
+ #deps.to_jpg(File.expand_path("~/tmp/graphs"), "after_relationships#{num}")
assert(! deps.cyclic?, "Created a cyclic graph")
-
+
# 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)