summaryrefslogtreecommitdiffstats
path: root/spec/unit/simple_graph.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@puppetlabs.com>2010-05-14 13:30:43 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit61a719f41c5448ca9ab7bdbd6a05f6c97ee80b7f (patch)
tree4f4534536aac89bb713f6f42852950f3c4cde6b6 /spec/unit/simple_graph.rb
parentd13f8ac4d5b8e4cf677c6c04fe875630216d6303 (diff)
downloadpuppet-61a719f41c5448ca9ab7bdbd6a05f6c97ee80b7f.tar.gz
puppet-61a719f41c5448ca9ab7bdbd6a05f6c97ee80b7f.tar.xz
puppet-61a719f41c5448ca9ab7bdbd6a05f6c97ee80b7f.zip
Adding #2658 - Adding support for run stages
This allows you to specify a run stage for either a class or a resource. By default, all classes get directly added to the 'main' stage. You can create new stages as resources: stage { [pre, post]: } To order stages, use standard relationships: stage { pre: before => Stage[main] } Or use the new relationship syntax: stage { pre: } -> Stage[main] -> stage { post: } Then use the new class parameters to specify a stage: class { foo: stage => pre } If you set a stage on an individual resource, it will fail; stages can only be set on class resources. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'spec/unit/simple_graph.rb')
-rwxr-xr-xspec/unit/simple_graph.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/unit/simple_graph.rb b/spec/unit/simple_graph.rb
index f8596c7d6..234a2fc1f 100755
--- a/spec/unit/simple_graph.rb
+++ b/spec/unit/simple_graph.rb
@@ -440,6 +440,8 @@ describe Puppet::SimpleGraph do
@top = Container.new("top", ["g", "h", @middle, @one, @three])
@empty = Container.new("empty", [])
+ @stage = Puppet::Type.type(:stage).new(:name => "foo")
+
@contgraph = @top.to_graph
# We have to add the container to the main graph, else it won't
@@ -477,6 +479,12 @@ describe Puppet::SimpleGraph do
@depgraph.vertices.find_all { |v| v.is_a?(Container) }.should be_empty
end
+ # This is a bit hideous, but required to make stages work with relationships - they're
+ # the top of the graph.
+ it "should remove all Stage resources from the dependency graph" do
+ @depgraph.vertices.find_all { |v| v.is_a?(Puppet::Type.type(:stage)) }.should be_empty
+ end
+
it "should add container relationships to contained objects" do
@contgraph.leaves(@middle).each do |leaf|
@depgraph.should be_edge("h", leaf)