tests/requests/compute/volume_tests.rb in fog-aws-1.2.1 vs tests/requests/compute/volume_tests.rb in fog-aws-1.3.0
- old
+ new
@@ -66,10 +66,33 @@
'volumeType' => String
}],
'requestId' => String
}
+ @volume_modification_format = {
+ 'endTime' => Fog::Nullable::Time,
+ 'modificationState' => String,
+ 'originalIops' => Fog::Nullable::Integer,
+ 'originalSize' => Fog::Nullable::Integer,
+ 'originalVolumeType' => Fog::Nullable::String,
+ 'startTime' => Time,
+ 'targetIops' => Fog::Nullable::Integer,
+ 'targetSize' => Fog::Nullable::Integer,
+ 'targetVolumeType' => Fog::Nullable::String,
+ 'volumeId' => String,
+ }
+
+ @modify_volume_format = {
+ 'requestId' => String,
+ 'volumeModification' => @volume_modification_format
+ }
+
+ @describe_volume_modifications_format = {
+ 'requestId' => String,
+ 'volumeModificationSet' => [@volume_modification_format]
+ }
+
@server = Fog::Compute[:aws].servers.create
@server.wait_for { ready? }
tests('success') do
@volume_id = nil
@@ -111,17 +134,17 @@
end
Fog::Compute[:aws].delete_volume(@volume_id)
tests('#create_volume from snapshot with size').formats(@volume_format) do
- volume = Fog::Compute[:aws].volumes.create(:availability_zone => 'us-east-1d', :size => 1)
+ volume = Fog::Compute[:aws].volumes.create(:availability_zone => 'us-east-1d', :size => 1, :type => 'gp2')
volume.wait_for { ready? }
snapshot = Fog::Compute[:aws].create_snapshot(volume.identity).body
Fog::Compute[:aws].snapshots.new(snapshot).wait_for { ready? }
- data = Fog::Compute[:aws].create_volume(@server.availability_zone, 1, 'SnapshotId' => snapshot['snapshotId']).body
+ data = Fog::Compute[:aws].create_volume(@server.availability_zone, 1, 'SnapshotId' => snapshot['snapshotId'], 'VolumeType' => 'gp2').body
@volume_id = data['volumeId']
data
end
Fog::Compute[:aws].volumes.get(@volume_id).wait_for { ready? }
@@ -152,9 +175,26 @@
tests("#detach_volume('#{@volume_id}')").formats(@volume_attachment_format) do
Fog::Compute[:aws].detach_volume(@volume_id).body
end
Fog::Compute[:aws].volumes.get(@volume_id).wait_for { ready? }
+
+ tests("#modify_volume('#{@volume_id}', 'Size' => 100, 'VolumeType' => 'io1', 'Iops' => 5000").formats(@modify_volume_format) do
+ Fog::Compute[:aws].modify_volume(@volume_id, 'Size' => 100, 'VolumeType' => 'io1', 'Iops' => 5000).body
+ end
+
+ tests("#describe_volumes_modifications('volume-id' => '#{@volume_id}')").formats(@describe_volume_modifications_format) do
+ Fog.wait_for do
+ Fog::Compute[:aws].describe_volumes_modifications('volume-id' => @volume_id).body['volumeModificationSet'].first['modificationState'] == 'completed'
+ end
+
+ volume = Fog::Compute[:aws].describe_volumes('volume-id' => @volume_id).body['volumeSet'].first
+ returns(100) { volume['size'] }
+ returns('io1') { volume['volumeType'] }
+ returns(5000) { volume['iops'] }
+
+ Fog::Compute[:aws].describe_volumes_modifications('volume-id' => @volume_id).body
+ end
tests("#modify_volume_attribute('#{@volume_id}', true)").formats(AWS::Compute::Formats::BASIC) do
Fog::Compute[:aws].modify_volume_attribute(@volume_id, true).body
end