Skip to content

Commit

Permalink
Properly name variable for checking if scale on request has been called
Browse files Browse the repository at this point in the history
The naming and information didn't fully match eachother.
  • Loading branch information
azatoth committed Dec 17, 2022
1 parent c0015be commit 1ae1d8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts
Expand Up @@ -985,7 +985,7 @@ abstract class AutoScalingGroupBase extends Resource implements IAutoScalingGrou
public abstract readonly osType: ec2.OperatingSystemType;
protected albTargetGroup?: elbv2.ApplicationTargetGroup;
public readonly grantPrincipal: iam.IPrincipal = new iam.UnknownPrincipal({ resource: this });
protected hasSetScaleOnRequest: boolean = false;
protected hasCalledScaleOnRequestCount: boolean = false;

/**
* Send a message to either an SQS queue or SNS topic when instances launch or terminate
Expand Down Expand Up @@ -1089,7 +1089,7 @@ abstract class AutoScalingGroupBase extends Resource implements IAutoScalingGrou
});

policy.node.addDependency(this.albTargetGroup.loadBalancerAttached);
this.hasSetScaleOnRequest = true;
this.hasCalledScaleOnRequestCount = true;
return policy;
}

Expand Down Expand Up @@ -1769,8 +1769,8 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements

private validateTargetGroup(): string[] {
const errors = new Array<string>();
if (this.hasSetScaleOnRequest && this.targetGroupArns.length > 1) {
errors.push('Cannon use multiple target groups if `setScaleOnRequest()` is being used.');
if (this.hasCalledScaleOnRequestCount && this.targetGroupArns.length > 1) {
errors.push('Cannon use multiple target groups if `scaleOnRequestCount()` is being used.');
}

return errors;
Expand Down
Expand Up @@ -1866,7 +1866,7 @@ describe('auto scaling group', () => {

});

test('Should validate multiple target groups i conjunction with `setScaleOnRequest()`', () => {
test('Should validate multiple target groups i conjunction with `scaleOnRequestCount()`', () => {
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } });
const vpc = mockVpc(stack);
const alb = new ApplicationLoadBalancer(stack, 'alb', {
Expand Down Expand Up @@ -1896,7 +1896,7 @@ describe('auto scaling group', () => {

asg.scaleOnRequestCount('requests-per-minute', { targetRequestsPerMinute: 60 });

expect(asg.node.validate()).toContainEqual('Cannon use multiple target groups if `setScaleOnRequest()` is being used.');
expect(asg.node.validate()).toContainEqual('Cannon use multiple target groups if `scaleOnRequestCount()` is being used.');
});
});

Expand Down

0 comments on commit 1ae1d8c

Please sign in to comment.