diff --git a/acceptance/tests/apply/classes/should_allow_param_undef_override.rb b/acceptance/tests/apply/classes/should_allow_param_undef_override.rb index a4f37cba1..39904dc0d 100755 --- a/acceptance/tests/apply/classes/should_allow_param_undef_override.rb +++ b/acceptance/tests/apply/classes/should_allow_param_undef_override.rb @@ -1,29 +1,36 @@ test_name "should allow overriding a parameter to undef in inheritence" -out = "/tmp/class_undef_override_out-#{$$}" +agents.each do |agent| + dir = agent.tmpdir('class_undef_override') + out = File.join(dir, 'class_undef_override_out') + source = File.join(dir, 'class_undef_override_test') + manifest = %Q{ class parent { file { 'test': path => '#{out}', - source => '/tmp/class_undef_override_test-#{$$}', + source => '#{source}', } } class child inherits parent { File['test'] { source => undef, content => 'hello new world!', } } include parent include child } -step "prepare the target file on all systems" -on(agents, "echo 'hello world!' > #{out}") -step "apply the manifest" -apply_manifest_on(agents, manifest) -step "verify the file content" -on(agents, "cat #{out}") do + step "prepare the target file on all systems" + on(agent, "echo 'hello world!' > #{out}") + step "apply the manifest" + apply_manifest_on(agent, manifest) + step "verify the file content" + on(agent, "cat #{out}") do fail_test "the file was not touched" if stdout.include? "hello world!" fail_test "the file was not updated" unless stdout.include? "hello new world" + end + + on(agent, "rm -rf #{dir}") end diff --git a/acceptance/tests/apply/virtual/should_realize.rb b/acceptance/tests/apply/virtual/should_realize.rb index fd32ad859..7dc2406cd 100755 --- a/acceptance/tests/apply/virtual/should_realize.rb +++ b/acceptance/tests/apply/virtual/should_realize.rb @@ -1,22 +1,25 @@ test_name "should realize" -out = "/tmp/hosts-#{Time.new.to_i}" -name = "test-#{Time.new.to_i}-host" + +agents.each do |agent| + out = agent.tmpfile('should_realize') + name = "test-#{Time.new.to_i}-host" manifest = %Q{ @host{'#{name}': ip=>'127.0.0.2', target=>'#{out}', ensure=>present} realize(Host['#{name}']) } -step "clean the system ready for testing" -on agents, "rm -f #{out}" + step "clean the system ready for testing" + on agent, "rm -f #{out}" -step "realize the resource on the hosts" -apply_manifest_on agents, manifest + step "realize the resource on the host" + apply_manifest_on agent, manifest -step "verify the content of the file" -on(agents, "cat #{out}") do + step "verify the content of the file" + on(agent, "cat #{out}") do fail_test "missing host definition" unless stdout.include? name -end + end -step "final cleanup of the system" -on agents, "rm -f #{out}" + step "final cleanup of the system" + on agent, "rm -f #{out}" +end diff --git a/acceptance/tests/apply/virtual/should_realize_complex_query.rb b/acceptance/tests/apply/virtual/should_realize_complex_query.rb index 9782bbfac..512b5cbfc 100755 --- a/acceptance/tests/apply/virtual/should_realize_complex_query.rb +++ b/acceptance/tests/apply/virtual/should_realize_complex_query.rb @@ -1,36 +1,39 @@ test_name "should realize with complex query" -out = "/tmp/hosts-#{Time.new.to_i}" -name = "test-#{Time.new.to_i}-host" + +agents.each do |agent| + out = agent.tmpfile('should_realize_complex_query') + name = "test-#{Time.new.to_i}-host" manifest = %Q{ @host { '#{name}1': ip => '127.0.0.2', target => '#{out}', host_aliases => ['one', 'two', 'three'], ensure => present, } @host { '#{name}2': ip => '127.0.0.3', target => '#{out}', host_aliases => 'two', ensure => present, } Host<| host_aliases == 'two' and ip == '127.0.0.3' |> } -step "clean up target system for test" -on agents, "rm -f #{out}" + step "clean up target system for test" + on agent, "rm -f #{out}" -step "run the manifest" -apply_manifest_on agents, manifest + step "run the manifest" + apply_manifest_on agent, manifest -step "verify the file output" -on(agents, "cat #{out}") do + step "verify the file output" + on(agent, "cat #{out}") do fail_test "second host not found in output" unless stdout.include? "#{name}2" fail_test "first host was found in output" if stdout.include? "#{name}1" -end + end -step "clean up system after testing" -on agents, "rm -f #{out}" + step "clean up system after testing" + on agent, "rm -f #{out}" +end diff --git a/acceptance/tests/apply/virtual/should_realize_many.rb b/acceptance/tests/apply/virtual/should_realize_many.rb index 8f53caefe..80cf3f580 100755 --- a/acceptance/tests/apply/virtual/should_realize_many.rb +++ b/acceptance/tests/apply/virtual/should_realize_many.rb @@ -1,22 +1,24 @@ test_name "test that realize function takes a list" -out = "/tmp/hosts-#{Time.new.to_i}" -name = "test-#{Time.new.to_i}-host" + +agents.each do |agent| + out = agent.tmpfile('should_realize_many') + name = "test-#{Time.new.to_i}-host" manifest = %Q{ @host{'#{name}1': ip=>'127.0.0.2', target=>'#{out}', ensure=>present} @host{'#{name}2': ip=>'127.0.0.2', target=>'#{out}', ensure=>present} realize(Host['#{name}1'], Host['#{name}2']) } + step "clean up target system for test" + on agent, "rm -f #{out}" -step "clean up target system for test" -on agents, "rm -f #{out}" - -step "run the manifest" -apply_manifest_on agents, manifest + step "run the manifest" + apply_manifest_on agent, manifest -step "verify the file output" -on(agents, "cat #{out}") do + step "verify the file output" + on(agent, "cat #{out}") do fail_test "first host not found in output" unless stdout.include? "#{name}1" fail_test "second host not found in output" unless stdout.include? "#{name}2" + end end diff --git a/acceptance/tests/apply/virtual/should_realize_query.rb b/acceptance/tests/apply/virtual/should_realize_query.rb index 24d323373..ae1ff3eb3 100755 --- a/acceptance/tests/apply/virtual/should_realize_query.rb +++ b/acceptance/tests/apply/virtual/should_realize_query.rb @@ -1,24 +1,27 @@ test_name "should realize query" -out = "/tmp/hosts-#{Time.new.to_i}" -name = "test-#{Time.new.to_i}-host" + +agents.each do |agent| + out = agent.tmpfile('should_realize_query') + name = "test-#{Time.new.to_i}-host" manifest = %Q{ @host { '#{name}': ip => '127.0.0.2', target => '#{out}', host_aliases => 'alias', ensure => present, } Host<| ip == '127.0.0.2' |> } -step "clean up target system for test" -on agents, "rm -f #{out}" + step "clean up target system for test" + on agent, "rm -f #{out}" -step "run the manifest" -apply_manifest_on agents, manifest + step "run the manifest" + apply_manifest_on agent, manifest -step "verify the file output" -on(agents, "cat #{out}") do + step "verify the file output" + on(agent, "cat #{out}") do fail_test "host not found in output" unless stdout.include? name + end end diff --git a/acceptance/tests/apply/virtual/should_realize_query_array.rb b/acceptance/tests/apply/virtual/should_realize_query_array.rb index 137d93b1a..c2fa8f6ea 100755 --- a/acceptance/tests/apply/virtual/should_realize_query_array.rb +++ b/acceptance/tests/apply/virtual/should_realize_query_array.rb @@ -1,24 +1,27 @@ test_name "should realize query array" -out = "/tmp/hosts-#{Time.new.to_i}" -name = "test-#{Time.new.to_i}-host" + +agents.each do |agent| + out = agent.tmpfile('should_realize_query_array') + name = "test-#{Time.new.to_i}-host" manifest = %Q{ @host { '#{name}': ip => '127.0.0.2', target => '#{out}', host_aliases => ['one', 'two', 'three'], ensure => present, } Host<| host_aliases == 'two' |> } -step "clean up target system for test" -on agents, "rm -f #{out}" + step "clean up target system for test" + on agent, "rm -f #{out}" -step "run the manifest" -apply_manifest_on agents, manifest + step "run the manifest" + apply_manifest_on agent, manifest -step "verify the file output" -on(agents, "cat #{out}") do + step "verify the file output" + on(agent, "cat #{out}") do fail_test "host not found in output" unless stdout.include? name + end end diff --git a/acceptance/tests/file_hello_world.rb b/acceptance/tests/file_hello_world.rb index 683ff4672..b64ddd717 100644 --- a/acceptance/tests/file_hello_world.rb +++ b/acceptance/tests/file_hello_world.rb @@ -1,22 +1,23 @@ # Verify that a trivial manifest can be run to completion. - -filename = "/tmp/hello-world.txt" -content = "Hello, World" -manifest = "file { '#{filename}': content => '#{content}' }" - test_name "The challenging 'Hello, World' manifest" -step "ensure we are clean before testing..." -on agents, "rm -f #{filename}" +agents.each do |agent| + filename = agent.tmpfile('hello-world.txt') + content = "Hello, World" + manifest = "file { '#{filename}': content => '#{content}' }" -step "run the manifest itself" -apply_manifest_on(agents, manifest) do - fail_test "the expected notice of action was missing" unless - stdout.index 'File[/tmp/hello-world.txt]/ensure: defined content as' -end + step "ensure we are clean before testing..." + on(agent, "rm -f #{filename}") -step "verify the content of the generated files." -on agents, "grep '#{content}' #{filename}" + step "run the manifest itself" + apply_manifest_on(agent, manifest) do + fail_test "the expected notice of action was missing" unless + stdout.index "File[#{filename}]/ensure: defined content as" + end -step "clean up after our test run." -on agents, "rm -f #{filename}" + step "verify the content of the generated files." + on agent, "grep '#{content}' #{filename}" + + step "clean up after our test run." + on(agent, "rm -f #{filename}") +end diff --git a/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_md5.rb b/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_md5.rb index 44338520a..0358d1195 100644 --- a/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_md5.rb +++ b/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_md5.rb @@ -1,17 +1,17 @@ test_name "puppet apply should create a file and report an MD5" -file = "/tmp/hello.world.#{Time.new.to_i}.txt" -manifest = "file{'#{file}': content => 'test'}" +agents.each do |agent| + file = agent.tmpfile('hello-world') + manifest = "file{'#{file}': content => 'test'}" -step "clean up #{file} for testing" -on agents, "rm -f #{file}" + step "clean up #{file} for testing" + on(agent, "rm -f #{file}") -step "Run the manifest and verify MD5 was printed" -agents.each do |host| - apply_manifest_on(host, manifest) do - assert_match(/defined content as '{md5}098f6bcd4621d373cade4e832627b4f6'/, stdout, "#{host}: didn't find the content MD5 on output") + step "Run the manifest and verify MD5 was printed" + apply_manifest_on(agent, manifest) do + assert_match(/defined content as '{md5}098f6bcd4621d373cade4e832627b4f6'/, stdout, "#{agent}: didn't find the content MD5 on output") end -end -step "clean up #{file} after testing" -on agents, "rm -f #{file}" + step "clean up #{file} after testing" + on(agent, "rm -f #{file}") +end diff --git a/acceptance/tests/ticket_4059_ralsh_can_change_settings.rb b/acceptance/tests/ticket_4059_ralsh_can_change_settings.rb index 83f5899f2..ea7b77cbf 100644 --- a/acceptance/tests/ticket_4059_ralsh_can_change_settings.rb +++ b/acceptance/tests/ticket_4059_ralsh_can_change_settings.rb @@ -1,21 +1,21 @@ test_name "#4059: ralsh can change settings" -target = "/tmp/hosts-#4059" -content = "host example.com ensure=present ip=127.0.0.1 target=#{target}" +agents.each do |agent| + target = agent.tmpfile('hosts-#4059') + content = "host example.com ensure=present ip=127.0.0.1 target=#{target}" -step "cleanup the target file" -on agents, "rm -f #{target}" + step "cleanup the target file" + on(agent, "rm -f #{target}") -step "run the resource agent" -on(agents, puppet_resource(content)) do - stdout.index('Host[example.com]/ensure: created') or - fail_test("missing notice about host record creation") -end -agents.each do |host| - on(host, "cat #{target}") do - assert_match(/^127\.0\.0\.1\s+example\.com/, stdout, "missing host record in #{target} on #{host}") + step "run the resource agent" + on(agent, puppet_resource(content)) do + stdout.index('Host[example.com]/ensure: created') or + fail_test("missing notice about host record creation") + end + on(agent, "cat #{target}") do + assert_match(/^127\.0\.0\.1\s+example\.com/, stdout, "missing host record in #{target} on #{agent}") end -end -step "cleanup at the end of the test" -on agents, "rm -f #{target}" + step "cleanup at the end of the test" + on(agent, "rm -f #{target}") +end diff --git a/acceptance/tests/ticket_4285_file_resource_fail_when_name_defined_instead_of_path.rb b/acceptance/tests/ticket_4285_file_resource_fail_when_name_defined_instead_of_path.rb index c1cdb0b9d..cc67fa872 100644 --- a/acceptance/tests/ticket_4285_file_resource_fail_when_name_defined_instead_of_path.rb +++ b/acceptance/tests/ticket_4285_file_resource_fail_when_name_defined_instead_of_path.rb @@ -1,19 +1,21 @@ test_name "Bug #4285: ArgumentError: Cannot alias File[mytitle] to [nil]" -manifest = %q{ +agents.each do |host| + dir = host.tmpdir('4285-aliasing') + +manifest = %Q{ file { "file1": - name => '/tmp/file1', - source => "/tmp/", + name => '#{dir}/file1', + source => "#{dir}/", } file { "file2": - name => '/tmp/file2', - source => "/tmp/", + name => '#{dir}/file2', + source => "#{dir}/", } } -agents.each do |host| apply_manifest_on(host, manifest) do assert_no_match(/Cannot alias/, stdout, "#{host}: found the bug report output") end end diff --git a/acceptance/tests/ticket_6418_file_recursion_and_audit.rb b/acceptance/tests/ticket_6418_file_recursion_and_audit.rb index b21e57ddb..acb72f535 100644 --- a/acceptance/tests/ticket_6418_file_recursion_and_audit.rb +++ b/acceptance/tests/ticket_6418_file_recursion_and_audit.rb @@ -1,33 +1,34 @@ # 2011-02-23 # # AffectedVersion: 2.6.0-2.6.5 # FixedVersion: test_name "#6418: file recursion and audit" -manifest = %q{ - file { "/tmp/6418": ensure => directory } - file { "/tmp/6418/dir": ensure => directory} - file { "/tmp/6418/dir/dir": ensure => directory} - file { "/tmp/6418/dir/dir/dir": ensure => directory} - file { "/tmp/6418-copy": ensure => present, source => "/tmp/6418/" } - - File["/tmp/6418"] -> File["/tmp/6418/dir"] -> File["/tmp/6418/dir/dir"] -> File["/tmp/6418/dir/dir/dir"] -> File["/tmp/6418-copy"] -} +agents.each do |agent| + dir = agent.tmpdir('6418-recurse-audit') -step "Query agent for statefile" -agent=agents.first -on agent, puppet_agent('--configprint statefile') -statefile=stdout.chomp +manifest = %Q{ + file { "#{dir}/6418": ensure => directory } + file { "#{dir}/6418/dir": ensure => directory} + file { "#{dir}/6418/dir/dir": ensure => directory} + file { "#{dir}/6418/dir/dir/dir": ensure => directory} + file { "#{dir}/6418-copy": ensure => present, source => "#{dir}/6418/" } -step "Remove the statefile on all Agents" -on agents, "rm -f #{statefile}" + File["#{dir}/6418"] -> File["#{dir}/6418/dir"] -> File["#{dir}/6418/dir/dir"] -> File["#{dir}/6418/dir/dir/dir"] -> File["#{dir}/6418-copy"] +} -step "Apply the manifest" -apply_manifest_on agents, manifest + step "Query agent for statefile" + on agent, puppet_agent('--configprint statefile') do + statefile=stdout.chomp + step "Remove the statefile on the agent" + on(agent, "rm -f '#{statefile}'") -step "Verify corecct file recursion and audit state" -agents.each do |agent| - on(agent, "grep ensure.*directory #{statefile}", :acceptable_exit_codes => [ 1 ]) + step "Apply the manifest" + apply_manifest_on agent, manifest + + step "Verify correct file recursion and audit state" + on(agent, "grep ensure.*directory '#{statefile}'", :acceptable_exit_codes => [ 1 ]) + end end diff --git a/acceptance/tests/ticket_6541_invalid_filebucket_files.rb b/acceptance/tests/ticket_6541_invalid_filebucket_files.rb index 2c7136ed0..11de0e6b2 100644 --- a/acceptance/tests/ticket_6541_invalid_filebucket_files.rb +++ b/acceptance/tests/ticket_6541_invalid_filebucket_files.rb @@ -1,36 +1,33 @@ test_name "#6541: file type truncates target when filebucket cannot retrieve hash" -target="/tmp/6541-$$" -on agents, host_command('rm -rf #{host["puppetvardir"]}/*bucket') +agents.each do |agent| + target=agent.tmpfile('6541-target') -step "write zero length file" -manifest = "file { '#{target}': content => '' }" -apply_manifest_on(agents, manifest) + on agent, host_command('rm -rf #{host["puppetvardir"]}/*bucket') -step "overwrite file, causing zero-length file to be backed up" -manifest = "file { '#{target}': content => 'some text' }" -apply_manifest_on(agents, manifest) + step "write zero length file" + manifest = "file { '#{target}': content => '' }" + apply_manifest_on(agent, manifest) -test_name "verify invalid hashes should not change the file" -manifest = "file { '#{target}': content => '{md5}notahash' }" -agents.each do |host| - apply_manifest_on(host, manifest) do - assert_no_match(/content changed/, stdout, "#{host}: shouldn't have overwrote the file") + step "overwrite file, causing zero-length file to be backed up" + manifest = "file { '#{target}': content => 'some text' }" + apply_manifest_on(agent, manifest) + + test_name "verify invalid hashes should not change the file" + manifest = "file { '#{target}': content => '{md5}notahash' }" + apply_manifest_on(agent, manifest) do + assert_no_match(/content changed/, stdout, "#{agent}: shouldn't have overwrote the file") end -end -test_name "verify valid but unbucketed hashes should not change the file" -manifest = "file { '#{target}': content => '{md5}13ad7345d56b566a4408ffdcd877bc78' }" -agents.each do |host| - apply_manifest_on(host, manifest) do - assert_no_match(/content changed/, stdout, "#{host}: shouldn't have overwrote the file") + test_name "verify valid but unbucketed hashes should not change the file" + manifest = "file { '#{target}': content => '{md5}13ad7345d56b566a4408ffdcd877bc78' }" + apply_manifest_on(agent, manifest) do + assert_no_match(/content changed/, stdout, "#{agent}: shouldn't have overwrote the file") end -end -test_name "verify that an empty file can be retrieved from the filebucket" -manifest = "file { '#{target}': content => '{md5}d41d8cd98f00b204e9800998ecf8427e' }" -agents.each do |host| - apply_manifest_on(host, manifest) do - assert_match(/content changed '\{md5\}552e21cd4cd9918678e3c1a0df491bc3' to '\{md5\}d41d8cd98f00b204e9800998ecf8427e'/, stdout, "#{host}: shouldn't have overwrote the file") + test_name "verify that an empty file can be retrieved from the filebucket" + manifest = "file { '#{target}': content => '{md5}d41d8cd98f00b204e9800998ecf8427e' }" + apply_manifest_on(agent, manifest) do + assert_match(/content changed '\{md5\}552e21cd4cd9918678e3c1a0df491bc3' to '\{md5\}d41d8cd98f00b204e9800998ecf8427e'/, stdout, "#{agent}: shouldn't have overwrote the file") end end diff --git a/acceptance/tests/ticket_6907_use_provider_in_same_run_it_becomes_suitable.rb b/acceptance/tests/ticket_6907_use_provider_in_same_run_it_becomes_suitable.rb index a9b0b8856..2a5d11333 100644 --- a/acceptance/tests/ticket_6907_use_provider_in_same_run_it_becomes_suitable.rb +++ b/acceptance/tests/ticket_6907_use_provider_in_same_run_it_becomes_suitable.rb @@ -1,40 +1,42 @@ test_name "providers should be useable in the same run they become suitable" -dir = "/tmp/#{$$}-6907" +agents.each do |agent| + dir = agent.tmpdir('provider-6907') -on agents, "mkdir -p #{dir}/lib/puppet/{type,provider/test6907}" -on agents, "cat > #{dir}/lib/puppet/type/test6907.rb", :stdin => < #{dir}/lib/puppet/type/test6907.rb", :stdin => < true) newproperty(:file) end TYPE -on agents, "cat > #{dir}/lib/puppet/provider/test6907/only.rb", :stdin => < #{dir}/lib/puppet/provider/test6907/only.rb", :stdin => < "#{dir}/must_exist" require 'fileutils' def file 'not correct' end def file=(value) FileUtils.touch(value) end end PROVIDER -on agents, puppet_apply("--libdir #{dir}/lib --trace"), :stdin => < < "#{dir}/test_file", } file { "#{dir}/must_exist": ensure => file, mode => 0755, } MANIFEST -on agents, "ls #{dir}/test_file" + on agent, "ls #{dir}/test_file" +end diff --git a/acceptance/tests/ticket_6928_puppet_master_parse_fails.rb b/acceptance/tests/ticket_6928_puppet_master_parse_fails.rb index 155e91d3f..039390cca 100644 --- a/acceptance/tests/ticket_6928_puppet_master_parse_fails.rb +++ b/acceptance/tests/ticket_6928_puppet_master_parse_fails.rb @@ -1,35 +1,32 @@ test_name "#6928: Puppet --parseonly should return deprication message" # Create good and bad formatted manifests step "Master: create valid, invalid formatted manifests" create_remote_file(master, '/tmp/good.pp', %w{notify{good:}} ) create_remote_file(master, '/tmp/bad.pp', 'notify{bad:') step "Master: use --parseonly on an invalid manifest, should return 1 and issue deprecation warning" on master, puppet_master( %w{--parseonly /tmp/bad.pp} ), :acceptable_exit_codes => [ 1 ] assert_match(/--parseonly has been removed. Please use \'puppet parser validate \'/, stdout, "Deprecation warning not issued for --parseonly on #{master}" ) step "Agents: create valid, invalid formatted manifests" agents.each do |host| - create_remote_file(host, '/tmp/good.pp', %w{notify{good:}} ) - create_remote_file(host, '/tmp/bad.pp', 'notify{bad:') -end + good = host.tmpfile('good-6928') + bad = host.tmpfile('bad-6928') -step "Agents: use --parseonly on an invalid manifest, should return 1 and issue deprecation warning" -agents.each do |host| - on(host, "puppet --parseonly /tmp/bad.pp}", :acceptable_exit_codes => [ 1 ]) do + create_remote_file(host, good, %w{notify{good:}} ) + create_remote_file(host, bad, 'notify{bad:') + + step "Agents: use --parseonly on an invalid manifest, should return 1 and issue deprecation warning" + on(host, puppet('--parseonly', bad), :acceptable_exit_codes => [ 1 ]) do assert_match(/--parseonly has been removed. Please use \'puppet parser validate \'/, stdout, "Deprecation warning not issued for --parseonly on #{host}" ) end -end -step "Test Face for ‘parser validate’ with good manifest -- should pass" -agents.each do |host| - on(host, "puppet parser validate /tmp/good.pp", :acceptable_exit_codes => [ 0 ]) -end + step "Test Face for 'parser validate' with good manifest -- should pass" + on(host, puppet('parser', 'validate', good), :acceptable_exit_codes => [ 0 ]) -step "Test Faces for ‘parser validate’ with bad manifest -- should fail" -agents.each do |host| - on(host, "puppet parser validate /tmp/bad.pp", :acceptable_exit_codes => [ 1 ]) do + step "Test Faces for 'parser validate' with bad manifest -- should fail" + on(host, puppet('parser', 'validate', bad), :acceptable_exit_codes => [ 1 ]) do assert_match(/err: Could not parse for environment production/, stdout, "Bad manifest detection failed on #{host}" ) end end diff --git a/acceptance/tests/ticket_7101_template_compile.rb b/acceptance/tests/ticket_7101_template_compile.rb index d2ebecd13..b2486b030 100644 --- a/acceptance/tests/ticket_7101_template_compile.rb +++ b/acceptance/tests/ticket_7101_template_compile.rb @@ -1,25 +1,24 @@ test_name "#7101: template compile" -manifest = %q{ +agents.each do |agent| + template = agent.tmpfile('template_7101.erb') + target = agent.tmpfile('file_7101.erb') + + manifest = %Q{ $bar = 'test 7101' -file { '/tmp/file_7101.erb': - content => template('/tmp/template_7101.erb') +file { '#{target}': + content => template("#{template}") } } + step "Agents: Create template file" + create_remote_file(agent, template, %w{<%= bar %>} ) -step "Agents: Create template file" -agents.each do |host| - create_remote_file(host, '/tmp/template_7101.erb', %w{<%= bar %>} ) -end - -step "Run manifest referencing template file" -apply_manifest_on(agents, manifest) - + step "Run manifest referencing template file" + apply_manifest_on(agent, manifest) -step "Agents: Verify file is created with correct contents " -agents.each do |host| - on(host, "cat /tmp/file_7101.erb") do - assert_match(/test 7101/, stdout, "File /tmp/file_7101.erb not created with correct contents on #{host}" ) + step "Agents: Verify file is created with correct contents " + on(agent, "cat #{target}") do + assert_match(/test 7101/, stdout, "File #{target} not created with correct contents on #{agent}" ) end end diff --git a/acceptance/tests/ticket_7139_puppet_resource_file_qualified_paths.rb b/acceptance/tests/ticket_7139_puppet_resource_file_qualified_paths.rb index f773ba17c..7a7b59434 100644 --- a/acceptance/tests/ticket_7139_puppet_resource_file_qualified_paths.rb +++ b/acceptance/tests/ticket_7139_puppet_resource_file_qualified_paths.rb @@ -1,11 +1,13 @@ -test_name "#7139: Puppet resource file failes on path with leading '/'" +test_name "#7139: Puppet resource file fails on path with leading '/'" -step "Agents: create valid, invalid formatted manifests" -create_remote_file(agents, '/tmp/ticket-7139', %w{foo bar contents} ) +agents.each do |agent| + target = agent.tmpfile('ticket-7139') -step "Run puppet file resource on /tmp/ticket-7139" -agents.each do |host| - on(host, "puppet resource file /tmp/ticket-7139") do - assert_match(/file \{ \'\/tmp\/ticket-7139\':/, stdout, "puppet resource file failed on #{host}") + step "Agents: create valid, invalid formatted manifests" + create_remote_file(agent, target, %w{foo bar contents} ) + + step "Run puppet file resource on #{target}" + on(agent, puppet_resource('file', target)) do + assert_match(/file \{ \'#{Regexp.escape(target)}\':/, stdout, "puppet resource file failed on #{agent}") end end