kashyap | spawn now specifies availability zone, added test for detach volume
This commit is contained in:
parent
1e9b016c4a
commit
db91df71fa
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,4 +2,5 @@
|
||||
.vagrant
|
||||
.idea
|
||||
*.swp
|
||||
tests/logs/
|
||||
tests/logs/
|
||||
logs/
|
@ -212,7 +212,7 @@ class EC2Driver(driver.ComputeDriver):
|
||||
if user_data:
|
||||
user_data = base64.b64decode(user_data)
|
||||
|
||||
reservation = self.ec2_conn.run_instances(aws_ami, instance_type=flavor_type, user_data=user_data)
|
||||
reservation = self.ec2_conn.run_instances(aws_ami, instance_type=flavor_type, placement="us-east-1d", user_data=user_data)
|
||||
ec2_instance = reservation.instances
|
||||
|
||||
ec2_id = ec2_instance[0].id
|
||||
|
@ -184,5 +184,20 @@ class TestEC2Driver(EC2TestBase):
|
||||
volumes = self.nova.volumes.get_server_volumes(instance.id)
|
||||
self.assertIn(volume, volumes)
|
||||
|
||||
@unittest.skipIf(os.environ.get('MOCK_EC2'), 'Not supported by moto')
|
||||
def test_detach_volume(self):
|
||||
volume = self.nova_volume.volumes.create(1, snapshot_id=None, display_name='test', display_description=None,
|
||||
volume_type=None, availability_zone=None, imageRef=None)
|
||||
self.volumes.append(volume)
|
||||
instance, instance_ref = self.spawn_ec2_instance()
|
||||
self.nova.volumes.create_server_volume(instance_ref, volume.id, "/dev/sdb")
|
||||
self.sleep_if_ec2_not_mocked(30)
|
||||
volumes = self.nova.volumes.get_server_volumes(instance.id)
|
||||
if volume in volumes:
|
||||
self.nova.volumes.delete_server_volume(instance_ref, volume.id)
|
||||
self.sleep_if_ec2_not_mocked(30)
|
||||
volumes = self.nova.volumes.get_server_volumes(instance.id)
|
||||
self.assertNotIn(volume, volumes)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user