diff --git a/spec/integration/environments/default_manifest_spec.rb b/spec/integration/environments/default_manifest_spec.rb index 543afc08793..72e0e87bb82 100644 --- a/spec/integration/environments/default_manifest_spec.rb +++ b/spec/integration/environments/default_manifest_spec.rb @@ -224,6 +224,50 @@ module EnvironmentsDefaultManifestsSpec end end + describe 'compilation' do + let(:confdir) { Puppet[:confdir] } + let(:manifestsdir) { File.expand_path("manifests", confdir) } + + before(:each) do + FileUtils.mkdir_p(manifestsdir) + File.open(File.join(manifestsdir, "site.pp"), "w") do |f| + f.puts("notify { 'test environment': }") + end + end + + it "refuses to compile if basemodulepath has $environment in its path" do + let(:environmentpath) { File.expand_path("envdir", confdir) } + let(:testingdir) { File.join(environmentpath, "testing") } + FileUtils.mkdir_p(testingdir) + File.open(File.join(confdir, "puppet.conf"), "w") do |f| + f.puts(<<-EOF) +environmentpath=#{environmentpath} +basemodulepath=/$environment + EOF + end + expect { + a_catalog_compiled_for_environment('testing') }.to( + raise_error(Puppet::Error, /\$environment.*interpolated.*environmentpath.*basemodulepath.*halted/) + ) + end + + it "refuses to compile if environmentpath has $environment in its path" do + let(:environmentpath) { File.expand_path("envdir", confdir, "$environment") } + let(:testingdir) { File.join(environmentpath, "testing") } + FileUtils.mkdir_p(testingdir) + File.open(File.join(confdir, "puppet.conf"), "w") do |f| + f.puts(<<-EOF) +environmentpath=#{environmentpath} + EOF + end + expect { + a_catalog_compiled_for_environment('testing') }.to( + raise_error(Puppet::Error, /\$environment.*interpolated.*environmentpath.*basemodulepath.*halted/) + ) + end + + end + describe 'using future parser' do before :each do Puppet[:parser] = 'future'