def test_volume_delete(self):
        """ This tests that release unsets the aws_resource_id
        runtime_properties
        """

        ctx = self.mock_ctx("test_volume_delete")
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        ctx.instance.runtime_properties["aws_resource_id"] = volume.id
        ebs.delete(ctx=ctx)
        self.assertNotIn("aws_resource_id", ctx.instance.runtime_properties)
Ejemplo n.º 2
0
    def test_good_volume_id_delete(self):
        """ This tests that release unsets the aws_resource_id
        runtime_properties
        """

        ctx = self.mock_ctx('test_good_volume_id_delete')
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        ctx.instance.runtime_properties['aws_resource_id'] = \
            volume.id
        ebs.delete(ctx=ctx)
        self.assertNotIn('aws_resource_id',
                         ctx.instance.runtime_properties.keys())
    def test_good_volume_id_delete(self):
        """ This tests that release unsets the aws_resource_id
        runtime_properties
        """

        ctx = self.mock_ctx('test_good_volume_id_delete')
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        ctx.instance.runtime_properties['aws_resource_id'] = \
            volume.id
        ebs.delete(ctx=ctx)
        self.assertNotIn('aws_resource_id',
                         ctx.instance.runtime_properties.keys())
    def test_delete_existing(self):
        """ Tests that delete actually deletes.
        """

        ctx = self.mock_ctx("test_delete_existing")
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        ctx.instance.runtime_properties["aws_resource_id"] = volume.id
        ctx.node.properties["use_external_resource"] = True
        ebs.delete(ctx=ctx)
        self.assertNotIn("aws_resource_id", ctx.instance.runtime_properties.keys())
        ec2_client = self.get_client()
        self.assertIsNotNone(ec2_client.get_all_volumes([volume.id]))
    def test_volume_delete_with_zone(self):
        """ This tests that release unsets the aws_resource_id
        and zone runtime_properties
        """

        ctx = self.mock_ctx("test_volume_delete_with_zone")
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        ctx.instance.runtime_properties["aws_resource_id"] = volume.id
        ctx.instance.runtime_properties[constants.ZONE] = volume.zone
        ebs.delete(ctx=ctx)
        self.assertNotIn("aws_resource_id", ctx.instance.runtime_properties)
        self.assertNotIn(constants.ZONE, ctx.instance.runtime_properties)
Ejemplo n.º 6
0
    def test_delete_existing(self):
        """ Tests that delete actually deletes.
        """

        ctx = self.mock_ctx('test_delete_existing')
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        ctx.instance.runtime_properties['aws_resource_id'] = \
            volume.id
        ctx.node.properties['use_external_resource'] = True
        ebs.delete(ctx=ctx)
        self.assertNotIn('aws_resource_id',
                         ctx.instance.runtime_properties.keys())
        ec2_client = self.get_client()
        self.assertIsNotNone(ec2_client.get_all_volumes([volume.id]))