1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

git grep -l "Compute::AWS" -- tests/ | xargs sed -i "" "s/Compute::AWS/AWS::Compute/g"

This commit is contained in:
sue445 2018-09-12 18:35:01 +09:00
parent af3564d0db
commit d9d9d2f97f
26 changed files with 113 additions and 113 deletions

View file

@ -23,7 +23,7 @@ Shindo.tests('AWS | credentials', ['aws']) do
:aws_secret_access_key => 'dummysecret', :aws_secret_access_key => 'dummysecret',
:aws_session_token => 'dummytoken', :aws_session_token => 'dummytoken',
:region => "us-west-1", :region => "us-west-1",
:aws_credentials_expire_at => expires_at}) { Fog::Compute::AWS.fetch_credentials(:use_iam_profile => true) } :aws_credentials_expire_at => expires_at}) { Fog::AWS::Compute.fetch_credentials(:use_iam_profile => true) }
end end
ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"] = '/v1/credentials?id=task_id' ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"] = '/v1/credentials?id=task_id'
@ -34,12 +34,12 @@ Shindo.tests('AWS | credentials', ['aws']) do
:aws_secret_access_key => 'dummysecret', :aws_secret_access_key => 'dummysecret',
:aws_session_token => 'dummytoken', :aws_session_token => 'dummytoken',
:region => "us-west-1", :region => "us-west-1",
:aws_credentials_expire_at => expires_at}) { Fog::Compute::AWS.fetch_credentials(:use_iam_profile => true) } :aws_credentials_expire_at => expires_at}) { Fog::AWS::Compute.fetch_credentials(:use_iam_profile => true) }
end end
ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"] = nil ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"] = nil
compute = Fog::Compute::AWS.new(:use_iam_profile => true) compute = Fog::AWS::Compute.new(:use_iam_profile => true)
tests("#refresh_credentials_if_expired") do tests("#refresh_credentials_if_expired") do
returns(nil){compute.refresh_credentials_if_expired} returns(nil){compute.refresh_credentials_if_expired}
@ -58,11 +58,11 @@ Shindo.tests('AWS | credentials', ['aws']) do
end end
Fog::Time.now = Time.now Fog::Time.now = Time.now
default_credentials = Fog::Compute::AWS.fetch_credentials({}) default_credentials = Fog::AWS::Compute.fetch_credentials({})
tests("#fetch_credentials when the url 404s") do tests("#fetch_credentials when the url 404s") do
Excon.stub({:method => :get, :path => "/latest/meta-data/iam/security-credentials/"}, {:status => 404, :body => 'not bound'}) Excon.stub({:method => :get, :path => "/latest/meta-data/iam/security-credentials/"}, {:status => 404, :body => 'not bound'})
Excon.stub({:method => :get, :path => "/latest/meta-data/placement/availability-zone/"}, {:status => 400, :body => 'not found'}) Excon.stub({:method => :get, :path => "/latest/meta-data/placement/availability-zone/"}, {:status => 400, :body => 'not found'})
returns(default_credentials) {Fog::Compute::AWS.fetch_credentials(:use_iam_profile => true)} returns(default_credentials) {Fog::AWS::Compute.fetch_credentials(:use_iam_profile => true)}
end end
mocked_credentials = { mocked_credentials = {
@ -73,8 +73,8 @@ Shindo.tests('AWS | credentials', ['aws']) do
} }
tests("#fetch_credentials when mocking") do tests("#fetch_credentials when mocking") do
Fog.mock! Fog.mock!
Fog::Compute::AWS::Mock.data[:iam_role_based_creds] = mocked_credentials Fog::AWS::Compute::Mock.data[:iam_role_based_creds] = mocked_credentials
returns(mocked_credentials) {Fog::Compute::AWS.fetch_credentials(:use_iam_profile => true)} returns(mocked_credentials) {Fog::AWS::Compute.fetch_credentials(:use_iam_profile => true)}
end end
ensure ensure

View file

@ -36,7 +36,7 @@ Shindo.tests("Fog::Compute[:aws] | address", ['aws']) do
end end
model_tests(Fog::Compute[:aws].addresses, { :domain => "vpc" }, true) do model_tests(Fog::Compute[:aws].addresses, { :domain => "vpc" }, true) do
tests("#change_scope").raises(Fog::Compute::AWS::Error) do tests("#change_scope").raises(Fog::AWS::Compute::Error) do
@instance.change_scope @instance.change_scope
end end
end end

View file

@ -38,7 +38,7 @@ Shindo.tests("Fog::Compute[:aws] | network_acl", ['aws']) do
default_rules = @new_nacl.entries.dup default_rules = @new_nacl.entries.dup
test("add a new inbound rule") do test("add a new inbound rule") do
@new_nacl.add_inbound_rule(100, Fog::Compute::AWS::NetworkAcl::TCP, 'allow', '0.0.0.0/0', 'PortRange.From' => 22, 'PortRange.To' => 22) @new_nacl.add_inbound_rule(100, Fog::AWS::Compute::NetworkAcl::TCP, 'allow', '0.0.0.0/0', 'PortRange.From' => 22, 'PortRange.To' => 22)
@new_nacl.reload @new_nacl.reload
(@new_nacl.entries - default_rules) == [{ (@new_nacl.entries - default_rules) == [{
"icmpTypeCode" => {}, "icmpTypeCode" => {},
@ -61,7 +61,7 @@ Shindo.tests("Fog::Compute[:aws] | network_acl", ['aws']) do
end end
test("add a new outbound rule") do test("add a new outbound rule") do
@new_nacl.add_outbound_rule(100, Fog::Compute::AWS::NetworkAcl::TCP, 'allow', '0.0.0.0/0', 'PortRange.From' => 22, 'PortRange.To' => 22) @new_nacl.add_outbound_rule(100, Fog::AWS::Compute::NetworkAcl::TCP, 'allow', '0.0.0.0/0', 'PortRange.From' => 22, 'PortRange.To' => 22)
@new_nacl.reload @new_nacl.reload
(@new_nacl.entries - default_rules) == [{ (@new_nacl.entries - default_rules) == [{
"icmpTypeCode" => {}, "icmpTypeCode" => {},
@ -84,8 +84,8 @@ Shindo.tests("Fog::Compute[:aws] | network_acl", ['aws']) do
end end
test("update rule") do test("update rule") do
@new_nacl.add_inbound_rule(100, Fog::Compute::AWS::NetworkAcl::TCP, 'allow', '0.0.0.0/0', 'PortRange.From' => 22, 'PortRange.To' => 22) @new_nacl.add_inbound_rule(100, Fog::AWS::Compute::NetworkAcl::TCP, 'allow', '0.0.0.0/0', 'PortRange.From' => 22, 'PortRange.To' => 22)
@new_nacl.update_inbound_rule(100, Fog::Compute::AWS::NetworkAcl::TCP, 'allow', '10.0.0.0/8', 'PortRange.From' => 22, 'PortRange.To' => 22) @new_nacl.update_inbound_rule(100, Fog::AWS::Compute::NetworkAcl::TCP, 'allow', '10.0.0.0/8', 'PortRange.From' => 22, 'PortRange.To' => 22)
@new_nacl.reload @new_nacl.reload
(@new_nacl.entries - default_rules) == [{ (@new_nacl.entries - default_rules) == [{
"icmpTypeCode" => {}, "icmpTypeCode" => {},

View file

@ -85,7 +85,7 @@ Shindo.tests("Fog::Compute[:aws] | security_group", ['aws']) do
{ @other_user_id => @other_users_group_id } { @other_user_id => @other_users_group_id }
].each do |group_arg| ].each do |group_arg|
test("does not authorize port range access by an invalid security group #{group_arg.inspect}") do test("does not authorize port range access by an invalid security group #{group_arg.inspect}") do
raises(Fog::Compute::AWS::NotFound, "The security group '#{@other_users_group_id}' does not exist") { raises(Fog::AWS::Compute::NotFound, "The security group '#{@other_users_group_id}' does not exist") {
@other_group.reload @other_group.reload
@group.authorize_port_range(5000..6000, {:group => group_arg}) @group.authorize_port_range(5000..6000, {:group => group_arg})
} }

View file

@ -25,7 +25,7 @@ Shindo.tests('Fog::Compute[:aws] | volume', ['aws']) do
@instance.server.nil? @instance.server.nil?
end end
tests('#server=').raises(NoMethodError, 'use Fog::Compute::AWS::Volume#attach(server, device)') do tests('#server=').raises(NoMethodError, 'use Fog::AWS::Compute::Volume#attach(server, device)') do
@instance.server = @server @instance.server = @server
end end

View file

@ -1,5 +1,5 @@
Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
Fog::Compute::AWS::Mock.reset if Fog.mocking? Fog::AWS::Compute::Mock.reset if Fog.mocking?
@availability_zones = Fog::Compute[:aws].describe_availability_zones('state' => 'available').body['availabilityZoneInfo'].map{ |az| az['zoneName'] } @availability_zones = Fog::Compute[:aws].describe_availability_zones('state' => 'available').body['availabilityZoneInfo'].map{ |az| az['zoneName'] }
@key_name = 'fog-test-model' @key_name = 'fog-test-model'
@vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24') @vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')

View file

@ -24,9 +24,9 @@ DESCRIBE_IMAGES_RESULT = <<-EOF
</DescribeImagesResponse> </DescribeImagesResponse>
EOF EOF
Shindo.tests('Compute::AWS | parsers | describe_images', ['compute', 'aws', 'parser']) do Shindo.tests('AWS::Compute | parsers | describe_images', ['compute', 'aws', 'parser']) do
tests('parses the xml').formats(AWS::Compute::Formats::DESCRIBE_IMAGES) do tests('parses the xml').formats(AWS::Compute::Formats::DESCRIBE_IMAGES) do
parser = Nokogiri::XML::SAX::Parser.new(Fog::Parsers::Compute::AWS::DescribeImages.new) parser = Nokogiri::XML::SAX::Parser.new(Fog::Parsers::AWS::Compute::DescribeImages.new)
parser.parse(DESCRIBE_IMAGES_RESULT) parser.parse(DESCRIBE_IMAGES_RESULT)
parser.document.response parser.document.response
end end

View file

@ -72,7 +72,7 @@ Shindo.tests('Fog::Compute[:aws] | address requests', ['aws']) do
compute.associate_address({:instance_id=>@server.id, :allocation_id=>@vpc_allocation_id}).body compute.associate_address({:instance_id=>@server.id, :allocation_id=>@vpc_allocation_id}).body
end end
tests("#disassociate_address('#{@vpc_public_ip}')").raises(Fog::Compute::AWS::Error) do tests("#disassociate_address('#{@vpc_public_ip}')").raises(Fog::AWS::Compute::Error) do
compute.disassociate_address(@vpc_public_ip) compute.disassociate_address(@vpc_public_ip)
end end
@ -95,38 +95,38 @@ Shindo.tests('Fog::Compute[:aws] | address requests', ['aws']) do
@address = compute.addresses.create @address = compute.addresses.create
@vpc_address = compute.addresses.create(:domain => 'vpc') @vpc_address = compute.addresses.create(:domain => 'vpc')
tests("#associate_addresses({:instance_id =>'i-00000000', :public_ip => '#{@address.identity}')}").raises(Fog::Compute::AWS::NotFound) do tests("#associate_addresses({:instance_id =>'i-00000000', :public_ip => '#{@address.identity}')}").raises(Fog::AWS::Compute::NotFound) do
compute.associate_address({:instance_id => 'i-00000000', :public_ip => @address.identity}) compute.associate_address({:instance_id => 'i-00000000', :public_ip => @address.identity})
end end
tests("#associate_addresses({:instance_id =>'#{@server.identity}', :public_ip => '127.0.0.1'})").raises(Fog::Compute::AWS::Error) do tests("#associate_addresses({:instance_id =>'#{@server.identity}', :public_ip => '127.0.0.1'})").raises(Fog::AWS::Compute::Error) do
compute.associate_address({:instance_id => @server.identity, :public_ip => '127.0.0.1'}) compute.associate_address({:instance_id => @server.identity, :public_ip => '127.0.0.1'})
end end
tests("#associate_addresses({:instance_id =>'i-00000000', :public_ip => '127.0.0.1'})").raises(Fog::Compute::AWS::NotFound) do tests("#associate_addresses({:instance_id =>'i-00000000', :public_ip => '127.0.0.1'})").raises(Fog::AWS::Compute::NotFound) do
compute.associate_address({:instance_id =>'i-00000000', :public_ip =>'127.0.0.1'}) compute.associate_address({:instance_id =>'i-00000000', :public_ip =>'127.0.0.1'})
end end
tests("#restore_address_to_classic('#{@vpc_address.identity}')").raises(Fog::Compute::AWS::Error) do tests("#restore_address_to_classic('#{@vpc_address.identity}')").raises(Fog::AWS::Compute::Error) do
compute.restore_address_to_classic(@vpc_address.identity) compute.restore_address_to_classic(@vpc_address.identity)
end end
tests("#disassociate_addresses('127.0.0.1') raises BadRequest error").raises(Fog::Compute::AWS::Error) do tests("#disassociate_addresses('127.0.0.1') raises BadRequest error").raises(Fog::AWS::Compute::Error) do
compute.disassociate_address('127.0.0.1') compute.disassociate_address('127.0.0.1')
end end
tests("#release_address('127.0.0.1')").raises(Fog::Compute::AWS::Error) do tests("#release_address('127.0.0.1')").raises(Fog::AWS::Compute::Error) do
compute.release_address('127.0.0.1') compute.release_address('127.0.0.1')
end end
tests("#release_address('#{@vpc_address.identity}')").raises(Fog::Compute::AWS::Error) do tests("#release_address('#{@vpc_address.identity}')").raises(Fog::AWS::Compute::Error) do
compute.release_address(@vpc_address.identity) compute.release_address(@vpc_address.identity)
end end
if Fog.mocking? if Fog.mocking?
old_limit = compute.data[:limits][:addresses] old_limit = compute.data[:limits][:addresses]
tests("#allocate_address", "limit exceeded").raises(Fog::Compute::AWS::Error) do tests("#allocate_address", "limit exceeded").raises(Fog::AWS::Compute::Error) do
compute.data[:limits][:addresses] = 0 compute.data[:limits][:addresses] = 0
compute.allocate_address compute.allocate_address
end end

View file

@ -1,7 +1,7 @@
Shindo.tests('Fog::Compute[:aws] | internet_gateway requests', ['aws']) do Shindo.tests('Fog::Compute[:aws] | internet_gateway requests', ['aws']) do
tests('success') do tests('success') do
Fog::Compute::AWS::Mock.reset if Fog.mocking? Fog::AWS::Compute::Mock.reset if Fog.mocking?
@vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24') @vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
@vpc_id = @vpc.id @vpc_id = @vpc.id
@ -30,7 +30,7 @@ Shindo.tests('Fog::Compute[:aws] | internet_gateway requests', ['aws']) do
end end
tests('failure') do tests('failure') do
Fog::Compute::AWS::Mock.reset if Fog.mocking? Fog::AWS::Compute::Mock.reset if Fog.mocking?
@vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24') @vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
@vpc_id = @vpc.id @vpc_id = @vpc.id
@ -44,7 +44,7 @@ Shindo.tests('Fog::Compute[:aws] | internet_gateway requests', ['aws']) do
@ip_address = Fog::AWS::Mock.ip_address @ip_address = Fog::AWS::Mock.ip_address
tests("#assign_private_ip_addresses('#{@network_interface_id}', {'PrivateIpAddresses'=>['#{@ip_address}','#{@second_ip_address}'], 'SecondaryPrivateIpAddressCount'=>4 })").raises(Fog::Compute::AWS::Error) do tests("#assign_private_ip_addresses('#{@network_interface_id}', {'PrivateIpAddresses'=>['#{@ip_address}','#{@second_ip_address}'], 'SecondaryPrivateIpAddressCount'=>4 })").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].assign_private_ip_addresses(@network_interface_id, { 'PrivateIpAddresses' =>[@ip_address, @second_ip_address], 'SecondaryPrivateIpAddressCount'=>4 }).body Fog::Compute[:aws].assign_private_ip_addresses(@network_interface_id, { 'PrivateIpAddresses' =>[@ip_address, @second_ip_address], 'SecondaryPrivateIpAddressCount'=>4 }).body
end end

View file

@ -55,7 +55,7 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
@image_id = 'ami-1aad5273' @image_id = 'ami-1aad5273'
if Fog.mocking? if Fog.mocking?
@other_account = Fog::Compute::AWS.new(:aws_access_key_id => 'other', :aws_secret_access_key => 'account') @other_account = Fog::AWS::Compute.new(:aws_access_key_id => 'other', :aws_secret_access_key => 'account')
@server = Fog::Compute[:aws].servers.create @server = Fog::Compute[:aws].servers.create
@server.wait_for{state == 'running'} @server.wait_for{state == 'running'}
@ -151,7 +151,7 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
Fog::Compute[:aws].modify_image_attribute(nil, { 'Add.Group' => ['all'] }).body Fog::Compute[:aws].modify_image_attribute(nil, { 'Add.Group' => ['all'] }).body
end end
tests("#modify_image_attribute('ami-00000000', { 'Add.UserId' => ['123456789012'] })").raises(Fog::Compute::AWS::NotFound) do tests("#modify_image_attribute('ami-00000000', { 'Add.UserId' => ['123456789012'] })").raises(Fog::AWS::Compute::NotFound) do
pending unless Fog.mocking? pending unless Fog.mocking?
Fog::Compute[:aws].modify_image_attribute('ami-00000000', { 'Add.UserId' => ['123456789012'] }).body Fog::Compute[:aws].modify_image_attribute('ami-00000000', { 'Add.UserId' => ['123456789012'] }).body

View file

@ -159,7 +159,7 @@ Shindo.tests('Fog::Compute[:aws] | describe_instance_attribute request', ['aws']
tests('failure') do tests('failure') do
@instance_attributes.each do |attrib| @instance_attributes.each do |attrib|
tests("#describe_instance_attribute('i-00000000', #{attrib})").raises(Fog::Compute::AWS::NotFound) do tests("#describe_instance_attribute('i-00000000', #{attrib})").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].describe_instance_attribute('i-00000000', attrib) Fog::Compute[:aws].describe_instance_attribute('i-00000000', attrib)
end end
end end

View file

@ -314,22 +314,22 @@ Shindo.tests('Fog::Compute[:aws] | instance requests', ['aws']) do
tests('failure') do tests('failure') do
tests("#run_instances(nil, 1, 1, {'SubnetId'=>'subnet-00000000'}").raises(::Fog::Compute::AWS::Error) do tests("#run_instances(nil, 1, 1, {'SubnetId'=>'subnet-00000000'}").raises(::Fog::AWS::Compute::Error) do
Fog::Compute[:aws].run_instances(nil, 1, 1, {'SubnetId' => 'subnet-000000'}) Fog::Compute[:aws].run_instances(nil, 1, 1, {'SubnetId' => 'subnet-000000'})
end end
tests("#get_console_output('i-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#get_console_output('i-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].get_console_output('i-00000000') Fog::Compute[:aws].get_console_output('i-00000000')
end end
tests("#get_password_data('i-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#get_password_data('i-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].get_password_data('i-00000000') Fog::Compute[:aws].get_password_data('i-00000000')
end end
tests("#reboot_instances('i-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#reboot_instances('i-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].reboot_instances('i-00000000') Fog::Compute[:aws].reboot_instances('i-00000000')
end end
tests("#terminate_instances('i-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#terminate_instances('i-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].terminate_instances('i-00000000') Fog::Compute[:aws].terminate_instances('i-00000000')
end end

View file

@ -10,7 +10,7 @@ Shindo.tests('Fog::Compute[:aws] | internet_gateway requests', ['aws']) do
} }
tests('success') do tests('success') do
Fog::Compute::AWS::Mock.reset if Fog.mocking? Fog::AWS::Compute::Mock.reset if Fog.mocking?
@vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24') @vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
@vpc_id = @vpc.id @vpc_id = @vpc.id
@subnet=Fog::Compute[:aws].subnets.create('vpc_id' => @vpc_id, 'cidr_block' => '10.0.10.0/24') @subnet=Fog::Compute[:aws].subnets.create('vpc_id' => @vpc_id, 'cidr_block' => '10.0.10.0/24')

View file

@ -56,7 +56,7 @@ Shindo.tests('Fog::Compute[:aws] | key pair requests', ['aws']) do
@key_pair = Fog::Compute[:aws].key_pairs.create(:name => 'fog_key_pair') @key_pair = Fog::Compute[:aws].key_pairs.create(:name => 'fog_key_pair')
tests("duplicate #create_key_pair('#{@key_pair.name}')").raises(Fog::Compute::AWS::Error) do tests("duplicate #create_key_pair('#{@key_pair.name}')").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].create_key_pair(@key_pair.name) Fog::Compute[:aws].create_key_pair(@key_pair.name)
end end

View file

@ -34,7 +34,7 @@ Shindo.tests('Fog::Compute[:aws] | network acl requests', ['aws']) do
} }
tests('success') do tests('success') do
Fog::Compute::AWS::Mock.reset if Fog.mocking? Fog::AWS::Compute::Mock.reset if Fog.mocking?
@vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24') @vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
@subnet = Fog::Compute[:aws].subnets.create('vpc_id' => @vpc.id, 'cidr_block' => '10.0.10.16/28') @subnet = Fog::Compute[:aws].subnets.create('vpc_id' => @vpc.id, 'cidr_block' => '10.0.10.16/28')
@ -107,6 +107,6 @@ Shindo.tests('Fog::Compute[:aws] | network acl requests', ['aws']) do
@another_acl.destroy @another_acl.destroy
@subnet.destroy @subnet.destroy
@vpc.destroy @vpc.destroy
Fog::Compute::AWS::Mock.reset if Fog.mocking? Fog::AWS::Compute::Mock.reset if Fog.mocking?
end end
end end

View file

@ -36,7 +36,7 @@ Shindo.tests('Fog::Compute[:aws] | network interface requests', ['aws']) do
} }
tests('success') do tests('success') do
Fog::Compute::AWS::Mock.reset if Fog.mocking? Fog::AWS::Compute::Mock.reset if Fog.mocking?
# Create environment # Create environment
@vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24') @vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
@ -197,7 +197,7 @@ Shindo.tests('Fog::Compute[:aws] | network interface requests', ['aws']) do
tests('failure') do tests('failure') do
# Attempt to attach a nonexistent interface # Attempt to attach a nonexistent interface
tests("#attach_network_interface('eni-00000000', 'i-00000000', '1')").raises(::Fog::Compute::AWS::NotFound) do tests("#attach_network_interface('eni-00000000', 'i-00000000', '1')").raises(::Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].attach_network_interface('eni-00000000', 'i-00000000', '1') Fog::Compute[:aws].attach_network_interface('eni-00000000', 'i-00000000', '1')
end end
@ -213,12 +213,12 @@ Shindo.tests('Fog::Compute[:aws] | network interface requests', ['aws']) do
# Attempt to re-use an existing IP for another ENI # Attempt to re-use an existing IP for another ENI
tests("#create_network_interface('#{@subnet_id}', " \ tests("#create_network_interface('#{@subnet_id}', " \
"{'PrivateIpAddress' => " \ "{'PrivateIpAddress' => " \
"'#{data['networkInterface']['privateIpAddress']}'}").raises(::Fog::Compute::AWS::Error) do "'#{data['networkInterface']['privateIpAddress']}'}").raises(::Fog::AWS::Compute::Error) do
Fog::Compute[:aws].create_network_interface(@subnet_id, {'PrivateIpAddress' => data['networkInterface']['privateIpAddress']}) Fog::Compute[:aws].create_network_interface(@subnet_id, {'PrivateIpAddress' => data['networkInterface']['privateIpAddress']})
end end
# Attempt to attach a valid ENI to a nonexistent instance. # Attempt to attach a valid ENI to a nonexistent instance.
tests("#attach_network_interface('#{@nic_id}', 'i-00000000', '0')").raises(::Fog::Compute::AWS::NotFound) do tests("#attach_network_interface('#{@nic_id}', 'i-00000000', '0')").raises(::Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].attach_network_interface(@nic_id, 'i-00000000', '0') Fog::Compute[:aws].attach_network_interface(@nic_id, 'i-00000000', '0')
end end
@ -230,10 +230,10 @@ Shindo.tests('Fog::Compute[:aws] | network interface requests', ['aws']) do
# Attempt to attach two ENIs to the same instance with the same device # Attempt to attach two ENIs to the same instance with the same device
# index. # index.
tests("#attach_network_interface('#{@nic_id}', '#{@instance_id}', '#{@device_index}')").raises(::Fog::Compute::AWS::Error) do tests("#attach_network_interface('#{@nic_id}', '#{@instance_id}', '#{@device_index}')").raises(::Fog::AWS::Compute::Error) do
Fog::Compute[:aws].attach_network_interface(@nic_id, @instance_id, @device_index) Fog::Compute[:aws].attach_network_interface(@nic_id, @instance_id, @device_index)
end end
Fog::Compute::AWS::Mock.reset if Fog.mocking? Fog::AWS::Compute::Mock.reset if Fog.mocking?
end end
end end

View file

@ -35,11 +35,11 @@ Shindo.tests('Fog::Compute[:aws] | placement group requests', ['aws']) do
Fog::Compute[:aws].create_placement_group('fog_placement_group', 'cluster') Fog::Compute[:aws].create_placement_group('fog_placement_group', 'cluster')
tests("duplicate #create_placement_group('fog_placement_group', 'cluster')").raises(Fog::Compute::AWS::Error) do tests("duplicate #create_placement_group('fog_placement_group', 'cluster')").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].create_placement_group('fog_placement_group', 'cluster') Fog::Compute[:aws].create_placement_group('fog_placement_group', 'cluster')
end end
tests("#delete_placement_group('not_a_group_name')").raises(Fog::Compute::AWS::NotFound) do tests("#delete_placement_group('not_a_group_name')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].delete_placement_group('not_a_group_name') Fog::Compute[:aws].delete_placement_group('not_a_group_name')
end end

View file

@ -21,7 +21,7 @@ Shindo.tests('Fog::Compute[:aws] | region requests', ['aws']) do
tests("#incorrect_region") do tests("#incorrect_region") do
raises(ArgumentError, "Unknown region: world-antarctica-1") do raises(ArgumentError, "Unknown region: world-antarctica-1") do
Fog::Compute::AWS.new({:aws_access_key_id => 'dummykey', Fog::AWS::Compute.new({:aws_access_key_id => 'dummykey',
:aws_secret_access_key => 'dummysecret', :aws_secret_access_key => 'dummysecret',
:aws_session_token => 'dummytoken', :aws_session_token => 'dummytoken',
:region => 'world-antarctica-1'}) :region => 'world-antarctica-1'})
@ -30,7 +30,7 @@ Shindo.tests('Fog::Compute[:aws] | region requests', ['aws']) do
end end
tests("#unknown_endpoint").formats(@regions_format) do tests("#unknown_endpoint").formats(@regions_format) do
Fog::Compute::AWS.new({:aws_access_key_id => 'dummykey', Fog::AWS::Compute.new({:aws_access_key_id => 'dummykey',
:aws_secret_access_key => 'dummysecret', :aws_secret_access_key => 'dummysecret',
:aws_session_token => 'dummytoken', :aws_session_token => 'dummytoken',
:region => 'world-antarctica-1', :region => 'world-antarctica-1',
@ -38,8 +38,8 @@ Shindo.tests('Fog::Compute[:aws] | region requests', ['aws']) do
end end
tests("#invalid_endpoint") do tests("#invalid_endpoint") do
raises(Fog::Compute::AWS::InvalidURIError) do raises(Fog::AWS::Compute::InvalidURIError) do
Fog::Compute::AWS.new({:aws_access_key_id => 'dummykey', Fog::AWS::Compute.new({:aws_access_key_id => 'dummykey',
:aws_secret_access_key => 'dummysecret', :aws_secret_access_key => 'dummysecret',
:aws_session_token => 'dummytoken', :aws_session_token => 'dummytoken',
:region => 'world-antarctica-1', :region => 'world-antarctica-1',

View file

@ -41,7 +41,7 @@ Shindo.tests('Fog::Compute[:aws] | route table requests', ['aws']) do
'requestId' => String 'requestId' => String
} }
Fog::Compute::AWS::Mock.reset if Fog.mocking? Fog::AWS::Compute::Mock.reset if Fog.mocking?
vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24') vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
if !Fog.mocking? if !Fog.mocking?
vpc.wait_for { state.eql? "available" } vpc.wait_for { state.eql? "available" }
@ -174,7 +174,7 @@ Shindo.tests('Fog::Compute[:aws] | route table requests', ['aws']) do
tests('#create_route_table').raises(ArgumentError) do tests('#create_route_table').raises(ArgumentError) do
Fog::Compute[:aws].create_route_table Fog::Compute[:aws].create_route_table
end end
tests("#create_route_table('vpc-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#create_route_table('vpc-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].create_route_table('vpc-00000000') Fog::Compute[:aws].create_route_table('vpc-00000000')
end end
@ -186,10 +186,10 @@ Shindo.tests('Fog::Compute[:aws] | route table requests', ['aws']) do
tests('#associate_route_table').raises(ArgumentError) do tests('#associate_route_table').raises(ArgumentError) do
Fog::Compute[:aws].associate_route_table Fog::Compute[:aws].associate_route_table
end end
tests("#associate_route_table('rtb-00000000', '#{@subnet_id}')").raises(Fog::Compute::AWS::NotFound) do tests("#associate_route_table('rtb-00000000', '#{@subnet_id}')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].associate_route_table('rtb-00000000', @subnet_id) Fog::Compute[:aws].associate_route_table('rtb-00000000', @subnet_id)
end end
tests("#associate_route_table('#{@route_table_id}', 'subnet-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#associate_route_table('#{@route_table_id}', 'subnet-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].associate_route_table(@route_table_id, 'subnet-00000000') Fog::Compute[:aws].associate_route_table(@route_table_id, 'subnet-00000000')
end end
@ -207,30 +207,30 @@ Shindo.tests('Fog::Compute[:aws] | route table requests', ['aws']) do
tests('#create_route').raises(ArgumentError) do tests('#create_route').raises(ArgumentError) do
Fog::Compute[:aws].create_route Fog::Compute[:aws].create_route
end end
tests("#create_route('rtb-00000000', '#{@destination_cidr_block}', '#{@internet_gateway_id}')").raises(Fog::Compute::AWS::NotFound) do tests("#create_route('rtb-00000000', '#{@destination_cidr_block}', '#{@internet_gateway_id}')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].create_route('rtb-00000000', @destination_cidr_block, @internet_gateway_id) Fog::Compute[:aws].create_route('rtb-00000000', @destination_cidr_block, @internet_gateway_id)
end end
tests("#create_route('#{@route_table_id}', '#{@destination_cidr_block}', 'igw-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#create_route('#{@route_table_id}', '#{@destination_cidr_block}', 'igw-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, 'igw-00000000') Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, 'igw-00000000')
end end
tests("#create_route('rtb-00000000', '#{@destination_cidr_block}', 'nil', '#{instance.id}')").raises(Fog::Compute::AWS::NotFound) do tests("#create_route('rtb-00000000', '#{@destination_cidr_block}', 'nil', '#{instance.id}')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].create_route('rtb-00000000', @destination_cidr_block, instance.id) Fog::Compute[:aws].create_route('rtb-00000000', @destination_cidr_block, instance.id)
end end
tests("#create_route('#{@route_table_id}', '#{@destination_cidr_block}', 'nil', 'i-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#create_route('#{@route_table_id}', '#{@destination_cidr_block}', 'nil', 'i-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, nil, 'i-00000000') Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, nil, 'i-00000000')
end end
tests("#create_route('#{@route_table_id}', '#{@destinationCidrBlock}', 'nil', 'nil', 'eni-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#create_route('#{@route_table_id}', '#{@destinationCidrBlock}', 'nil', 'nil', 'eni-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, nil, nil, 'eni-00000000') Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, nil, nil, 'eni-00000000')
end end
tests("#create_route('#rtb-00000000', '#{@destination_cidr_block}', 'nil, 'nil', '#{@network_interface_id}')").raises(Fog::Compute::AWS::NotFound) do tests("#create_route('#rtb-00000000', '#{@destination_cidr_block}', 'nil, 'nil', '#{@network_interface_id}')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].create_route('rtb-00000000', @destination_cidr_block, nil, nil, @network_interface_id) Fog::Compute[:aws].create_route('rtb-00000000', @destination_cidr_block, nil, nil, @network_interface_id)
end end
tests("#create_route same destination_cidr_block").raises(Fog::Compute::AWS::Error) do tests("#create_route same destination_cidr_block").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, @internet_gateway_id) Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, @internet_gateway_id)
Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, nil, nil, @network_interface_id).body Fog::Compute[:aws].create_route(@route_table_id, @destination_cidr_block, nil, nil, @network_interface_id).body
end end
if !Fog.mocking? if !Fog.mocking?
tests("#create_route less specific destination_cidr_block").raises(Fog::Compute::AWS::Error) do tests("#create_route less specific destination_cidr_block").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].create_route(@route_table_id, '10.0.10.0/25', @internet_gateway_id) Fog::Compute[:aws].create_route(@route_table_id, '10.0.10.0/25', @internet_gateway_id)
Fog::Compute[:aws].delete_route(@route_table_id, @destination_cidr_block).body Fog::Compute[:aws].delete_route(@route_table_id, @destination_cidr_block).body
end end
@ -249,29 +249,29 @@ Shindo.tests('Fog::Compute[:aws] | route table requests', ['aws']) do
tests('#replace_route').raises(ArgumentError) do tests('#replace_route').raises(ArgumentError) do
Fog::Compute[:aws].replace_route Fog::Compute[:aws].replace_route
end end
tests("#replace_route('rtb-00000000', '#{@destination_cidr_block}', {'internetGatewayId' => '#{@internet_gateway_id}'})").raises(Fog::Compute::AWS::NotFound) do tests("#replace_route('rtb-00000000', '#{@destination_cidr_block}', {'internetGatewayId' => '#{@internet_gateway_id}'})").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].replace_route('rtb-00000000', @destination_cidr_block, {'internetGatewayId' => @internet_gateway_id}) Fog::Compute[:aws].replace_route('rtb-00000000', @destination_cidr_block, {'internetGatewayId' => @internet_gateway_id})
end end
tests("#replace_route('rtb-00000000', '#{@destination_cidr_block}')").raises(Fog::Compute::AWS::NotFound) do tests("#replace_route('rtb-00000000', '#{@destination_cidr_block}')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].replace_route('rtb-00000000', @destination_cidr_block) Fog::Compute[:aws].replace_route('rtb-00000000', @destination_cidr_block)
end end
tests("#replace_route('#{@route_table_id}', '#{@destination_cidr_block}', {'gatewayId' => 'igw-00000000'})").raises(Fog::Compute::AWS::NotFound) do tests("#replace_route('#{@route_table_id}', '#{@destination_cidr_block}', {'gatewayId' => 'igw-00000000'})").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].replace_route(@route_table_id, @destination_cidr_block, {'gatewayId' => 'igw-00000000'}) Fog::Compute[:aws].replace_route(@route_table_id, @destination_cidr_block, {'gatewayId' => 'igw-00000000'})
end end
tests("#replace_route('rtb-00000000', '#{@destination_cidr_block}', {'instanceId' => '#{instance.id}'})").raises(Fog::Compute::AWS::NotFound) do tests("#replace_route('rtb-00000000', '#{@destination_cidr_block}', {'instanceId' => '#{instance.id}'})").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].replace_route('rtb-00000000', @destination_cidr_block, {'instanceId' => instance.id}) Fog::Compute[:aws].replace_route('rtb-00000000', @destination_cidr_block, {'instanceId' => instance.id})
end end
tests("#replace_route('#{@route_table_id}', '#{@destination_cidr_block}', {'instanceId' => 'i-00000000'})").raises(Fog::Compute::AWS::NotFound) do tests("#replace_route('#{@route_table_id}', '#{@destination_cidr_block}', {'instanceId' => 'i-00000000'})").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].replace_route(@route_table_id, @destination_cidr_block, {'instanceId' => 'i-00000000'}) Fog::Compute[:aws].replace_route(@route_table_id, @destination_cidr_block, {'instanceId' => 'i-00000000'})
end end
tests("#replace_route('#{@route_table_id}', '#{@destination_cidr_block}', {'networkInterfaceId' => 'eni-00000000'})").raises(Fog::Compute::AWS::NotFound) do tests("#replace_route('#{@route_table_id}', '#{@destination_cidr_block}', {'networkInterfaceId' => 'eni-00000000'})").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].replace_route(@route_table_id, @destination_cidr_block, {'networkInterfaceId' => 'eni-00000000'}) Fog::Compute[:aws].replace_route(@route_table_id, @destination_cidr_block, {'networkInterfaceId' => 'eni-00000000'})
end end
tests("#replace_route('rtb-00000000', '#{@destination_cidr_block}', {'networkInterfaceId' => '#{@network_interface_id}'})").raises(Fog::Compute::AWS::NotFound) do tests("#replace_route('rtb-00000000', '#{@destination_cidr_block}', {'networkInterfaceId' => '#{@network_interface_id}'})").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].replace_route('rtb-00000000', @destination_cidr_block, {'networkInterfaceId' => @network_interface_id}) Fog::Compute[:aws].replace_route('rtb-00000000', @destination_cidr_block, {'networkInterfaceId' => @network_interface_id})
end end
if !Fog.mocking? if !Fog.mocking?
tests("#replace_route less specific destination_cidr_block").raises(Fog::Compute::AWS::Error) do tests("#replace_route less specific destination_cidr_block").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].replace_route(@route_table_id, '10.0.10.0/25', {'gatewayId' => @internet_gateway_id}) Fog::Compute[:aws].replace_route(@route_table_id, '10.0.10.0/25', {'gatewayId' => @internet_gateway_id})
end end
end end
@ -290,7 +290,7 @@ Shindo.tests('Fog::Compute[:aws] | route table requests', ['aws']) do
tests('#delete_route').raises(ArgumentError) do tests('#delete_route').raises(ArgumentError) do
Fog::Compute[:aws].delete_route Fog::Compute[:aws].delete_route
end end
tests("#delete_route('rtb-00000000', '#{@destination_cidr_block}')").raises(Fog::Compute::AWS::NotFound) do tests("#delete_route('rtb-00000000', '#{@destination_cidr_block}')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].delete_route('rtb-00000000', @destination_cidr_block) Fog::Compute[:aws].delete_route('rtb-00000000', @destination_cidr_block)
end end
@ -301,7 +301,7 @@ Shindo.tests('Fog::Compute[:aws] | route table requests', ['aws']) do
tests('#disassociate_route_table').raises(ArgumentError) do tests('#disassociate_route_table').raises(ArgumentError) do
Fog::Compute[:aws].disassociate_route_table Fog::Compute[:aws].disassociate_route_table
end end
tests("#disassociate_route_table('rtbassoc-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#disassociate_route_table('rtbassoc-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].disassociate_route_table('rtbassoc-00000000') Fog::Compute[:aws].disassociate_route_table('rtbassoc-00000000')
end end
@ -312,14 +312,14 @@ Shindo.tests('Fog::Compute[:aws] | route table requests', ['aws']) do
tests('#delete_route_table').raises(ArgumentError) do tests('#delete_route_table').raises(ArgumentError) do
Fog::Compute[:aws].delete_route_table Fog::Compute[:aws].delete_route_table
end end
tests("#delete_route_table('rtb-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#delete_route_table('rtb-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].delete_route_table('rtb-00000000') Fog::Compute[:aws].delete_route_table('rtb-00000000')
end end
# Dependency Tests # Dependency Tests
# - route is depending on route_table, so route_table cannot be deleted # - route is depending on route_table, so route_table cannot be deleted
# #
tests("#delete_route_table('#{@route_table_id}')").raises(Fog::Compute::AWS::Error) do tests("#delete_route_table('#{@route_table_id}')").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].delete_route_table(@route_table_id) Fog::Compute[:aws].delete_route_table(@route_table_id)
end end

View file

@ -318,11 +318,11 @@ Shindo.tests('Fog::Compute[:aws] | security group requests', ['aws']) do
@security_group = Fog::Compute[:aws].security_groups.create(:description => 'tests group', :name => 'fog_security_group') @security_group = Fog::Compute[:aws].security_groups.create(:description => 'tests group', :name => 'fog_security_group')
@other_security_group = Fog::Compute[:aws].security_groups.create(:description => 'tests group', :name => 'fog_other_security_group') @other_security_group = Fog::Compute[:aws].security_groups.create(:description => 'tests group', :name => 'fog_other_security_group')
tests("duplicate #create_security_group(#{@security_group.name}, #{@security_group.description})").raises(Fog::Compute::AWS::Error) do tests("duplicate #create_security_group(#{@security_group.name}, #{@security_group.description})").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].create_security_group(@security_group.name, @security_group.description) Fog::Compute[:aws].create_security_group(@security_group.name, @security_group.description)
end end
tests("#authorize_security_group_ingress('not_a_group_name', {'FromPort' => 80, 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::Compute::AWS::NotFound) do tests("#authorize_security_group_ingress('not_a_group_name', {'FromPort' => 80, 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].authorize_security_group_ingress( Fog::Compute[:aws].authorize_security_group_ingress(
'not_a_group_name', 'not_a_group_name',
{ {
@ -333,7 +333,7 @@ Shindo.tests('Fog::Compute[:aws] | security group requests', ['aws']) do
) )
end end
tests("#authorize_security_group_ingress('not_a_group_name', {'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::Compute::AWS::NotFound) do tests("#authorize_security_group_ingress('not_a_group_name', {'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].authorize_security_group_ingress( Fog::Compute[:aws].authorize_security_group_ingress(
'not_a_group_name', 'not_a_group_name',
{ {
@ -347,7 +347,7 @@ Shindo.tests('Fog::Compute[:aws] | security group requests', ['aws']) do
Fog::Compute[:aws].authorize_security_group_ingress('fog_security_group', {'IpPermissions' => [{'IpProtocol' => 'tcp', 'FromPort' => 80, 'ToPort' => 80, 'IpRanges' => [{'CidrIp' => '10.0.0.0/8'}]}]}).body Fog::Compute[:aws].authorize_security_group_ingress('fog_security_group', {'IpPermissions' => [{'IpProtocol' => 'tcp', 'FromPort' => 80, 'ToPort' => 80, 'IpRanges' => [{'CidrIp' => '10.0.0.0/8'}]}]}).body
end end
tests("#authorize_security_group_ingress('fog_security_group', {'IpPermissions' => [{'IpProtocol' => 'tcp', 'FromPort' => 80, 'ToPort' => 80, 'IpRanges' => [{'CidrIp' => '10.0.0.0/8'}]}]})").raises(Fog::Compute::AWS::Error) do tests("#authorize_security_group_ingress('fog_security_group', {'IpPermissions' => [{'IpProtocol' => 'tcp', 'FromPort' => 80, 'ToPort' => 80, 'IpRanges' => [{'CidrIp' => '10.0.0.0/8'}]}]})").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].authorize_security_group_ingress('fog_security_group', {'IpPermissions' => [{'IpProtocol' => 'tcp', 'FromPort' => 80, 'ToPort' => 80, 'IpRanges' => [{'CidrIp' => '10.0.0.0/8'}]}]}) Fog::Compute[:aws].authorize_security_group_ingress('fog_security_group', {'IpPermissions' => [{'IpProtocol' => 'tcp', 'FromPort' => 80, 'ToPort' => 80, 'IpRanges' => [{'CidrIp' => '10.0.0.0/8'}]}]})
end end
@ -355,7 +355,7 @@ Shindo.tests('Fog::Compute[:aws] | security group requests', ['aws']) do
Fog::Compute[:aws].authorize_security_group_ingress('fog_security_group', {'IpPermissions' => [{'Groups' => [{'GroupName' => @other_security_group.name}], 'FromPort' => 80, 'ToPort' => 80, 'IpProtocol' => 'tcp'}]}).body Fog::Compute[:aws].authorize_security_group_ingress('fog_security_group', {'IpPermissions' => [{'Groups' => [{'GroupName' => @other_security_group.name}], 'FromPort' => 80, 'ToPort' => 80, 'IpProtocol' => 'tcp'}]}).body
end end
tests("#delete_security_group('#{@other_security_group.name}')").raises(Fog::Compute::AWS::Error) do tests("#delete_security_group('#{@other_security_group.name}')").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].delete_security_group(@other_security_group.name) Fog::Compute[:aws].delete_security_group(@other_security_group.name)
end end
@ -374,16 +374,16 @@ Shindo.tests('Fog::Compute[:aws] | security group requests', ['aws']) do
] ]
broken_params.each do |broken_params_item| broken_params.each do |broken_params_item|
tests("#authorize_security_group_ingress('fog_security_group', #{broken_params_item.inspect})").raises(Fog::Compute::AWS::Error) do tests("#authorize_security_group_ingress('fog_security_group', #{broken_params_item.inspect})").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].authorize_security_group_ingress('fog_security_group', broken_params_item) Fog::Compute[:aws].authorize_security_group_ingress('fog_security_group', broken_params_item)
end end
tests("#revoke_security_group_ingress('fog_security_group', #{broken_params_item.inspect})").raises(Fog::Compute::AWS::Error) do tests("#revoke_security_group_ingress('fog_security_group', #{broken_params_item.inspect})").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].revoke_security_group_ingress('fog_security_group', broken_params_item) Fog::Compute[:aws].revoke_security_group_ingress('fog_security_group', broken_params_item)
end end
end end
tests("#revoke_security_group_ingress('not_a_group_name', {'FromPort' => 80, 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::Compute::AWS::NotFound) do tests("#revoke_security_group_ingress('not_a_group_name', {'FromPort' => 80, 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].revoke_security_group_ingress( Fog::Compute[:aws].revoke_security_group_ingress(
'not_a_group_name', 'not_a_group_name',
{ {
@ -394,7 +394,7 @@ Shindo.tests('Fog::Compute[:aws] | security group requests', ['aws']) do
) )
end end
tests("#revoke_security_group_ingress('not_a_group_name', {'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::Compute::AWS::NotFound) do tests("#revoke_security_group_ingress('not_a_group_name', {'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].revoke_security_group_ingress( Fog::Compute[:aws].revoke_security_group_ingress(
'not_a_group_name', 'not_a_group_name',
{ {
@ -404,13 +404,13 @@ Shindo.tests('Fog::Compute[:aws] | security group requests', ['aws']) do
) )
end end
tests("#delete_security_group('not_a_group_name')").raises(Fog::Compute::AWS::NotFound) do tests("#delete_security_group('not_a_group_name')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].delete_security_group('not_a_group_name') Fog::Compute[:aws].delete_security_group('not_a_group_name')
end end
@rds_security_group = Fog::AWS[:rds].security_groups.create(:id => "rdsgroup", :description => 'fog rds test') @rds_security_group = Fog::AWS[:rds].security_groups.create(:id => "rdsgroup", :description => 'fog rds test')
tests("#delete_security_group('when authorized to an rds firewall')").raises(Fog::Compute::AWS::Error) do tests("#delete_security_group('when authorized to an rds firewall')").raises(Fog::AWS::Compute::Error) do
@rds_security_group.authorize_ec2_security_group(@security_group.name) @rds_security_group.authorize_ec2_security_group(@security_group.name)
Fog::Compute[:aws].delete_security_group(@security_group.name) Fog::Compute[:aws].delete_security_group(@security_group.name)
end end
@ -420,7 +420,7 @@ Shindo.tests('Fog::Compute[:aws] | security group requests', ['aws']) do
@security_group.destroy @security_group.destroy
@other_security_group.destroy @other_security_group.destroy
tests("#delete_security_group('default')").raises(Fog::Compute::AWS::Error) do tests("#delete_security_group('default')").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].delete_security_group('default') Fog::Compute[:aws].delete_security_group('default')
end end
@ -432,11 +432,11 @@ Shindo.tests('Fog::Compute[:aws] | security group requests', ['aws']) do
] ]
broken_params.each do |list_elem| broken_params.each do |list_elem|
tests("#authorize_security_group_ingress(#{list_elem[0].inspect}, #{list_elem[1].inspect})").raises(Fog::Compute::AWS::Error) do tests("#authorize_security_group_ingress(#{list_elem[0].inspect}, #{list_elem[1].inspect})").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].authorize_security_group_ingress(list_elem[0], list_elem[1]) Fog::Compute[:aws].authorize_security_group_ingress(list_elem[0], list_elem[1])
end end
tests("#revoke_security_group_ingress(#{list_elem[0].inspect}, #{list_elem[1].inspect})").raises(Fog::Compute::AWS::Error) do tests("#revoke_security_group_ingress(#{list_elem[0].inspect}, #{list_elem[1].inspect})").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].revoke_security_group_ingress(list_elem[0], list_elem[1]) Fog::Compute[:aws].revoke_security_group_ingress(list_elem[0], list_elem[1])
end end
end end

View file

@ -66,7 +66,7 @@ Shindo.tests('Fog::Compute[:aws] | snapshot requests', ['aws']) do
end end
tests('failure') do tests('failure') do
tests("#delete_snapshot('snap-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#delete_snapshot('snap-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].delete_snapshot('snap-00000000') Fog::Compute[:aws].delete_snapshot('snap-00000000')
end end

View file

@ -38,7 +38,7 @@ Shindo.tests('Fog::Compute[:aws] | spot datafeed subscription requests', ['aws']
tests('failure') do tests('failure') do
pending if Fog.mocking? pending if Fog.mocking?
tests("#describe_spot_datafeed_subscription").raises(Fog::Compute::AWS::NotFound) do tests("#describe_spot_datafeed_subscription").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].describe_spot_datafeed_subscription Fog::Compute[:aws].describe_spot_datafeed_subscription
end end
end end

View file

@ -67,17 +67,17 @@ Shindo.tests('Fog::Compute[:aws] | subnet requests', ['aws']) do
end end
tests('failure') do tests('failure') do
tests("#create_subnet('vpc-00000000', '10.0.10.0/16')").raises(Fog::Compute::AWS::NotFound) do tests("#create_subnet('vpc-00000000', '10.0.10.0/16')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].create_subnet('vpc-00000000', '10.0.10.0/16') Fog::Compute[:aws].create_subnet('vpc-00000000', '10.0.10.0/16')
end end
tests("#create_subnet('#{@vpc_id}', '10.0.9.16/28')").raises(Fog::Compute::AWS::Error) do tests("#create_subnet('#{@vpc_id}', '10.0.9.16/28')").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].create_subnet(@vpc_id, '10.0.9.16/28') Fog::Compute[:aws].create_subnet(@vpc_id, '10.0.9.16/28')
end end
# Attempt to create two subnets with conflicting CIDRs in the same VPC # Attempt to create two subnets with conflicting CIDRs in the same VPC
tests("#create_subnet('#{@vpc_id}', '10.0.10.0/24'); " \ tests("#create_subnet('#{@vpc_id}', '10.0.10.0/24'); " \
"#create_subnet('#{@vpc_id}', '10.0.10.64/26'); ").raises(::Fog::Compute::AWS::Error) do "#create_subnet('#{@vpc_id}', '10.0.10.64/26'); ").raises(::Fog::AWS::Compute::Error) do
Fog::Compute[:aws].create_subnet(@vpc_id, '10.0.10.0/24') Fog::Compute[:aws].create_subnet(@vpc_id, '10.0.10.0/24')
Fog::Compute[:aws].create_subnet(@vpc_id, '10.0.10.64/26') Fog::Compute[:aws].create_subnet(@vpc_id, '10.0.10.64/26')
end end

View file

@ -1,5 +1,5 @@
Shindo.tests('Fog::Compute[:aws] | tag requests', ['aws']) do Shindo.tests('Fog::Compute[:aws] | tag requests', ['aws']) do
Fog::Compute::AWS::Mock.reset if Fog.mocking? Fog::AWS::Compute::Mock.reset if Fog.mocking?
@tags_format = { @tags_format = {
'tagSet' => [{ 'tagSet' => [{
@ -18,7 +18,7 @@ Shindo.tests('Fog::Compute[:aws] | tag requests', ['aws']) do
tests('success') do tests('success') do
if Fog.mocking? if Fog.mocking?
@other_account = Fog::Compute::AWS.new(:aws_access_key_id => 'other', :aws_secret_access_key => 'account') @other_account = Fog::AWS::Compute.new(:aws_access_key_id => 'other', :aws_secret_access_key => 'account')
@image_id = Fog::Compute[:aws].register_image('image', 'image', '/dev/sda1').body['imageId'] @image_id = Fog::Compute[:aws].register_image('image', 'image', '/dev/sda1').body['imageId']
end end
@ -97,5 +97,5 @@ Shindo.tests('Fog::Compute[:aws] | tag requests', ['aws']) do
Fog::Compute[:aws].create_tags('vpc-123', 'type' => 'bad_resource_id') Fog::Compute[:aws].create_tags('vpc-123', 'type' => 'bad_resource_id')
end end
end end
Fog::Compute::AWS::Mock.reset if Fog.mocking? Fog::AWS::Compute::Mock.reset if Fog.mocking?
end end

View file

@ -207,52 +207,52 @@ Shindo.tests('Fog::Compute[:aws] | volume requests', ['aws']) do
tests('failure') do tests('failure') do
@volume = Fog::Compute[:aws].volumes.create(:availability_zone => @server.availability_zone, :size => 1) @volume = Fog::Compute[:aws].volumes.create(:availability_zone => @server.availability_zone, :size => 1)
tests("#attach_volume('i-00000000', '#{@volume.identity}', '/dev/sdh')").raises(Fog::Compute::AWS::NotFound) do tests("#attach_volume('i-00000000', '#{@volume.identity}', '/dev/sdh')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].attach_volume('i-00000000', @volume.identity, '/dev/sdh') Fog::Compute[:aws].attach_volume('i-00000000', @volume.identity, '/dev/sdh')
end end
tests("#attach_volume('#{@server.identity}', 'vol-00000000', '/dev/sdh')").raises(Fog::Compute::AWS::NotFound) do tests("#attach_volume('#{@server.identity}', 'vol-00000000', '/dev/sdh')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].attach_volume(@server.identity, 'vol-00000000', '/dev/sdh') Fog::Compute[:aws].attach_volume(@server.identity, 'vol-00000000', '/dev/sdh')
end end
tests("#detach_volume('vol-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#detach_volume('vol-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].detach_volume('vol-00000000') Fog::Compute[:aws].detach_volume('vol-00000000')
end end
tests("#modify_volume_attribute('vol-00000000', true)").raises(Fog::Compute::AWS::NotFound) do tests("#modify_volume_attribute('vol-00000000', true)").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].modify_volume_attribute('vol-00000000', true) Fog::Compute[:aws].modify_volume_attribute('vol-00000000', true)
end end
tests("#detach_volume('#{@volume.identity}')").raises(Fog::Compute::AWS::Error) do tests("#detach_volume('#{@volume.identity}')").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].detach_volume(@volume.identity) Fog::Compute[:aws].detach_volume(@volume.identity)
end end
tests("#delete_volume('vol-00000000')").raises(Fog::Compute::AWS::NotFound) do tests("#delete_volume('vol-00000000')").raises(Fog::AWS::Compute::NotFound) do
Fog::Compute[:aws].delete_volume('vol-00000000') Fog::Compute[:aws].delete_volume('vol-00000000')
end end
# Iops required # Iops required
tests("#create_volume('#{@server.availability_zone}', 10, 'VolumeType' => 'io1')").raises(Fog::Compute::AWS::Error) do tests("#create_volume('#{@server.availability_zone}', 10, 'VolumeType' => 'io1')").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].create_volume(@server.availability_zone, 10, 'VolumeType' => 'io1') Fog::Compute[:aws].create_volume(@server.availability_zone, 10, 'VolumeType' => 'io1')
end end
# size too small for iops # size too small for iops
tests("#create_volume('#{@server.availability_zone}', 9, 'VolumeType' => 'io1', 'Iops' => 100)").raises(Fog::Compute::AWS::Error) do tests("#create_volume('#{@server.availability_zone}', 9, 'VolumeType' => 'io1', 'Iops' => 100)").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].create_volume(@server.availability_zone, 9, 'VolumeType' => 'io1', 'Iops' => 100) Fog::Compute[:aws].create_volume(@server.availability_zone, 9, 'VolumeType' => 'io1', 'Iops' => 100)
end end
# iops:size ratio too big # iops:size ratio too big
tests("#create_volume('#{@server.availability_zone}', 10, 'VolumeType' => 'io1', 'Iops' => 301)").raises(Fog::Compute::AWS::Error) do tests("#create_volume('#{@server.availability_zone}', 10, 'VolumeType' => 'io1', 'Iops' => 301)").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].create_volume(@server.availability_zone, 10, 'VolumeType' => 'io1', 'Iops' => 301) Fog::Compute[:aws].create_volume(@server.availability_zone, 10, 'VolumeType' => 'io1', 'Iops' => 301)
end end
# iops invalid value (lower than 100) # iops invalid value (lower than 100)
tests("#create_volume('#{@server.availability_zone}', 10, 'VolumeType' => 'io1', 'Iops' => 99)").raises(Fog::Compute::AWS::Error) do tests("#create_volume('#{@server.availability_zone}', 10, 'VolumeType' => 'io1', 'Iops' => 99)").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].create_volume(@server.availability_zone, 10, 'VolumeType' => 'io1', 'Iops' => 99) Fog::Compute[:aws].create_volume(@server.availability_zone, 10, 'VolumeType' => 'io1', 'Iops' => 99)
end end
# iops invalid value (greater than 4000) # iops invalid value (greater than 4000)
tests("#create_volume('#{@server.availability_zone}', 1024, 'VolumeType' => 'io1', 'Iops' => 4001)").raises(Fog::Compute::AWS::Error) do tests("#create_volume('#{@server.availability_zone}', 1024, 'VolumeType' => 'io1', 'Iops' => 4001)").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].create_volume(@server.availability_zone, 1024, 'VolumeType' => 'io1', 'Iops' => 4001) Fog::Compute[:aws].create_volume(@server.availability_zone, 1024, 'VolumeType' => 'io1', 'Iops' => 4001)
end end

View file

@ -104,11 +104,11 @@ Shindo.tests('Fog::Compute[:aws] | vpc requests', ['aws']) do
Fog::Compute[:aws].describe_vpc_attribute(@vpc_id, 'enableDnsHostnames').body["enableDnsHostnames"] Fog::Compute[:aws].describe_vpc_attribute(@vpc_id, 'enableDnsHostnames').body["enableDnsHostnames"]
end end
tests("#modify_vpc_attribute('#{@vpc_id}')").raises(Fog::Compute::AWS::Error) do tests("#modify_vpc_attribute('#{@vpc_id}')").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].modify_vpc_attribute(@vpc_id).body Fog::Compute[:aws].modify_vpc_attribute(@vpc_id).body
end end
tests("#modify_vpc_attribute('#{@vpc_id}', {'EnableDnsSupport.Value' => true, 'EnableDnsHostnames.Value' => true})").raises(Fog::Compute::AWS::Error) do tests("#modify_vpc_attribute('#{@vpc_id}', {'EnableDnsSupport.Value' => true, 'EnableDnsHostnames.Value' => true})").raises(Fog::AWS::Compute::Error) do
Fog::Compute[:aws].modify_vpc_attribute(@vpc_id, {'EnableDnsSupport.Value' => true, 'EnableDnsHostnames.Value' => true}).body Fog::Compute[:aws].modify_vpc_attribute(@vpc_id, {'EnableDnsSupport.Value' => true, 'EnableDnsHostnames.Value' => true}).body
end end
@ -211,6 +211,6 @@ Shindo.tests('Fog::Compute[:aws] | vpc requests', ['aws']) do
# Clean up # Clean up
Fog::Compute[:aws].delete_tags(@another_vpc.id, test_tags) Fog::Compute[:aws].delete_tags(@another_vpc.id, test_tags)
@another_vpc.destroy @another_vpc.destroy
Fog::Compute::AWS::Mock.reset if Fog.mocking? Fog::AWS::Compute::Mock.reset if Fog.mocking?
end end
end end