Skip to content

Commit

Permalink
fix: incorporate review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mazyu36 committed Jun 15, 2024
1 parent 4bcf5b9 commit 398b91d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/aws-cdk-lib/aws-elasticloadbalancingv2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ const tg = new elbv2.ApplicationTargetGroup(this, 'TargetGroup', {
loadBalancingAlgorithmType: elbv2.TargetGroupLoadBalancingAlgorithmType.WEIGHTED_RANDOM,
enableAnomalyMitigation: true,
});
```

## Using Lambda Targets

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,11 @@ export class ApplicationTargetGroup extends TargetGroupBase implements IApplicat
this.addTarget(...(props.targets || []));

if (props.enableAnomalyMitigation !== undefined) {
if (props.enableAnomalyMitigation && isWeightedRandomAlgorithm) {
if (props.enableAnomalyMitigation && !isWeightedRandomAlgorithm) {
throw new Error('Anomaly mitigation is only available when `loadBalancingAlgorithmType` is `TargetGroupLoadBalancingAlgorithmType.WEIGHTED_RANDOM`.');
}
this.setAttribute('load_balancing.algorithm.anomaly_mitigation', props.enableAnomalyMitigation ? 'on' : 'off');
}
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ describe('tests', () => {
});
});

test('Can add targets with weight_random algorithm and anomaly mitigation disabled, () => {
test('Can add targets with weight_random algorithm and anomaly mitigation disabled', () => {
// GIVEN
const app = new cdk.App();
const stack = new cdk.Stack(app, 'Stack');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ describe('tests', () => {
});
});

test('weight_random algorithm and anomaly mitigation is disabled, () => {
test('weight_random algorithm and anomaly mitigation is disabled', () => {
// GIVEN
const app = new cdk.App();
const stack = new cdk.Stack(app, 'Stack');
Expand Down

0 comments on commit 398b91d

Please sign in to comment.