mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|compute] make mock delay comparison >= so that delay 0 will work properly
This commit is contained in:
parent
b5d28104a5
commit
0f74c3f6c9
4 changed files with 10 additions and 10 deletions
|
@ -154,7 +154,7 @@ module Fog
|
|||
instance_set.each do |instance|
|
||||
case instance['instanceState']['name']
|
||||
when 'pending'
|
||||
if Time.now - instance['launchTime'] > Fog::Mock.delay
|
||||
if Time.now - instance['launchTime'] >= Fog::Mock.delay
|
||||
instance['ipAddress'] = Fog::AWS::Mock.ip_address
|
||||
instance['dnsName'] = Fog::AWS::Mock.dns_name_for(instance['ipAddress'])
|
||||
instance['privateIpAddress'] = Fog::AWS::Mock.ip_address
|
||||
|
@ -164,14 +164,14 @@ module Fog
|
|||
when 'rebooting'
|
||||
instance['instanceState'] = { 'code' => 16, 'name' => 'running' }
|
||||
when 'shutting-down'
|
||||
if Time.now - @data[:deleted_at][instance['instanceId']] > Fog::Mock.delay * 2
|
||||
if Time.now - @data[:deleted_at][instance['instanceId']] >= Fog::Mock.delay * 2
|
||||
@data[:deleted_at].delete(instance['instanceId'])
|
||||
@data[:instances].delete(instance['instanceId'])
|
||||
elsif Time.now - @data[:deleted_at][instance['instanceId']] > Fog::Mock.delay
|
||||
elsif Time.now - @data[:deleted_at][instance['instanceId']] >= Fog::Mock.delay
|
||||
instance['instanceState'] = { 'code' => 48, 'name' => 'terminating' }
|
||||
end
|
||||
when 'terminating'
|
||||
if Time.now - @data[:deleted_at][instance['instanceId']] > Fog::Mock.delay
|
||||
if Time.now - @data[:deleted_at][instance['instanceId']] >= Fog::Mock.delay
|
||||
@data[:deleted_at].delete(instance['instanceId'])
|
||||
@data[:instances].delete(instance['instanceId'])
|
||||
end
|
||||
|
|
|
@ -91,10 +91,10 @@ module Fog
|
|||
snapshot_set.each do |snapshot|
|
||||
case snapshot['status']
|
||||
when 'in progress', 'pending'
|
||||
if Time.now - snapshot['startTime'] > Fog::Mock.delay * 2
|
||||
if Time.now - snapshot['startTime'] >= Fog::Mock.delay * 2
|
||||
snapshot['progress'] = '100%'
|
||||
snapshot['status'] = 'completed'
|
||||
elsif Time.now - snapshot['startTime'] > Fog::Mock.delay
|
||||
elsif Time.now - snapshot['startTime'] >= Fog::Mock.delay
|
||||
snapshot['progress'] = '50%'
|
||||
snapshot['status'] = 'in progress'
|
||||
else
|
||||
|
|
|
@ -83,16 +83,16 @@ module Fog
|
|||
volume_set.each do |volume|
|
||||
case volume['status']
|
||||
when 'attaching'
|
||||
if Time.now - volume['attachmentSet'].first['attachTime'] > Fog::Mock.delay
|
||||
if Time.now - volume['attachmentSet'].first['attachTime'] >= Fog::Mock.delay
|
||||
volume['attachmentSet'].first['status'] = 'in-use'
|
||||
volume['status'] = 'in-use'
|
||||
end
|
||||
when 'creating'
|
||||
if Time.now - volume['createTime'] > Fog::Mock.delay
|
||||
if Time.now - volume['createTime'] >= Fog::Mock.delay
|
||||
volume['status'] = 'available'
|
||||
end
|
||||
when 'deleting'
|
||||
if Time.now - @data[:deleted_at][volume['volumeId']] > Fog::Mock.delay
|
||||
if Time.now - @data[:deleted_at][volume['volumeId']] >= Fog::Mock.delay
|
||||
@data[:deleted_at].delete(volume['volumeId'])
|
||||
@data[:volumes].delete(volume['volumeId'])
|
||||
end
|
||||
|
|
|
@ -32,7 +32,7 @@ module Fog
|
|||
for image in images
|
||||
case image['status']
|
||||
when 'SAVING'
|
||||
if Time.now - @data[:last_modified][:images][image['id']] > Fog::Mock.delay
|
||||
if Time.now - @data[:last_modified][:images][image['id']] >= Fog::Mock.delay
|
||||
image['status'] = 'ACTIVE'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue