Fix root volume to show up in other EC2 volume API calls. Closes 470
This commit is contained in:
parent
fe946588b2
commit
44f0377cc4
5 changed files with 37 additions and 13 deletions
|
|
@ -737,14 +737,16 @@ def test_single_instance_with_ebs_volume():
|
|||
reservation = ec2_conn.get_all_instances()[0]
|
||||
ec2_instance = reservation.instances[0]
|
||||
|
||||
volume = ec2_conn.get_all_volumes()[0]
|
||||
volumes = ec2_conn.get_all_volumes()
|
||||
# Grab the mounted drive
|
||||
volume = [volume for volume in volumes if volume.attach_data.device == '/dev/sdh'][0]
|
||||
volume.volume_state().should.equal('in-use')
|
||||
volume.attach_data.instance_id.should.equal(ec2_instance.id)
|
||||
|
||||
stack = conn.describe_stacks()[0]
|
||||
resources = stack.describe_resources()
|
||||
ebs_volume = [resource for resource in resources if resource.resource_type == 'AWS::EC2::Volume'][0]
|
||||
ebs_volume.physical_resource_id.should.equal(volume.id)
|
||||
ebs_volumes = [resource for resource in resources if resource.resource_type == 'AWS::EC2::Volume']
|
||||
ebs_volumes[0].physical_resource_id.should.equal(volume.id)
|
||||
|
||||
|
||||
@mock_cloudformation()
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ def test_ami_create_and_delete():
|
|||
image.architecture.should.equal(instance.architecture)
|
||||
image.kernel_id.should.equal(instance.kernel)
|
||||
image.platform.should.equal(instance.platform)
|
||||
instance.terminate()
|
||||
|
||||
# Validate auto-created volume and snapshot
|
||||
volumes = conn.get_all_volumes()
|
||||
|
|
@ -61,6 +62,7 @@ def test_ami_copy():
|
|||
instance = reservation.instances[0]
|
||||
|
||||
source_image_id = conn.create_image(instance.id, "test-ami", "this is a test ami")
|
||||
instance.terminate()
|
||||
source_image = conn.get_all_images(image_ids=[source_image_id])[0]
|
||||
|
||||
# Boto returns a 'CopyImage' object with an image_id attribute here. Use the image_id to fetch the full info.
|
||||
|
|
@ -481,4 +483,3 @@ def test_ami_attribute_error_cases():
|
|||
cm.exception.code.should.equal('InvalidAMIID.NotFound')
|
||||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
|
|
|||
|
|
@ -57,8 +57,13 @@ def test_instance_launch_and_terminate():
|
|||
instances[0].vpc_id.should.equal(None)
|
||||
|
||||
root_device_name = instances[0].root_device_name
|
||||
instances[0].block_device_mapping[root_device_name].status.should.equal('attached')
|
||||
instances[0].block_device_mapping[root_device_name].volume_id.should.match(r'vol-\w+')
|
||||
instances[0].block_device_mapping[root_device_name].status.should.equal('in-use')
|
||||
volume_id = instances[0].block_device_mapping[root_device_name].volume_id
|
||||
volume_id.should.match(r'vol-\w+')
|
||||
|
||||
volume = conn.get_all_volumes(volume_ids=[volume_id])[0]
|
||||
volume.attach_data.instance_id.should.equal(instance.id)
|
||||
volume.status.should.equal('in-use')
|
||||
|
||||
conn.terminate_instances([instances[0].id])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue