mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[ec2] nicer error messaging, and more accurate errors from mocks
This commit is contained in:
parent
7d872d110a
commit
b7e843b669
36 changed files with 119 additions and 121 deletions
|
@ -25,6 +25,10 @@ require 'fog/model'
|
|||
require 'fog/parser'
|
||||
require 'fog/ssh'
|
||||
|
||||
module Fog
|
||||
class Error < StandardError; end
|
||||
end
|
||||
|
||||
require 'fog/aws'
|
||||
require 'fog/local'
|
||||
require 'fog/rackspace'
|
||||
|
@ -34,6 +38,8 @@ require 'fog/vcloud'
|
|||
|
||||
module Fog
|
||||
|
||||
class MockNotImplemented < Fog::Error; end
|
||||
|
||||
unless const_defined?(:VERSION)
|
||||
VERSION = '0.1.2'
|
||||
end
|
||||
|
@ -50,8 +56,6 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
class MockNotImplemented < StandardError; end
|
||||
|
||||
def self.mock!
|
||||
@mocking = true
|
||||
end
|
||||
|
|
|
@ -2,6 +2,8 @@ module Fog
|
|||
module AWS
|
||||
module EC2
|
||||
|
||||
class Error < Fog::Error; end
|
||||
|
||||
def self.new(options={})
|
||||
|
||||
unless @required
|
||||
|
@ -212,15 +214,23 @@ module Fog
|
|||
}
|
||||
)
|
||||
|
||||
response = @connection.request({
|
||||
:body => body,
|
||||
:expects => 200,
|
||||
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded' },
|
||||
:idempotent => idempotent,
|
||||
:host => @host,
|
||||
:method => 'POST',
|
||||
:parser => parser
|
||||
})
|
||||
begin
|
||||
response = @connection.request({
|
||||
:body => body,
|
||||
:expects => 200,
|
||||
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded' },
|
||||
:idempotent => idempotent,
|
||||
:host => @host,
|
||||
:method => 'POST',
|
||||
:parser => parser
|
||||
})
|
||||
rescue Excon::Errors::Error => error
|
||||
if match = error.message.match(/<Code>(.*)<\/Code><Message>(.*)<\/Message>/)
|
||||
raise Fog::AWS::EC2::Error.new("#{match[1]} => #{match[2]}")
|
||||
else
|
||||
raise error
|
||||
end
|
||||
end
|
||||
|
||||
response
|
||||
end
|
||||
|
|
|
@ -43,11 +43,12 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'return' => true
|
||||
}
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
response
|
||||
elsif !instance
|
||||
raise Fog::AWS::EC2::Error.new("InvalidInstanceID.NotFound => The instance ID '#{instance_id}' does not exist")
|
||||
elsif !address
|
||||
raise Fog::AWS::EC2::Error.new("AuthFailure => The address '#{public_ip}' does not belong to you.")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -54,24 +54,23 @@ module Fog
|
|||
response.body = {
|
||||
'requestId' => Fog::AWS::Mock.request_id
|
||||
}.merge!(data)
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
response
|
||||
elsif !instance
|
||||
raise Fog::AWS::EC2::Error.new("InvalidInstanceID.NotFound => The instance ID '#{instance_id}' does not exist.")
|
||||
elsif !volume
|
||||
raise Fog::AWS::EC2::Error.new("InvalidVolume.NotFound => The volume '#{volume_id}' does not exist.")
|
||||
end
|
||||
else
|
||||
response.status = 400
|
||||
response.body = {
|
||||
'Code' => 'MissingParameter'
|
||||
}
|
||||
message = 'MissingParameter => '
|
||||
if !instance_id
|
||||
response['Message'] = 'The request must contain the parameter instance_id'
|
||||
message << 'The request must contain the parameter instance_id'
|
||||
elsif !volume_id
|
||||
response['Message'] = 'The request must contain the parameter volume_id'
|
||||
message << 'The request must contain the parameter volume_id'
|
||||
else
|
||||
response['Message'] = 'The request must contain the parameter device'
|
||||
message << 'The request must contain the parameter device'
|
||||
end
|
||||
raise Fog::AWS::EC2::Error.new(message)
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -74,11 +74,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'return' => true
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidGroup.NotFound => The security group '#{options['GroupName']}' does not exist")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -40,11 +40,10 @@ module Fog
|
|||
response.body = {
|
||||
'requestId' => Fog::AWS::Mock.request_id
|
||||
}.merge!(data)
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidKeyPair.Duplicate => The keypair '#{key_name}' already exists.")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -41,11 +41,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'return' => true
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidGroup.Duplicate => The security group '#{name}' already exists")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -34,11 +34,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'return' => true
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidGroup.NotFound => The security group '#{name}' does not exist")
|
||||
end
|
||||
response
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,11 +34,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'return' => true
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidSnapshot.NotFound => The snapshot '#{snapshot_id}' does not exist.")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -36,11 +36,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'return' => true
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidVolume.NotFound => The volume '#{volume_id}' does not exist.")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -42,11 +42,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'addressesSet' => addresses_set
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidAddress.NotFound => Address #{public_ip.inspect} not found.")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -50,11 +50,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'availabilityZoneInfo' => availability_zone_info
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidParameterValue => Invalid availability zone: #{zone_name.inspect}")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -115,11 +115,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'reservationSet' => reservation_set.values
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidInstanceID.NotFound => The instance ID #{instance_id.inspect} does not exist")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -44,11 +44,10 @@ module Fog
|
|||
key.reject {|key,value| !['keyFingerprint', 'keyName'].include?(key)}
|
||||
end
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidKeyPair.NotFound => The key pair #{key_name.inspect} does not exist")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -47,11 +47,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'regionInfo' => region_info
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidParameterValue => Invalid region: #{region_name.inspect}")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -52,11 +52,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'securityGroupInfo' => security_group_info
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidGroup.NotFound => The security group #{group_name.inspect} does not exist")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -66,11 +66,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'snapshotSet' => snapshot_set
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidSnapshot.NotFound => The snapshot #{snapshot_id.inspect} does not exist.")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -72,11 +72,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'volumeSet' => volume_set
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidVolume.NotFound => The volume #{volume_id.inspect} does not exist.")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -44,11 +44,10 @@ module Fog
|
|||
response.body = {
|
||||
'requestId' => Fog::AWS::Mock.request_id
|
||||
}.merge!(data)
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidVolume.NotFound => The volume '#{volume_id}' does not exist.")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -40,11 +40,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'return' => true
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("AuthFailure => The address '#{public_ip}' does not belong to you.")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -38,11 +38,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'timestamp' => Time.now
|
||||
}
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
response
|
||||
else;
|
||||
raise Fog::AWS::EC2::Error.new("InvalidInstanceID.NotFound => The instance ID '#{instance_id}' does not exist")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -38,11 +38,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'return' => true
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidInstanceID.NotFound => The instance ID #{instance_id.inspect} does not exist")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -31,11 +31,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'return' => true
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("AuthFailure => The address '#{public_ip}' does not belong to you.")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -62,11 +62,10 @@ module Fog
|
|||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'return' => true
|
||||
}
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidGroup.NotFound => The security group '#{options['GroupName']}' does not exist")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -77,11 +77,11 @@ module Fog
|
|||
detach_volume(volume['volumeId'])
|
||||
end
|
||||
end
|
||||
|
||||
response
|
||||
else
|
||||
response.status = 400
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
raise Fog::AWS::EC2::Error.new("InvalidInstanceID.NotFound => The instance ID '#{instance_id}' does not exist")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -94,10 +94,10 @@ describe 'EC2.describe_instances' do
|
|||
end
|
||||
describe 'failure' do
|
||||
|
||||
it 'should raise a BadRequest error if the instance does not exist' do
|
||||
it 'should raise a Fog::AWS::EC2::Error if the instance does not exist' do
|
||||
lambda {
|
||||
AWS[:ec2].describe_instances('i-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
}.should raise_error(Fog::AWS::EC2::Error)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -25,10 +25,10 @@ describe 'EC2.get_console_output' do
|
|||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the instance does not exist" do
|
||||
it "should raise a Fog::AWS::EC2::Error if the instance does not exist" do
|
||||
lambda {
|
||||
AWS[:ec2].get_console_output('i-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
}.should raise_error(Fog::AWS::EC2::Error)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -20,10 +20,10 @@ describe 'EC2.reboot_instances' do
|
|||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the instance does not exist" do
|
||||
it "should raise a Fog::AWS::EC2::Error if the instance does not exist" do
|
||||
lambda {
|
||||
AWS[:ec2].reboot_instances('i-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
}.should raise_error(Fog::AWS::EC2::Error)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -25,10 +25,10 @@ describe 'EC2.terminate_instances' do
|
|||
end
|
||||
describe 'failure' do
|
||||
|
||||
it 'should raise a BadRequest error if the instance does not exist' do
|
||||
it 'should raise a Fog::AWS::EC2::Error if the instance does not exist' do
|
||||
lambda {
|
||||
AWS[:ec2].terminate_instances('i-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
}.should raise_error(Fog::AWS::EC2::Error)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -39,23 +39,27 @@ Shindo.tests('AWS::EC2 | address requests', ['aws']) do
|
|||
|
||||
@address = AWS[:ec2].addresses.create
|
||||
|
||||
tests("#describe_addresses('127.0.0.1')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#describe_addresses('127.0.0.1')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].describe_addresses('127.0.0.1')
|
||||
end
|
||||
|
||||
tests("#associate_addresses('i-00000000', '#{@address.identity}')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#associate_addresses('i-00000000', '#{@address.identity}')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].associate_address('i-00000000', @address.identity)
|
||||
end
|
||||
|
||||
tests("#associate_addresses('#{@server.identity}', '127.0.0.1')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#associate_addresses('#{@server.identity}', '127.0.0.1')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].associate_address(@server.identity, '127.0.0.1')
|
||||
end
|
||||
|
||||
tests("#disassociate_addresses('127.0.0.1') raises BadRequest error").raises(Excon::Errors::BadRequest) do
|
||||
tests("#associate_addresses('i-00000000', '127.0.0.1')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].associate_address('i-00000000', '127.0.0.1')
|
||||
end
|
||||
|
||||
tests("#disassociate_addresses('127.0.0.1') raises BadRequest error").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].disassociate_address('127.0.0.1')
|
||||
end
|
||||
|
||||
tests("#release_address('127.0.0.1')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#release_address('127.0.0.1')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].release_address('127.0.0.1')
|
||||
end
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ Shindo.tests('AWS::EC2 | availability zone requests', ['aws']) do
|
|||
|
||||
tests('failure') do
|
||||
|
||||
tests("#describe_availability_zones('not-a-zone')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#describe_availability_zones('not-a-zone')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].describe_availability_zones('not-a-zone')
|
||||
end
|
||||
|
||||
|
|
|
@ -29,11 +29,11 @@ Shindo.tests('AWS::EC2 | key pair requests', ['aws']) do
|
|||
|
||||
@key_pair = AWS[:ec2].key_pairs.create(:name => 'fog_key_pair')
|
||||
|
||||
tests("duplicate #create_key_pair('#{@key_pair.name}')").raises(Excon::Errors::BadRequest) do
|
||||
tests("duplicate #create_key_pair('#{@key_pair.name}')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].create_key_pair(@key_pair.name)
|
||||
end
|
||||
|
||||
tests("#describe_key_pair('not_a_key_name')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#describe_key_pair('not_a_key_name')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].describe_key_pairs('not_a_key_name').body
|
||||
end
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ Shindo.tests('AWS::EC2 | region requests', ['aws']) do
|
|||
|
||||
tests('failure') do
|
||||
|
||||
tests("#describe_regions('not-a-region')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#describe_regions('not-a-region')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].describe_regions('not-a-region')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -59,11 +59,11 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|||
|
||||
@security_group = AWS[:ec2].security_groups.create(:description => 'tests group', :name => 'fog_security_group')
|
||||
|
||||
tests("duplicate #create_security_group(#{@security_group.name}, #{@security_group.description})").raises(Excon::Errors::BadRequest) do
|
||||
tests("duplicate #create_security_group(#{@security_group.name}, #{@security_group.description})").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].create_security_group(@security_group.name, @security_group.description)
|
||||
end
|
||||
|
||||
tests("#authorize_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Excon::Errors::BadRequest) do
|
||||
tests("#authorize_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].authorize_security_group_ingress({
|
||||
'FromPort' => 80,
|
||||
'GroupName' => 'not_a_group_name',
|
||||
|
@ -72,7 +72,7 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|||
})
|
||||
end
|
||||
|
||||
tests("#authorize_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Excon::Errors::BadRequest) do
|
||||
tests("#authorize_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].authorize_security_group_ingress({
|
||||
'GroupName' => 'not_a_group_name',
|
||||
'SourceSecurityGroupName' => 'not_a_group_name',
|
||||
|
@ -80,11 +80,11 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|||
})
|
||||
end
|
||||
|
||||
tests("#describe_security_group('not_a_group_name)").raises(Excon::Errors::BadRequest) do
|
||||
tests("#describe_security_group('not_a_group_name)").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].describe_security_groups('not_a_group_name')
|
||||
end
|
||||
|
||||
tests("#revoke_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Excon::Errors::BadRequest) do
|
||||
tests("#revoke_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].revoke_security_group_ingress({
|
||||
'FromPort' => 80,
|
||||
'GroupName' => 'not_a_group_name',
|
||||
|
@ -93,7 +93,7 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|||
})
|
||||
end
|
||||
|
||||
tests("#revoke_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Excon::Errors::BadRequest) do
|
||||
tests("#revoke_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].revoke_security_group_ingress({
|
||||
'GroupName' => 'not_a_group_name',
|
||||
'SourceSecurityGroupName' => 'not_a_group_name',
|
||||
|
@ -101,7 +101,7 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|||
})
|
||||
end
|
||||
|
||||
tests("#delete_security_group('not_a_group_name')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#delete_security_group('not_a_group_name')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].delete_security_group('not_a_group_name')
|
||||
end
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ Shindo.tests('AWS::EC2 | snapshot requests', ['aws']) do
|
|||
end
|
||||
tests ('failure') do
|
||||
|
||||
tests("#describe_snapshot('snap-00000000')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#describe_snapshot('snap-00000000')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].describe_snapshots('snap-00000000')
|
||||
end
|
||||
|
||||
tests("#delete_snapshot('snap-00000000')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#delete_snapshot('snap-00000000')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].delete_snapshot('snap-00000000')
|
||||
end
|
||||
|
||||
|
|
|
@ -41,23 +41,23 @@ Shindo.tests('AWS::EC2 | volume requests', ['aws']) do
|
|||
|
||||
@volume = AWS[:ec2].volumes.create(:availability_zone => @server.availability_zone, :size => 1)
|
||||
|
||||
tests("#describe_volume('vol-00000000')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#describe_volume('vol-00000000')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].describe_volumes('vol-00000000')
|
||||
end
|
||||
|
||||
tests("#attach_volume('i-00000000', '#{@volume.identity}', '/dev/sdh')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#attach_volume('i-00000000', '#{@volume.identity}', '/dev/sdh')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].attach_volume('i-00000000', @volume.identity, '/dev/sdh')
|
||||
end
|
||||
|
||||
tests("#attach_volume('#{@server.identity}', 'vol-00000000', '/dev/sdh')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#attach_volume('#{@server.identity}', 'vol-00000000', '/dev/sdh')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].attach_volume(@server.identity, 'vol-00000000', '/dev/sdh')
|
||||
end
|
||||
|
||||
tests("#detach_volume('vol-00000000')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#detach_volume('vol-00000000')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].detach_volume('vol-00000000')
|
||||
end
|
||||
|
||||
tests("#delete_volume('vol-00000000')").raises(Excon::Errors::BadRequest) do
|
||||
tests("#delete_volume('vol-00000000')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].delete_volume('vol-00000000')
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue