From 0c16426a772c85b0ab45bfd4c3ba5189ace2d6b2 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Sat, 28 Feb 2009 07:55:56 +0000 Subject: Fixing broken 0.24.x tests in test/. These tests once again largely were caused by /usr/sbin not being in the path and by ~ not being writable. The only tests still failing are Rails tests, and my guess is that they're all failing because of the recent work by Brice. They should probably just be removed. Signed-off-by: Luke Kanies --- test/executables/filebucket.rb | 9 ++++++--- test/executables/puppetbin.rb | 2 +- test/lib/puppettest.rb | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/executables/filebucket.rb b/test/executables/filebucket.rb index 491630707..f479c150e 100755 --- a/test/executables/filebucket.rb +++ b/test/executables/filebucket.rb @@ -12,12 +12,15 @@ class TestFileBucketExe < Test::Unit::TestCase include PuppetTest::ExeTest def test_local + basedir = tempfile() + FileUtils.mkdir_p(basedir) + bucket = tempfile file = tempfile text = "somet ext" md5 = Digest::MD5.hexdigest(text) File.open(file, "w") { |f| f.print text } - out = %x{filebucket --bucket #{bucket} backup #{file}} + out = %x{filebucket --confdir #{basedir} --vardir #{basedir} --bucket #{bucket} backup #{file}} outfile, outmd5 = out.chomp.split(": ") @@ -35,12 +38,12 @@ class TestFileBucketExe < Test::Unit::TestCase assert_equal(text, newtext, "did not get correct file from md5 sum") - out = %x{filebucket --bucket #{bucket} get #{md5}} + out = %x{filebucket --confdir #{basedir} --vardir #{basedir} --bucket #{bucket} get #{md5}} assert_equal(0, $?, "filebucket did not run successfully") assert_equal(text, out, "did not get correct text back from filebucket") File.open(file, "w") { |f| f.puts "some other txt" } - out = %x{filebucket --bucket #{bucket} restore #{file} #{md5}} + out = %x{filebucket --confdir #{basedir} --vardir #{basedir} --bucket #{bucket} restore #{file} #{md5}} assert_equal(0, $?, "filebucket did not run successfully") assert_equal(text, File.read(file), "file was not restored") end diff --git a/test/executables/puppetbin.rb b/test/executables/puppetbin.rb index 08329efb6..631b3b22a 100755 --- a/test/executables/puppetbin.rb +++ b/test/executables/puppetbin.rb @@ -72,7 +72,7 @@ class TestPuppetBin < Test::Unit::TestCase end File.open(manifest, "w") do |f| f.puts "#!#{env} puppet - file { '#{path}': ensure => file }" + exec { '/bin/touch #{path}': }" end File.chmod(0755, manifest) diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb index 63f8121b5..7fb98ef1d 100755 --- a/test/lib/puppettest.rb +++ b/test/lib/puppettest.rb @@ -166,6 +166,9 @@ module PuppetTest end def setup + unless ENV["PATH"].split(File::PATH_SEPARATOR).include?("/usr/sbin") + ENV["PATH"] += File::PATH_SEPARATOR + "/usr/sbin" + end @memoryatstart = Puppet::Util.memory if defined? @@testcount @@testcount += 1 -- cgit From e016307f00fe67dc53f8581f08c1dfb5ab7dfb3b Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Thu, 2 Apr 2009 19:34:38 -0500 Subject: Fixing Rakefile; apparently there was a rake or gem incompatibility Signed-off-by: Luke Kanies --- test/Rakefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/Rakefile b/test/Rakefile index a8118c1c5..a1f8c26ec 100644 --- a/test/Rakefile +++ b/test/Rakefile @@ -55,7 +55,7 @@ end desc "Run the full test suite" Rake::PuppetTestTask.new :test do |t| - t.libs << $test_library_paths + t.libs += $test_library_paths # Add every file as a test file to run t.test_files = allfiles @@ -72,7 +72,8 @@ filemap.each do |dir, files| namespace ns do files.each do |file| Rake::PuppetTestTask.new File.basename(file, '.rb').to_sym do |t| - t.libs << $test_library_paths + ['..'] + t.libs += $test_library_paths + ['..'] + t.libs << '..' t.test_files = [ file ] t.verbose = true end @@ -81,7 +82,7 @@ filemap.each do |dir, files| # Then create a task that matches the directory itself. Rake::PuppetTestTask.new dir do |t| - t.libs << $test_library_paths + t.libs += $test_library_paths if ENV["TESTFILES"] t.test_files = ENV["TESTFILES"].split(/\s+/) else -- cgit From a677e26eb1452c08d7724047a18e50f4a654d2cd Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Thu, 2 Apr 2009 19:41:17 -0500 Subject: Fixing all tests that were apparently broken in the 0.24.x merge. Signed-off-by: Luke Kanies --- test/network/client/resource.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'test') diff --git a/test/network/client/resource.rb b/test/network/client/resource.rb index ba84fc27e..c73690170 100755 --- a/test/network/client/resource.rb +++ b/test/network/client/resource.rb @@ -42,10 +42,7 @@ class TestResourceClient < Test::Unit::TestCase assert_instance_of(Puppet::TransObject, tresource) resource = tresource.to_ral - assert_events([], resource) - File.unlink(file) - assert_events([:file_created], resource) - File.unlink(file) + assert_equal(File.stat(file).mode & 007777, resource[:mode], "Did not get mode") # Now test applying result = client.apply(tresource) -- cgit