The heat_integrationtests.functional.test_autoscaling Module

class heat_integrationtests.functional.test_autoscaling.AutoScalingSignalTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.test_autoscaling.AutoscalingGroupTest

check_instance_count(stack_identifier, expected)[source]
lb_template = '\nheat_template_version: 2013-05-23\nparameters:\n ImageId: {type: string}\n InstanceType: {type: string}\n SecurityGroups: {type: comma_delimited_list}\n UserData: {type: string}\n Tags: {type: comma_delimited_list, default: "x,y"}\n\nresources:\noutputs:\n PublicIp: {value: "not-used"}\n AvailabilityZone: {value: \'not-used1\'}\n PrivateDnsName: {value: \'not-used2\'}\n PublicDnsName: {value: \'not-used3\'}\n PrivateIp: {value: \'not-used4\'}\n\n'
setUp()[source]
template = '\n{\n "AWSTemplateFormatVersion" : "2010-09-09",\n "Description" : "Template to create multiple instances.",\n "Parameters" : {"size": {"Type": "String", "Default": "1"},\n "AZ": {"Type": "String", "Default": "nova"},\n "image": {"Type": "String"},\n "flavor": {"Type": "String"}},\n "Resources": {\n "custom_lb": {\n "Type": "AWS::EC2::Instance",\n "Properties": {\n "ImageId": {"Ref": "image"},\n "InstanceType": {"Ref": "flavor"},\n "UserData": "foo",\n "SecurityGroups": [ "sg-1" ],\n "Tags": []\n },\n "Metadata": {\n "IPs": {"Fn::GetAtt": ["JobServerGroup", "InstanceList"]}\n }\n },\n "JobServerGroup": {\n "Type" : "AWS::AutoScaling::AutoScalingGroup",\n "Properties" : {\n "AvailabilityZones" : [{"Ref": "AZ"}],\n "LaunchConfigurationName" : { "Ref" : "JobServerConfig" },\n "DesiredCapacity" : {"Ref": "size"},\n "MinSize" : "0",\n "MaxSize" : "20"\n }\n },\n "JobServerConfig" : {\n "Type" : "AWS::AutoScaling::LaunchConfiguration",\n "Metadata": {"foo": "bar"},\n "Properties": {\n "ImageId" : {"Ref": "image"},\n "InstanceType" : {"Ref": "flavor"},\n "SecurityGroups" : [ "sg-1" ],\n "UserData" : "jsconfig data"\n }\n },\n "ScaleUpPolicy" : {\n "Type" : "AWS::AutoScaling::ScalingPolicy",\n "Properties" : {\n "AdjustmentType" : "ChangeInCapacity",\n "AutoScalingGroupName" : { "Ref" : "JobServerGroup" },\n "Cooldown" : "0",\n "ScalingAdjustment": "1"\n }\n },\n "ScaleDownPolicy" : {\n "Type" : "AWS::AutoScaling::ScalingPolicy",\n "Properties" : {\n "AdjustmentType" : "ChangeInCapacity",\n "AutoScalingGroupName" : { "Ref" : "JobServerGroup" },\n "Cooldown" : "0",\n "ScalingAdjustment" : "-2"\n }\n }\n },\n "Outputs": {\n "InstanceList": {"Value": {\n "Fn::GetAtt": ["JobServerGroup", "InstanceList"]}}\n }\n}\n'
test_scaling_meta_update()[source]

Use heatclient to signal the up and down policy.

Then confirm that the metadata in the custom_lb is updated each time.

test_signal_during_suspend()[source]

Prove that a signal will fail when the stack is in suspend.

test_signal_with_policy_update()[source]

Prove that an updated policy is used in the next signal.

class heat_integrationtests.functional.test_autoscaling.AutoscalingGroupBasicTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.test_autoscaling.AutoscalingGroupTest

test_basic_create_works()[source]

Make sure the working case is good.

Note this combines test_override_aws_ec2_instance into this test as well, which is: If AWS::EC2::Instance is overridden, AutoScalingGroup will automatically use that overridden resource type.

test_create_instance_error_causes_group_error()[source]

Test create failing a resource in the instance group.

If a resource in an instance group fails to be created, the instance group itself will fail and the broken inner resource will remain.

test_group_suspend_resume()[source]
test_size_updates_work()[source]
test_update_group_replace()[source]

Test case for ensuring non-updatable props case a replacement.

Make sure that during a group update the non-updatable properties cause a replacement.

test_update_instance_error_causes_group_error()[source]

Test update failing a resource in the instance group.

If a resource in an instance group fails to be created during an update, the instance group itself will fail and the broken inner resource will remain.

class heat_integrationtests.functional.test_autoscaling.AutoscalingGroupTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.functional_base.FunctionalTestsBase

assert_instance_count(stack, expected_count)[source]
bad_instance_template = '\nheat_template_version: 2013-05-23\nparameters:\n ImageId: {type: string}\n InstanceType: {type: string}\n SecurityGroups: {type: comma_delimited_list}\n UserData: {type: string}\n Tags: {type: comma_delimited_list, default: "x,y"}\n\nresources:\n random1:\n type: OS::Heat::RandomString\n depends_on: waiter\n ready_poster:\n type: AWS::CloudFormation::WaitConditionHandle\n waiter:\n type: AWS::CloudFormation::WaitCondition\n properties:\n Handle: {get_resource: ready_poster}\n Timeout: 1\noutputs:\n PublicIp:\n value: {get_attr: [random1, value]}\n'
instance_template = '\nheat_template_version: 2013-05-23\nparameters:\n ImageId: {type: string}\n InstanceType: {type: string}\n SecurityGroups: {type: comma_delimited_list}\n UserData: {type: string}\n Tags: {type: comma_delimited_list, default: "x,y"}\n\nresources:\n random1:\n type: OS::Heat::RandomString\n properties:\n salt: {get_param: UserData}\noutputs:\n PublicIp: {value: {get_attr: [random1, value]}}\n AvailabilityZone: {value: \'not-used11\'}\n PrivateDnsName: {value: \'not-used12\'}\n PublicDnsName: {value: \'not-used13\'}\n PrivateIp: {value: \'not-used14\'}\n'
setUp()[source]
template = '\n{\n "AWSTemplateFormatVersion" : "2010-09-09",\n "Description" : "Template to create multiple instances.",\n "Parameters" : {"size": {"Type": "String", "Default": "1"},\n "AZ": {"Type": "String", "Default": "nova"},\n "image": {"Type": "String"},\n "flavor": {"Type": "String"},\n "user_data": {"Type": "String", "Default": "jsconfig data"}},\n "Resources": {\n "JobServerGroup": {\n "Type" : "AWS::AutoScaling::AutoScalingGroup",\n "Properties" : {\n "AvailabilityZones" : [{"Ref": "AZ"}],\n "LaunchConfigurationName" : { "Ref" : "JobServerConfig" },\n "MinSize" : {"Ref": "size"},\n "MaxSize" : "20"\n }\n },\n\n "JobServerConfig" : {\n "Type" : "AWS::AutoScaling::LaunchConfiguration",\n "Metadata": {"foo": "bar"},\n "Properties": {\n "ImageId" : {"Ref": "image"},\n "InstanceType" : {"Ref": "flavor"},\n "SecurityGroups" : [ "sg-1" ],\n "UserData" : {"Ref": "user_data"}\n }\n }\n },\n "Outputs": {\n "InstanceList": {"Value": {\n "Fn::GetAtt": ["JobServerGroup", "InstanceList"]}},\n "JobServerConfigRef": {"Value": {\n "Ref": "JobServerConfig"}}\n }\n}\n'
class heat_integrationtests.functional.test_autoscaling.AutoscalingGroupUpdatePolicyTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.test_autoscaling.AutoscalingGroupTest

ig_tmpl_with_updt_policy()[source]
test_instance_group_update_no_replace()[source]

Test simple update only and no replace.

Test simple update only and no replace (i.e. updated instance flavor in Launch Configuration) with no conflict in batch size and minimum instances in service.

test_instance_group_update_no_replace_with_adjusted_capacity()[source]

Test update only and no replace with capacity adjustment.

Test update only and no replace (i.e. updated instance flavor in Launch Configuration) with capacity adjustment due to conflict in batch size and minimum instances in service.

test_instance_group_update_replace()[source]

Test simple update replace.

Test update replace with no conflict in batch size and minimum instances in service.

test_instance_group_update_replace_huge_batch_size()[source]

Test update replace with a huge batch size.

test_instance_group_update_replace_huge_min_in_service()[source]

Update replace with huge number of minimum instances in service.

test_instance_group_update_replace_with_adjusted_capacity()[source]

Test update replace with capacity adjustment.

Test update replace with capacity adjustment due to conflict in batch size and minimum instances in service.

update_instance_group(updt_template, num_updates_expected_on_updt, num_creates_expected_on_updt, num_deletes_expected_on_updt)[source]