Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(elasticloadbalancingv2): fix to be able to set deregistrationDelay #3075

Merged
merged 6 commits into from
Jun 30, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export abstract class TargetGroupBase extends cdk.Construct implements ITargetGr
super(scope, id);

if (baseProps.deregistrationDelay !== undefined) {
this.setAttribute('deregistration_delay.timeout_seconds', baseProps.deregistrationDelay.toString());
this.setAttribute('deregistration_delay.timeout_seconds', baseProps.deregistrationDelay.toSeconds().toString());
}

this.healthCheck = baseProps.healthCheck || {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, haveResource, MatchStyle } from '@aws-cdk/assert';
import ec2 = require('@aws-cdk/aws-ec2');
import cdk = require('@aws-cdk/core');
import { ConstructNode } from '@aws-cdk/core';
import { ConstructNode, Duration } from '@aws-cdk/core';
import { Test } from 'nodeunit';
import elbv2 = require('../../lib');
import { FakeSelfRegisteringTarget } from '../helpers';
Expand Down Expand Up @@ -534,6 +534,31 @@ export = {
test.done();
},

'Can configure deregistration_delay for targets'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
const vpc = new ec2.Vpc(stack, 'Stack');

// WHEN
new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', {
vpc,
port: 80,
deregistrationDelay: Duration.seconds(30)
});

// THEN
expect(stack).to(haveResource('AWS::ElasticLoadBalancingV2::TargetGroup', {
TargetGroupAttributes: [
{
Key: "deregistration_delay.timeout_seconds",
Value: "30"
}
]
}));

test.done();
},

'Throws with bad fixed responses': {

'status code'(test: Test) {
Expand Down