def test_good_volume_attach(self):
        """ Tests that attach runs when clean. """

        ctx = self.mock_relationship_context("test_good_volume_attach")
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        instance_id = self.get_instance_id()
        ctx.source.instance.runtime_properties["aws_resource_id"] = volume.id
        ctx.target.instance.runtime_properties["placement"] = TEST_ZONE
        ctx.target.instance.runtime_properties["aws_resource_id"] = instance_id
        ebs.attach(ctx=ctx)
Пример #2
0
    def test_good_volume_attach(self):
        """ Tests that attach runs when clean. """

        ctx = self.mock_relationship_context('test_good_volume_attach')
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        instance_id = self.get_instance_id()
        ctx.source.instance.runtime_properties['aws_resource_id'] = \
            volume.id
        ctx.target.instance.runtime_properties['placement'] = \
            TEST_ZONE
        ctx.target.instance.runtime_properties['aws_resource_id'] = \
            instance_id
        ebs.attach(ctx=ctx)
    def test_existing_volume_attach(self):
        """ Tests that when an address that is in the user's
            EC2 account is provided to the associate function
            no errors are raised
        """

        ctx = self.mock_relationship_context("test_existing_volume_attach")
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        instance_id = self.get_instance_id()
        ctx.source.node.properties["use_external_resource"] = True
        ctx.source.node.properties["resource_id"] = volume.id
        ctx.source.instance.runtime_properties["aws_resource_id"] = volume.id
        ctx.target.instance.runtime_properties["placement"] = TEST_ZONE
        ctx.target.node.properties["use_external_resource"] = True
        ctx.target.node.properties["resource_id"] = volume.id
        ctx.target.instance.runtime_properties["aws_resource_id"] = instance_id
        ebs.attach(ctx=ctx)
        self.assertEqual(instance_id, ctx.source.instance.runtime_properties["instance_id"])
Пример #4
0
    def test_existing_volume_attach(self):
        """ Tests that when an address that is in the user's
            EC2 account is provided to the associate function
            no errors are raised
        """

        ctx = self.mock_relationship_context('test_existing_volume_attach')
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        instance_id = self.get_instance_id()
        ctx.source.node.properties['use_external_resource'] = True
        ctx.source.node.properties['resource_id'] = volume.id
        ctx.source.instance.runtime_properties['aws_resource_id'] = \
            volume.id
        ctx.target.instance.runtime_properties['placement'] = \
            TEST_ZONE
        ctx.target.node.properties['use_external_resource'] = True
        ctx.target.node.properties['resource_id'] = volume.id
        ctx.target.instance.runtime_properties['aws_resource_id'] = \
            instance_id
        ebs.attach(ctx=ctx)
        self.assertEqual(instance_id,
                         ctx.source.instance.runtime_properties['instance_id'])