diff --git a/acceptance/tests/environment/enc_nonexistent_directory_environment.rb b/acceptance/tests/environment/enc_nonexistent_directory_environment.rb index f25916a8f..57815ec48 100644 --- a/acceptance/tests/environment/enc_nonexistent_directory_environment.rb +++ b/acceptance/tests/environment/enc_nonexistent_directory_environment.rb @@ -1,43 +1,46 @@ test_name "Master should produce error if enc specifies a nonexistent environment" testdir = create_tmpdir_for_user master, 'nonexistent_env' -apply_manifest_on master, <<-MANIFEST -file { - [ "#{testdir}/environments", "#{testdir}/environments/production" ]: +apply_manifest_on(master, <<-MANIFEST, :catch_failures => true) +File { ensure => directory, + owner => #{master.puppet['user']}, + group => #{master.puppet['group']}, + mode => 0770, } -file { "#{testdir}/environments/production/environment.conf": +file { + "#{testdir}":; + "#{testdir}/environments":; + "#{testdir}/environments/production":; + "#{testdir}/environments/production/manifests":; + "#{testdir}/environments/production/manifests/site.pp": ensure => file, - content => ' - manifest=./production.pp - ', -} + mode => '0644', + content => 'notify { "In the production environment": }'; -file { "#{testdir}/environments/production/production.pp": - ensure => file, - content => 'notify { "In the production environment": }', -} - -file { "#{testdir}/enc.rb": - ensure => file, - mode => '0775', - content => 'echo "environment: doesnotexist"', + "#{testdir}/enc.rb": + ensure => file, + mode => '0775', + content => '#!#{master['puppetbindir']}/ruby + puts "environment: doesnotexist" + '; } MANIFEST master_opts = { 'main' => { 'node_terminus' => 'exec', 'external_nodes' => "#{testdir}/enc.rb", 'environmentpath' => "#{testdir}/environments", } } with_puppet_running_on master, master_opts, testdir do agents.each do |agent| on agent, "puppet agent --no-daemonize --onetime --server #{master} --verbose", :acceptable_exit_codes => [0] do assert_match(/Could not find a directory environment named 'doesnotexist'/, stderr, "Errors when nonexistant environment is specified") + assert_not_match(/In the production environment/, stdout, "Executed manifest from production environment") end end end