mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[ec2] spec related fixes
This commit is contained in:
parent
14c2da7e3c
commit
07dfb0f9f3
6 changed files with 21 additions and 13 deletions
|
@ -38,7 +38,7 @@ module Fog
|
|||
end
|
||||
|
||||
def get(flavor_id)
|
||||
all.detect {|flavor| flavor.id = flavor_id}
|
||||
all.detect {|flavor| flavor.id == flavor_id}
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -35,7 +35,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
it "should return true if the snapshot is deleted" do
|
||||
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
snapshot = volume.snapshots.create
|
||||
snapshot.wait_for { status == "completed" }
|
||||
snapshot.wait_for { ready? }
|
||||
snapshot.destroy.should be_true
|
||||
volume.destroy
|
||||
end
|
||||
|
@ -69,6 +69,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
|
||||
before(:each) do
|
||||
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
@volume.wait_for { ready? }
|
||||
@snapshot = @volume.snapshots.new
|
||||
end
|
||||
|
||||
|
@ -77,11 +78,10 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
end
|
||||
|
||||
it "should return true when it succeeds" do
|
||||
eventually do
|
||||
@snapshot.save.should be_true
|
||||
@snapshot.wait_for { ready? }
|
||||
@snapshot.destroy
|
||||
end
|
||||
end
|
||||
|
||||
it "should not exist in snapshots before save" do
|
||||
AWS[:ec2].snapshots.get(@snapshot.id).should be_nil
|
||||
|
@ -90,6 +90,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
it "should exist in snapshots after save" do
|
||||
@snapshot.save
|
||||
AWS[:ec2].snapshots.get(@snapshot.id).should_not be_nil
|
||||
@snapshot.wait_for { ready? }
|
||||
@snapshot.destroy
|
||||
end
|
||||
|
||||
|
|
|
@ -19,8 +19,11 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
it "should limit snapshots by volume if present" do
|
||||
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
@other_volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
eventually { @snapshot = @volume.snapshots.create }
|
||||
@volume.wait_for { ready?}
|
||||
@snapshot = @volume.snapshots.create
|
||||
@other_volume.snapshots.all.map {|snapshot| snapshot.id}.should_not include(@snapshot.id)
|
||||
|
||||
@snapshot.wait_for { ready? }
|
||||
@snapshot.destroy
|
||||
@other_volume.destroy
|
||||
@volume.destroy
|
||||
|
@ -32,10 +35,12 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
|
||||
before(:each) do
|
||||
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
@volume.wait_for { ready? }
|
||||
@snapshot = @volume.snapshots.create
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
@snapshot.wait_for { ready? }
|
||||
@snapshot.destroy
|
||||
@volume.destroy
|
||||
end
|
||||
|
@ -55,8 +60,9 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
it "should return a Fog::AWS::EC2::Snapshot if a matching snapshot exists" do
|
||||
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
snapshot = volume.snapshots.create
|
||||
snapshot.wait_for { ready? }
|
||||
get = AWS[:ec2].snapshots.get(snapshot.id)
|
||||
snapshot.attributes.reject {|key, value| [:progress, :status].include?(key)}.should == get.attributes.reject {|key, value| [:progress, :status].include?(key)}
|
||||
snapshot.attributes.should == get.attributes
|
||||
snapshot.destroy
|
||||
end
|
||||
|
||||
|
|
|
@ -49,15 +49,15 @@ describe 'Fog::AWS::EC2::Volume' do
|
|||
before(:each) do
|
||||
@server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
|
||||
@volume = AWS[:ec2].volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
|
||||
@server.wait_for { state == 'running' }
|
||||
@server.wait_for { ready? }
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
@server.destroy
|
||||
if @volume.id
|
||||
@volume.wait_for { status == 'attached' }
|
||||
@volume.wait_for { state == 'attached' }
|
||||
@volume.server = nil
|
||||
@volume.wait_for { status == 'available' }
|
||||
@volume.wait_for { ready? }
|
||||
@volume.destroy
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,8 +40,9 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|||
|
||||
it "should return a Fog::AWS::EC2::Volume if a matching volume exists" do
|
||||
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
volume.wait_for { ready? }
|
||||
get = AWS[:ec2].volumes.get(volume.id)
|
||||
volume.attributes.reject { |key, value| [:device, :status].include?(key) }.should == get.attributes.reject { |key, value| [:device, :status].include?(key) }
|
||||
volume.attributes.should == get.attributes
|
||||
volume.destroy
|
||||
end
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ describe 'Fog::AWS::S3::Directories' do
|
|||
end
|
||||
|
||||
it "should return nil if no matching directory exists" do
|
||||
AWS[:s3].directories.get('fogdirectoryname').should be_nil
|
||||
AWS[:s3].directories.get('fognotadirectory').should be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue