summaryrefslogtreecommitdiffstats
path: root/spec/integration/parser
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-07-28 14:54:23 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-07-30 14:28:31 -0700
commit6dbd4771265173a9d4c3e7756c35c9ca371ca394 (patch)
tree835faf9ed49da69b9d2059ed1ebba8cde485d21d /spec/integration/parser
parent871e6fd58223cad241bcc14f165b3ab1e6e257e6 (diff)
downloadpuppet-6dbd4771265173a9d4c3e7756c35c9ca371ca394.tar.gz
puppet-6dbd4771265173a9d4c3e7756c35c9ca371ca394.tar.xz
puppet-6dbd4771265173a9d4c3e7756c35c9ca371ca394.zip
[#4397]+[#4344] Move type-name resolution out of Puppet::Resource into the AST resources.
Move type-name resolution out of Puppet::Resource into the AST resources. Move find_resource_type out of Puppet::Resource into Scope Thus, never pass unqualified type names to Puppet::Resource objects. Thus, Puppet::Resource objects don't need the namespace property, and Puppet::Resource objects never consult the harddrive to look for .pp files that might contain their type definitions, Thus, performance is improved. Also removes the temporary fix for #4257 that caused #4397 (The code was too eager to look for a class in the topscope) Paired-With: Paul Berry <paul@puppetlabs.com> Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec/integration/parser')
-rwxr-xr-xspec/integration/parser/compiler_spec.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/integration/parser/compiler_spec.rb b/spec/integration/parser/compiler_spec.rb
index 83bbf9500..9158ad1c2 100755
--- a/spec/integration/parser/compiler_spec.rb
+++ b/spec/integration/parser/compiler_spec.rb
@@ -26,4 +26,47 @@ describe Puppet::Parser::Compiler do
@compiler.catalog.version.should == version
end
+
+ describe "when resolving class references" do
+ it "should favor local scope, even if there's an included class in topscope" do
+ Puppet[:code] = <<-PP
+ class experiment {
+ class baz {
+ }
+ notify {"x" : require => Class[Baz] }
+ }
+ class baz {
+ }
+ include baz
+ include experiment
+ include experiment::baz
+ PP
+
+ catalog = Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode"))
+
+ notify_resource = catalog.resource( "Notify[x]" )
+
+ notify_resource[:require].title.should == "Experiment::Baz"
+ end
+
+ it "should favor local scope, even if there's an unincluded class in topscope" do
+ Puppet[:code] = <<-PP
+ class experiment {
+ class baz {
+ }
+ notify {"x" : require => Class[Baz] }
+ }
+ class baz {
+ }
+ include experiment
+ include experiment::baz
+ PP
+
+ catalog = Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode"))
+
+ notify_resource = catalog.resource( "Notify[x]" )
+
+ notify_resource[:require].title.should == "Experiment::Baz"
+ end
+ end
end