Sha256: 7640117deaade1c1f209888eb06b52ee13dc7ce4045af942d87c81f3f7c0164c
Contents?: true
Size: 1.58 KB
Versions: 4
Compression:
Stored size: 1.58 KB
Contents
#!/usr/bin/env ruby $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ require 'puppet' require 'puppet/network/client' require 'puppettest' require 'socket' require 'facter' class TestFileBucketExe < Test::Unit::TestCase include PuppetTest::ExeTest def test_local 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}} outfile, outmd5 = out.chomp.split(": ") assert_equal(0, $?, "filebucket did not run successfully") assert_equal(file, outfile, "did not output correct file name") assert_equal(md5, outmd5, "did not output correct md5 sum") dipper = Puppet::Network::Client.dipper.new(:Path => bucket) newtext = nil assert_nothing_raised("Could not get file from bucket") do newtext = dipper.getfile(md5) end assert_equal(text, newtext, "did not get correct file from md5 sum") out = %x{filebucket --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}} assert_equal(0, $?, "filebucket did not run successfully") assert_equal(text, File.read(file), "file was not restored") end end # $Id: filebucket.rb 2349 2007-03-24 21:17:37Z luke $
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
puppet-0.22.4 | test/executables/filebucket.rb |
puppet-0.23.0 | test/executables/filebucket.rb |
puppet-0.23.1 | test/executables/filebucket.rb |
puppet-0.23.2 | test/executables/filebucket.rb |