Sha256: ae6313836fc7b78b72892b0b74725e88912794ec1f9294e9da5ea3c741a450dc

Contents?: true

Size: 1.91 KB

Versions: 36

Compression:

Stored size: 1.91 KB

Contents

group "EC2"
library :rudy, 'lib'

tryouts "Snapshots" do
  set :global, Rudy::Huxtable.global
  setup do
    Rudy::Huxtable.update_config
    Rudy::AWS::EC2.connect global.accesskey, global.secretkey, global.region
    Rudy::AWS::EC2::Volumes.create 3, global.zone
  end
  clean do
    Rudy::AWS::EC2::Volumes.list(:available) do |v|
      Rudy::AWS::EC2::Volumes.destroy v
    end
  end
  
  drill "no existing snapshots", false do
    Rudy::AWS::EC2::Snapshots.any?
  end
  
    dream :class, Rudy::AWS::EC2::Snapshot
  drill "create snapshot" do
    vol = Rudy::AWS::EC2::Volumes.list(:available).first
    Rudy::AWS::EC2::Snapshots.create vol.awsid
  end
  
    dream :class, Array
    dream :empty?, false
  drill "list snapshots as Array" do
    Rudy::AWS::EC2::Snapshots.list
  end

    dream :class, Hash
    dream :empty?, false
  drill "list snapshots as Hash" do
    Rudy::AWS::EC2::Snapshots.list_as_hash
  end
  
    dream :class, Rudy::AWS::EC2::Snapshot
  drill "get snapshot from id" do
    snap = Rudy::AWS::EC2::Snapshots.list.first
    Rudy::AWS::EC2::Snapshots.get snap.awsid
  end
  
    dream :class, Rudy::AWS::EC2::Volume
    dream :size, 3
    dream :proc, lambda { |v| v.creating? || v.available? }
    dream :proc, lambda { |v|
      snap = Rudy::AWS::EC2::Snapshots.list.first
      v.snapid == snap.awsid
    }
  drill "create volume from snapshot" do
    snap = Rudy::AWS::EC2::Snapshots.list.first
    Rudy::AWS::EC2::Volumes.create 3, global.zone, snap.awsid
  end
  
  drill "destroy snapshots", false do
    Rudy::AWS::EC2::Snapshots.list.each do |snap|
      Rudy::AWS::EC2::Snapshots.destroy snap.awsid
    end
    Rudy::AWS::EC2::Snapshots.any?
  end
end

__END__

 
 should "(90) destroy snapshots" do
   assert @ec2snap.any?, "No snapshots"
   snap_list = @ec2snap.list
   snap_list.each do |snap|
     next unless snap.completed?
     assert @ec2snap.destroy(snap.awsid), "Not destroyed (#{snap.awsid})"
   end
 end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
solutious-rudy-0.9.0 tryouts/25_ec2/50_snapshots_tryouts.rb
solutious-rudy-0.9.1 tryouts/25_ec2/50_snapshots_tryouts.rb
solutious-rudy-0.9.2 tryouts/25_ec2/50_snapshots_tryouts.rb
solutious-rudy-0.9.3 tryouts/25_ec2/50_snapshots_tryouts.rb
solutious-rudy-0.9.4 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.020 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.019 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.018 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.017 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.016 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.015 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.014 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.013 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.012 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.011 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.010 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.009 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.008 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.007 tryouts/25_ec2/50_snapshots_tryouts.rb
rudy-0.9.8.006 tryouts/25_ec2/50_snapshots_tryouts.rb