#NEWLINE# def test_component_auto_scaling_group_configurable_properties( ) : #NEWLINE# #INDENT# definition = { #NEWLINE# #INDENT# 'Resources' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# configuration = { #NEWLINE# #INDENT# 'Name' : 'Foo' , #NEWLINE# 'InstanceType' : 't2.micro' , #NEWLINE# 'Image' : 'foo' , #NEWLINE# 'AutoScaling' : { #NEWLINE# #INDENT# 'Minimum' : 2 , #NEWLINE# 'Maximum' : 10 , #NEWLINE# 'SuccessRequires' : '4 within 30m' , #NEWLINE# 'MetricType' : 'CPU' , #NEWLINE# 'Period' : 60 , #NEWLINE# 'ScaleUpThreshold' : 50 , #NEWLINE# 'ScaleDownThreshold' : 20 , #NEWLINE# 'EvaluationPeriods' : 1 , #NEWLINE# 'Cooldown' : 30 , #NEWLINE# 'Statistic' : 'Maximum' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# args = MagicMock ( ) #NEWLINE# args . region = 'foo' #NEWLINE# info = { #NEWLINE# #INDENT# 'StackName' : 'FooStack' , #NEWLINE# 'StackVersion' : 'FooVersion' , #NEWLINE# #UNINDENT# } #NEWLINE# result = component_auto_scaling_group ( definition , configuration , args , info , False , MagicMock ( ) ) #NEWLINE# assert ( result [ 'Resources' ] [ 'FooScaleUp' ] is not None ) #NEWLINE# assert ( result [ 'Resources' ] [ 'FooScaleUp' ] [ 'Properties' ] is not None ) #NEWLINE# assert ( info [ 'Resources' ] [ 'FooScaleUp' ] [ 'Properties' ] [ 'ScalingAdjustment' ] == '1' ) #NEWLINE# assert ( result [ 'Resources' ] [ 'FooScaleUp' ] [ 'Properties' ] [ 'Cooldown' ] == '30' ) #NEWLINE# assert ( result [ 'Resources' ] [ 'FooScaleDown' ] is not None ) #NEWLINE# assert ( result [ 'Resources' ] [ 'FooScaleDown' ] [ 'Properties' ] is not None ) #NEWLINE# assert ( result [ 'Resources' ] [ 'FooScaleDown' ] [ 'Properties' ] [ 'Cooldown' ] == '30' ) #NEWLINE# assert ( result [ 'Resources' ] [ 'FooScaleDown' ] [ 'Properties' ] [ 'ScalingAdjustment' ] == '-1' ) #NEWLINE# assert ( result [ 'Resources' ] [ 'Foo' ] is not None ) #NEWLINE# assert ( result [ 'Resources' ] [ 'Foo' ] [ 'CreationPolicy' ] is not None ) #NEWLINE# assert ( result [ 'Resources' ] [ 'Foo' ] [ 'CreationPolicy' ] [ 'ResourceSignal' ] is not None ) #NEWLINE# assert ( result [ 'Resources' ] [ 'Foo' ] [ 'CreationPolicy' ] [ 'ResourceSignal' ] [ 'Timeout' ] == 'PT30M' ) #NEWLINE# assert ( result [ 'Resources' ] [ 'Foo' ] [ 'CreationPolicy' ] [ 'ResourceSignal' ] [ 'Count' ] == '4' ) #NEWLINE# assert ( result [ 'Resources' ] [ 'Foo' ] [ 'Properties' ] is not None ) #NEWLINE# assert ( result [ 'Resources' ] [ 'Foo' ] [ 'Properties' ] [ 'HealthCheckType' ] == 'EC2' ) #NEWLINE# assert ( result [ 'Resources' ] [ 'Foo' ] [ 'Properties' ] [ 'MinSize' ] == 2 ) #NEWLINE# assert ( result [ 'Resources' ] [ 'Foo' ] [ 'Properties' ] [ 'DesiredCapacity' ] == 2 ) #NEWLINE# assert ( result [ 'Resources' ] [ 'Foo' ] [ 'Properties' ] [ 'MaxSize' ] == 10 ) #NEWLINE# expected_desc = 'Scale-down if CPU < 20% for 1.0 minutes (Maximum)' #NEWLINE# assert ( result [ 'Resources' ] [ 'FooCPUAlarmHigh' ] [ 'Properties' ] [ 'Statistic' ] == 'Maximum' ) #NEWLINE# assert ( result [ 'Resources' ] [ 'FooCPUAlarmLow' ] [ 'Properties' ] [ 'Period' ] == '60' ) #NEWLINE# assert ( result [ 'Resources' ] [ 'FooCPUAlarmHigh' ] [ 'Properties' ] [ 'EvaluationPeriods' ] == '1' ) #NEWLINE# assert ( result [ 'Resources' ] [ 'FooCPUAlarmLow' ] [ 'Properties' ] [ 'AlarmDescription' ] == expected_desc )