diff options
| author | Luke Kanies <luke@reductivelabs.com> | 2010-01-06 16:03:33 -0800 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | cb169082ea4d8764c25e81183754c862fd170492 (patch) | |
| tree | 16d546b9cbf7b3a99ad5172f3914acf079270345 /spec/unit/node | |
| parent | 201889bd30260698478d8469517299b290053189 (diff) | |
| download | puppet-cb169082ea4d8764c25e81183754c862fd170492.tar.gz puppet-cb169082ea4d8764c25e81183754c862fd170492.tar.xz puppet-cb169082ea4d8764c25e81183754c862fd170492.zip | |
Adding 'known_resource_types' to Environment
Each environment now has its own known collection of resource
types, and it is responsible for caching as necessary.
Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'spec/unit/node')
| -rwxr-xr-x | spec/unit/node/environment.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/unit/node/environment.rb b/spec/unit/node/environment.rb index b9bfcafc8..26d9aabe1 100755 --- a/spec/unit/node/environment.rb +++ b/spec/unit/node/environment.rb @@ -43,6 +43,38 @@ describe Puppet::Node::Environment do Puppet::Node::Environment.new(:one).to_s.should == "one" end + describe "when managing known resource types" do + before do + @env = Puppet::Node::Environment.new("dev") + @collection = Puppet::Parser::ResourceTypeCollection.new(@env) + @collection.stubs(:perform_initial_import) + end + + it "should create a resource type collection if none exists" do + Puppet::Parser::ResourceTypeCollection.expects(:new).with(@env).returns @collection + @env.known_resource_types.should equal(@collection) + end + + it "should reuse any existing resource type collection" do + @env.known_resource_types.should equal(@env.known_resource_types) + end + + it "should perform the initial import when creating a new collection" do + @collection.expects(:perform_initial_import) + Puppet::Parser::ResourceTypeCollection.expects(:new).returns @collection + + @env.known_resource_types + end + + it "should create and return a new collection rather than returning a stale collection" do + @env.known_resource_types.expects(:stale?).returns true + + Puppet::Parser::ResourceTypeCollection.expects(:new).returns @collection + + @env.known_resource_types.should equal(@collection) + end + end + [:modulepath, :manifestdir].each do |setting| it "should validate the #{setting} directories" do path = %w{/one /two}.join(File::PATH_SEPARATOR) |
