def test_create(self):
        """ This tests that allocate adds the runtime_properties."""

        ctx = self.mock_ctx('test_create')
        current_ctx.set(ctx=ctx)
        args = dict()
        ebs.create(args, ctx=ctx)
        self.assertIn('aws_resource_id', ctx.instance.runtime_properties)
Exemple #2
0
    def test_create(self):
        """ This tests that allocate adds the runtime_properties."""

        ctx = self.mock_ctx('test_create')
        current_ctx.set(ctx=ctx)
        args = dict()
        ebs.create(args, ctx=ctx)
        self.assertIn('aws_resource_id', ctx.instance.runtime_properties)
Exemple #3
0
    def test_good_snapshot(self):

        ctx = self.mock_ctx('test_good_snapshot')
        current_ctx.set(ctx=ctx)
        args = dict()
        ebs.create(args, ctx=ctx)
        args = dict()
        ebs.create_snapshot(args, ctx=ctx)
        self.assertIn(constants.EBS['VOLUME_SNAPSHOT_ATTRIBUTE'],
                      ctx.instance.runtime_properties)
    def test_good_snapshot(self):

        ctx = self.mock_ctx('test_good_snapshot')
        current_ctx.set(ctx=ctx)
        args = dict()
        ebs.create(args, ctx=ctx)
        args = dict()
        ebs.create_snapshot(args, ctx=ctx)
        self.assertIn(
            constants.EBS['VOLUME_SNAPSHOT_ATTRIBUTE'],
            ctx.instance.runtime_properties)
    def test_external_resource(self):
        """ This tests that create sets the aws_resource_id
        runtime_properties
        """

        ctx = self.mock_volume_node('test_external_resource')
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        ctx.node.properties['use_external_resource'] = True
        ctx.node.properties['resource_id'] = volume.id
        args = dict()
        ebs.create(args)
        self.assertIn('aws_resource_id', ctx.instance.runtime_properties)
    def test_create_with_zone(self):
        """ This tests that allocate zone is updated with the users
        zone input."""

        zone = 'us-east-1b'
        ctx = self.mock_ctx('test_create_with_zone', zone=zone)
        current_ctx.set(ctx=ctx)
        args = {constants.ZONE: zone}
        ebs.create(args, ctx=ctx)
        self.assertIn('aws_resource_id', ctx.instance.runtime_properties)
        self.assertIn(constants.ZONE, ctx.instance.runtime_properties)
        self.assertEqual(zone, ctx.instance.runtime_properties.get(
            constants.ZONE))
Exemple #7
0
    def test_external_resource(self):
        """ This tests that create sets the aws_resource_id
        runtime_properties
        """

        ctx = self.mock_volume_node('test_external_resource')
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        ctx.node.properties['use_external_resource'] = True
        ctx.node.properties['resource_id'] = volume.id
        args = dict()
        ebs.create(args)
        self.assertIn('aws_resource_id', ctx.instance.runtime_properties)
Exemple #8
0
    def test_create_with_zone(self):
        """ This tests that allocate zone is updated with the users
        zone input."""

        zone = 'us-east-1b'
        ctx = self.mock_ctx('test_create_with_zone', zone=zone)
        current_ctx.set(ctx=ctx)
        args = {constants.ZONE: zone}
        ebs.create(args, ctx=ctx)
        self.assertIn('aws_resource_id', ctx.instance.runtime_properties)
        self.assertIn(constants.ZONE, ctx.instance.runtime_properties)
        self.assertEqual(zone,
                         ctx.instance.runtime_properties.get(constants.ZONE))
Exemple #9
0
    def test_volume_external_resource_passing_volume_type(self):
        """ This tests that create sets the aws_volume_type
        runtime_properties
        """

        ctx = self.mock_volume_node(
            'test_volume_external_resource_passing_volume_type')
        current_ctx.set(ctx=ctx)
        volume = self.get_volume()
        ctx.node.properties['use_external_resource'] = True
        ctx.node.properties['resource_id'] = volume.id
        ctx.node.properties['volume_type'] = 'gp2'
        args = dict()
        output = ebs.create(args)
        self.assertEqual(True, output)