diff --git a/spec/aws/requests/ec2/associate_address_spec.rb b/spec/aws/requests/ec2/associate_address_spec.rb index 50ad6e582..1bb591596 100644 --- a/spec/aws/requests/ec2/associate_address_spec.rb +++ b/spec/aws/requests/ec2/associate_address_spec.rb @@ -6,6 +6,7 @@ describe 'EC2.associate_address' do before(:each) do @instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId'] @public_ip = AWS[:ec2].allocate_address.body['publicIp'] + AWS[:ec2].servers.get(@instance_id).wait_for { ready? } end after(:each) do @@ -14,11 +15,9 @@ describe 'EC2.associate_address' do end it "should return proper attributes" do - eventually(128) do - actual = AWS[:ec2].associate_address(@instance_id, @public_ip) - actual.body['requestId'].should be_a(String) - [false, true].should include(actual.body['return']) - end + actual = AWS[:ec2].associate_address(@instance_id, @public_ip) + actual.body['requestId'].should be_a(String) + [false, true].should include(actual.body['return']) end end diff --git a/spec/aws/requests/ec2/attach_volume_spec.rb b/spec/aws/requests/ec2/attach_volume_spec.rb index 32a16c323..b6f97f832 100644 --- a/spec/aws/requests/ec2/attach_volume_spec.rb +++ b/spec/aws/requests/ec2/attach_volume_spec.rb @@ -6,28 +6,26 @@ describe 'EC2.attach_volume' do before(:each) do @instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId'] @volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId'] + AWS[:ec2].servers.get(@instance_id).wait_for { ready? } + AWS[:ec2].volumes.get(@volume_id).wait_for { ready? } end after(:each) do - eventually do - AWS[:ec2].detach_volume(@volume_id) - end - eventually do - AWS[:ec2].delete_volume(@volume_id) - AWS[:ec2].terminate_instances(@instance_id) - end + AWS[:ec2].volumes.get(@volume_id).wait_for { state == 'attached' } + AWS[:ec2].detach_volume(@volume_id) + AWS[:ec2].volumes.get(@volume_id).wait_for { ready? } + AWS[:ec2].delete_volume(@volume_id) + AWS[:ec2].terminate_instances(@instance_id) end it "should return proper attributes" do - eventually(128) do - actual = AWS[:ec2].attach_volume(@instance_id, @volume_id, '/dev/sdh') - actual.body['attachTime'].should be_a(Time) - actual.body['device'].should be_a(String) - actual.body['instanceId'].should be_a(String) - actual.body['requestId'].should be_a(String) - actual.body['status'].should be_a(String) - actual.body['volumeId'].should be_a(String) - end + actual = AWS[:ec2].attach_volume(@instance_id, @volume_id, '/dev/sdh') + actual.body['attachTime'].should be_a(Time) + actual.body['device'].should be_a(String) + actual.body['instanceId'].should be_a(String) + actual.body['requestId'].should be_a(String) + actual.body['status'].should be_a(String) + actual.body['volumeId'].should be_a(String) end end diff --git a/spec/aws/requests/ec2/create_snapshot_spec.rb b/spec/aws/requests/ec2/create_snapshot_spec.rb index c0b955db5..b46c5d26b 100644 --- a/spec/aws/requests/ec2/create_snapshot_spec.rb +++ b/spec/aws/requests/ec2/create_snapshot_spec.rb @@ -9,9 +9,8 @@ describe 'EC2.create_snapshot' do after(:each) do AWS[:ec2].delete_volume(@volume_id) - eventually do - AWS[:ec2].delete_snapshot(@snapshot_id) - end + AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? } + AWS[:ec2].delete_snapshot(@snapshot_id) end it "should return proper attributes" do diff --git a/spec/aws/requests/ec2/delete_snapshot_spec.rb b/spec/aws/requests/ec2/delete_snapshot_spec.rb index 7247c9cd4..eccddb377 100644 --- a/spec/aws/requests/ec2/delete_snapshot_spec.rb +++ b/spec/aws/requests/ec2/delete_snapshot_spec.rb @@ -13,12 +13,11 @@ describe 'EC2.delete_snapshot' do end it "should return proper attributes" do - eventually do - actual = AWS[:ec2].delete_snapshot(@snapshot_id) - unless actual.body.empty? - actual.body['requestId'].should be_a(String) - [false, true].should include(actual.body['return']) - end + AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? } + actual = AWS[:ec2].delete_snapshot(@snapshot_id) + unless actual.body.empty? + actual.body['requestId'].should be_a(String) + [false, true].should include(actual.body['return']) end end diff --git a/spec/aws/requests/ec2/describe_snapshots_spec.rb b/spec/aws/requests/ec2/describe_snapshots_spec.rb index b32558174..1d651d045 100644 --- a/spec/aws/requests/ec2/describe_snapshots_spec.rb +++ b/spec/aws/requests/ec2/describe_snapshots_spec.rb @@ -3,42 +3,37 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe 'EC2.describe_snapshots' do describe 'success' do - before(:each) do + before(:all) do @volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId'] @snapshot_id = AWS[:ec2].create_snapshot(@volume_id).body['snapshotId'] + AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? } end - after(:each) do + after(:all) do AWS[:ec2].delete_volume(@volume_id) - eventually do - AWS[:ec2].delete_snapshot(@snapshot_id) - end + AWS[:ec2].delete_snapshot(@snapshot_id) end it "should return proper attributes with no params" do - eventually do - actual = AWS[:ec2].describe_snapshots - actual.body['snapshotSet'].should be_an(Array) - snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first - snapshot['progress'].should be_a(String) - snapshot['snapshotId'].should be_a(String) - snapshot['startTime'].should be_a(Time) - snapshot['status'].should be_a(String) - snapshot['volumeId'].should be_a(String) - end + actual = AWS[:ec2].describe_snapshots + actual.body['snapshotSet'].should be_an(Array) + snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first + snapshot['progress'].should be_a(String) + snapshot['snapshotId'].should be_a(String) + snapshot['startTime'].should be_a(Time) + snapshot['status'].should be_a(String) + snapshot['volumeId'].should be_a(String) end it "should return proper attributes with params" do - eventually do - actual = AWS[:ec2].describe_snapshots([@snapshot_id]) - actual.body['snapshotSet'].should be_an(Array) - snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first - snapshot['progress'].should be_a(String) - snapshot['snapshotId'].should be_a(String) - snapshot['startTime'].should be_a(Time) - snapshot['status'].should be_a(String) - snapshot['volumeId'].should be_a(String) - end + actual = AWS[:ec2].describe_snapshots([@snapshot_id]) + actual.body['snapshotSet'].should be_an(Array) + snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first + snapshot['progress'].should be_a(String) + snapshot['snapshotId'].should be_a(String) + snapshot['startTime'].should be_a(Time) + snapshot['status'].should be_a(String) + snapshot['volumeId'].should be_a(String) end end diff --git a/spec/aws/requests/ec2/detach_volume_spec.rb b/spec/aws/requests/ec2/detach_volume_spec.rb index adfdab3cb..cb425555e 100644 --- a/spec/aws/requests/ec2/detach_volume_spec.rb +++ b/spec/aws/requests/ec2/detach_volume_spec.rb @@ -6,28 +6,26 @@ describe 'EC2.detach_volume' do before(:each) do @instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId'] @volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId'] - eventually(128) do - AWS[:ec2].attach_volume(@instance_id, @volume_id, '/dev/sdh') - end + AWS[:ec2].servers.get(@instance_id).wait_for { ready? } + AWS[:ec2].servers.get(@instance_id).wait_for { ready? } + AWS[:ec2].attach_volume(@instance_id, @volume_id, '/dev/sdh') + AWS[:ec2].volumes.get(@volume_id).wait_for { ready? } end after(:each) do - eventually do - AWS[:ec2].delete_volume(@volume_id) - AWS[:ec2].terminate_instances([@instance_id]) - end + AWS[:ec2].volumes.get(@volume_id).wait_for { ready? } + AWS[:ec2].delete_volume(@volume_id) + AWS[:ec2].terminate_instances([@instance_id]) end it "should return proper attributes" do - eventually do - actual = AWS[:ec2].detach_volume(@volume_id) - actual.body['attachTime'].should be_a(Time) - actual.body['device'].should be_a(String) - actual.body['instanceId'].should be_a(String) - actual.body['requestId'].should be_a(String) - actual.body['status'].should be_a(String) - actual.body['volumeId'].should be_a(String) - end + actual = AWS[:ec2].detach_volume(@volume_id) + actual.body['attachTime'].should be_a(Time) + actual.body['device'].should be_a(String) + actual.body['instanceId'].should be_a(String) + actual.body['requestId'].should be_a(String) + actual.body['status'].should be_a(String) + actual.body['volumeId'].should be_a(String) end end diff --git a/spec/aws/requests/ec2/disassociate_address_spec.rb b/spec/aws/requests/ec2/disassociate_address_spec.rb index 9d0d926ea..a5b12810b 100644 --- a/spec/aws/requests/ec2/disassociate_address_spec.rb +++ b/spec/aws/requests/ec2/disassociate_address_spec.rb @@ -5,10 +5,9 @@ describe 'EC2.disassociate_address' do before(:each) do @instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId'] - eventually(128) do - @public_ip = AWS[:ec2].allocate_address.body['publicIp'] - AWS[:ec2].associate_address(@instance_id, @public_ip) - end + @public_ip = AWS[:ec2].allocate_address.body['publicIp'] + AWS[:ec2].servers.get(@instance_id).wait_for { ready? } + AWS[:ec2].associate_address(@instance_id, @public_ip) end after(:each) do diff --git a/spec/aws/requests/s3/get_service_spec.rb b/spec/aws/requests/s3/get_service_spec.rb index 155bcbe14..6dd49b264 100644 --- a/spec/aws/requests/s3/get_service_spec.rb +++ b/spec/aws/requests/s3/get_service_spec.rb @@ -3,11 +3,12 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe 'S3.get_service' do describe 'success' do - before(:each) do + before(:all) do AWS[:s3].put_bucket('foggetservice') + wait_for { AWS[:s3].directories.get('foggetservice') } end - after(:each) do + after(:all) do AWS[:s3].delete_bucket('foggetservice') end @@ -23,10 +24,8 @@ describe 'S3.get_service' do end it 'should include foggetservice in get_service' do - eventually do - actual = AWS[:s3].get_service - actual.body['Buckets'].collect { |bucket| bucket['Name'] }.should include('foggetservice') - end + actual = AWS[:s3].get_service + actual.body['Buckets'].collect { |bucket| bucket['Name'] }.should include('foggetservice') end end