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

Merge pull request #407 from dylanegan/aws_test_fixes

AWS test fixes
This commit is contained in:
Wesley Beary 2011-07-11 13:30:23 -07:00
commit be9013912e
8 changed files with 25 additions and 23 deletions

View file

@ -139,10 +139,9 @@ module Fog
'keyName' => options['KeyName'],
'launchTime' => Time.now,
'monitoring' => { 'state' => options['Monitoring.Enabled'] || false },
'placement' => { 'availabilityZone' => options['Placement.AvailabilityZone'] || Fog::AWS::Mock.availability_zone(@region) },
'placement' => { 'availabilityZone' => options['Placement.AvailabilityZone'] || Fog::AWS::Mock.availability_zone(@region), 'groupName' => nil, 'tenancy' => 'default' },
'privateDnsName' => nil,
'productCodes' => [],
'ramdiskId' => options['RamdiskId'] || Fog::AWS::Mock.ramdisk_id,
'reason' => nil,
'rootDeviceType' => 'instance-store'
}

View file

@ -21,7 +21,7 @@ Shindo.tests('AWS::ELB | listener_tests', ['aws', 'elb']) do
# This is sort of fucked up, but it may or may not fail, thanks AWS
tests("#create_load_balancer_listeners with SSL certificate").formats(AWS::ELB::Formats::BASIC) do
sleep 1 unless Fog.mocking?
sleep 5 unless Fog.mocking?
listeners = [
{'Protocol' => 'HTTPS', 'LoadBalancerPort' => 443, 'InstancePort' => 443, 'SSLCertificateId' => @certificate['Arn']},
]

View file

@ -21,6 +21,8 @@ Shindo.tests("Fog::Compute[:aws] | volume", ['aws']) do
@instance.server = nil
end
@instance.wait_for { ready? }
@instance.server = @server
@instance.wait_for { state == 'in-use' }

View file

@ -15,11 +15,15 @@ Shindo.tests('Fog::Compute[:aws] | instance requests', ['aws']) do
'keyName' => Fog::Nullable::String,
'launchTime' => Time,
'monitoring' => {'state' => Fog::Boolean},
'placement' => {'availabilityZone' => String},
'placement' => {
'availabilityZone' => String,
'groupName' => Fog::Nullable::String,
'tenancy' => String
},
'privateDnsName' => NilClass,
# 'privateIpAddress' => String,
'productCodes' => [],
'ramdiskId' => Fog::Nullable::String,
# 'ramdiskId' => Fog::Nullable::String,
'reason' => Fog::Nullable::String,
# 'rootDeviceName' => String,
'rootDeviceType' => String,
@ -100,7 +104,7 @@ Shindo.tests('Fog::Compute[:aws] | instance requests', ['aws']) do
server.wait_for { ready? }
tests("#describe_instances").formats(@describe_instances_format) do
Fog::Compute[:aws].describe_instances.body
Fog::Compute[:aws].describe_instances('instance-state-name' => 'running').body
end
# Launch another instance to test filters
@ -135,7 +139,7 @@ Shindo.tests('Fog::Compute[:aws] | instance requests', ['aws']) do
String === pkey.private_decrypt(decoded_password)
end
result
end
end unless ENV['FASTER_TEST_PLEASE']
key.destroy

View file

@ -1,5 +1,4 @@
Shindo.tests('Fog::Compute[:aws] | placement group requests', ['aws']) do
@placement_group_format = {
'requestId' => String,
'placementGroupSet' => [{
@ -10,7 +9,6 @@ Shindo.tests('Fog::Compute[:aws] | placement group requests', ['aws']) do
}
tests('success') do
tests("#create_placement_group('fog_placement_group', 'cluster')").formats(AWS::Compute::Formats::BASIC) do
pending if Fog.mocking?
Fog::Compute[:aws].create_placement_group('fog_placement_group', 'cluster').body
@ -30,13 +28,12 @@ Shindo.tests('Fog::Compute[:aws] | placement group requests', ['aws']) do
pending if Fog.mocking?
Fog::Compute[:aws].delete_placement_group('fog_placement_group').body
end
end
tests('failure') do
unless Fog.mocking?
Fog::Compute[:aws].create_placement_group('fog_placement_group', 'cluster')
end
tests('failure') do
pending if Fog.mocking?
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
Fog::Compute[:aws].create_placement_group('fog_placement_group', 'cluster')
@ -46,9 +43,6 @@ Shindo.tests('Fog::Compute[:aws] | placement group requests', ['aws']) do
Fog::Compute[:aws].delete_placement_group('not_a_group_name')
end
unless Fog.mocking?
Fog::Compute[:aws].delete_placement_group('fog_placement_group')
end
Fog::Compute[:aws].delete_placement_group('fog_placement_group')
end
end
end

View file

@ -1,5 +1,4 @@
Shindo.tests('Fog::Compute[:aws] | spot datafeed subscription requests', ['aws']) do
@spot_datafeed_subscription_format = {
'spotDatafeedSubscription' => {
'bucket' => String,
@ -13,6 +12,7 @@ Shindo.tests('Fog::Compute[:aws] | spot datafeed subscription requests', ['aws']
@directory = Fog::Storage[:aws].directories.create(:key => 'fogspotdatafeedsubscriptiontests')
tests('success') do
pending if Fog.mocking?
tests("#create_spot_datafeed_subscription('fogspotdatafeedsubscriptiontests', 'fogspotdatafeedsubscription/')").formats(@spot_datafeed_subscription_format) do
Fog::Compute[:aws].create_spot_datafeed_subscription('fogspotdatafeedsubscriptiontests', 'fogspotdatafeedsubscription/').body
@ -33,16 +33,15 @@ Shindo.tests('Fog::Compute[:aws] | spot datafeed subscription requests', ['aws']
tests("duplicate #delete_spot_datafeed_subscription").succeeds do
Fog::Compute[:aws].delete_spot_datafeed_subscription
end
end
tests('failure') do
pending if Fog.mocking?
tests("#describe_spot_datafeed_subscription").raises(Fog::Compute::AWS::NotFound) do
Fog::Compute[:aws].describe_spot_datafeed_subscription
end
end
@directory.destroy
end

View file

@ -32,6 +32,8 @@ Shindo.tests('Fog::Compute[:aws] | spot instance requests', ['aws']) do
tests('success') do
pending if Fog.mocking?
tests("#request_spot_instances('ami-3202f25b', 't1.micro', '0.001')").formats(@spot_instance_requests_format) do
data = Fog::Compute[:aws].request_spot_instances('ami-3202f25b', 't1.micro', '0.001').body
@spot_instance_request_id = data['spotInstanceRequestSet'].first['spotInstanceRequestId']

View file

@ -13,6 +13,8 @@ Shindo.tests('Fog::Compute[:aws] | spot price history requests', ['aws']) do
tests('success') do
pending # Some history data doesn't have an availability zone
tests("#describe_spot_price_history").formats(@spot_price_history_format) do
Fog::Compute[:aws].describe_spot_price_history.body
end