Skip to content

Commit

Permalink
(PUP-3239) Add Integration Tests
Browse files Browse the repository at this point in the history
Added integration tests to check if $environment in basemodulepath or
environmentpath halts compilation.
  • Loading branch information
Britt Gresham committed Sep 25, 2014
1 parent 6c30ada commit b3bbe5f
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions spec/integration/environments/default_manifest_spec.rb
Expand Up @@ -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'
Expand Down

0 comments on commit b3bbe5f

Please sign in to comment.