mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[ec2] Add ipAddress information into the mock data
This commit is contained in:
parent
efca3e1b03
commit
11243063b6
2 changed files with 7 additions and 6 deletions
|
@ -77,7 +77,8 @@ module Fog
|
|||
case instance['instanceState']['name']
|
||||
when 'pending'
|
||||
if Time.now - instance['launchTime'] > Fog::Mock.delay
|
||||
instance['dnsName'] = "ec2-#{Fog::AWS::Mock.ip_address.gsub('.','-')}.compute-1.amazonaws.com"
|
||||
instance['ipAddress'] = Fog::AWS::Mock.ip_address
|
||||
instance['dnsName'] = "ec2-#{instance['ipAddress'].gsub('.','-')}.compute-1.amazonaws.com"
|
||||
instance['privateIpAddress'] = Fog::AWS::Mock.ip_address
|
||||
instance['privateDnsName'] = "ip-#{instance['privateIpAddress'].gsub('.','-')}.ec2.internal"
|
||||
instance['instanceState'] = { 'code' => 16, 'name' => 'running' }
|
||||
|
@ -105,7 +106,7 @@ module Fog
|
|||
'ownerId' => instance['ownerId'],
|
||||
'reservationId' => instance['reservationId']
|
||||
}
|
||||
reservation_set[instance['reservationId']]['instancesSet'] << instance.reject{|key,value| !['amiLaunchIndex', 'blockDeviceMapping', 'dnsName', 'imageId', 'instanceId', 'instanceState', 'instanceType', 'kernelId', 'keyName', 'launchTime', 'monitoring', 'placement', 'privateDnsName', 'productCodes', 'ramdiskId', 'reason', 'rootDeviceType'].include?(key)}
|
||||
reservation_set[instance['reservationId']]['instancesSet'] << instance.reject{|key,value| !['amiLaunchIndex', 'blockDeviceMapping', 'dnsName', 'imageId', 'instanceId', 'instanceState', 'instanceType', 'ipAddress', 'kernelId', 'keyName', 'launchTime', 'monitoring', 'placement', 'privateDnsName', 'privateIpAddress', 'productCodes', 'ramdiskId', 'reason', 'rootDeviceType'].include?(key)}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ describe 'EC2.describe_instances' do
|
|||
instance['instanceState']['code'].should be_a(Integer)
|
||||
instance['instanceState']['name'].should be_a(String)
|
||||
instance['instanceType'].should be_a(String)
|
||||
# instance['ipAddress'].should be_a(String)
|
||||
instance['ipAddress'].should be_a(String)
|
||||
instance['kernelId'].should be_a(String)
|
||||
instance['keyName'].should be_a(String) if instance['keyName']
|
||||
instance['launchTime'].should be_a(Time)
|
||||
|
@ -42,7 +42,7 @@ describe 'EC2.describe_instances' do
|
|||
instance['placement'].should be_a(Hash)
|
||||
instance['placement']['availabilityZone'].should be_a(String)
|
||||
instance['privateDnsName'].should be_a(String)
|
||||
# instance['privateIpAddress'].should be_a(String)
|
||||
instance['privateIpAddress'].should be_a(String)
|
||||
instance['productCodes'].should be_an(Array)
|
||||
instance['productCodes'].first.should be_a(String) if instance['productCodes'].first
|
||||
instance['ramdiskId'].should be_a(String)
|
||||
|
@ -71,7 +71,7 @@ describe 'EC2.describe_instances' do
|
|||
instance['instanceState']['code'].should be_a(Integer)
|
||||
instance['instanceState']['name'].should be_a(String)
|
||||
instance['instanceType'].should be_a(String)
|
||||
# instance['ipAddress'].should be_a(String)
|
||||
instance['ipAddress'].should be_a(String)
|
||||
instance['kernelId'].should be_a(String)
|
||||
instance['keyName'].should be_a(String) if instance['keyName']
|
||||
instance['launchTime'].should be_a(Time)
|
||||
|
@ -80,7 +80,7 @@ describe 'EC2.describe_instances' do
|
|||
instance['placement'].should be_a(Hash)
|
||||
instance['placement']['availabilityZone'].should be_a(String)
|
||||
instance['privateDnsName'].should be_a(String)
|
||||
# instance['privateIpAddress'].should be_a(String)
|
||||
instance['privateIpAddress'].should be_a(String)
|
||||
instance['productCodes'].should be_an(Array)
|
||||
instance['productCodes'].first.should be_a(String) if instance['productCodes'].first
|
||||
instance['ramdiskId'].should be_a(String)
|
||||
|
|
Loading…
Add table
Reference in a new issue