Sha256: d2b6a58bb56b85ac0202b5203b769a37be54e07ac8b71423bc93e74bb34b645f
Contents?: true
Size: 1.85 KB
Versions: 1
Compression:
Stored size: 1.85 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require "fileutils" include FileUtils describe "s3 upload with paging" do before(:all) do # need both local and instance vars # instance variables are used in tests # local variables are used in the backup definition (instance vars can't be seen) @root = root = "/tmp/safe-s3" # clean state rm_rf @root mkdir_p @root # create source tree @src = src = File.join(root, "src") mkdir_p File.join(src, 'dir1', 'dir2', 'dir3') mkdir_p File.join(src, 'dir3', 'dir4', 'dir5') File.open(File.join(src, 'file1'), "w") {|f| f.write("dir1") } File.open(File.join(src, 'dir1', 'file2'), "w") {|f| f.write("dir2"*2) } File.open(File.join(src, 'dir1', 'dir2', 'file3'), "w") {|f| f.write("dir3"*3) } @dst = dst = File.join(@root, 'backup') mkdir_p @dst @now = Time.now @timestamp = @now.strftime("%y%m%d-%H%M") stub(Time).now {@now} # Freeze Astrails::Safe.safe do local :path => "#{dst}/:kind" s3 do key SERVICES_CONFIG['s3']['key'] secret SERVICES_CONFIG['s3']['secret'] bucket SERVICES_CONFIG['s3']['bucket'] path ":kind/" # this is default end page do page_size 20 end tar do archive :test1 do files src end end end @backup_file = "archive/archive-test1.#{@timestamp}.tar" @backup_path = File.join(dst, @backup_file) end it "should upload all files to s3" do AWS::S3::Base.establish_connection!(:access_key_id => SERVICES_CONFIG['s3']['key'], :secret_access_key => SERVICES_CONFIG['s3']['secret'], :use_ssl => true) files = Dir.glob("#{@backup_path}*") files.each do |file| file.gsub!("#{@dst}/", '') AWS::S3::S3Object.exists?(file, "df-dev-test").should be_true end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
darkofabijan-astrails-safe-0.2.9 | spec/integration/s3_paging_integration_spec.rb |