Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-ecs/lib/ec2/ec2-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ export class Ec2Service extends BaseService implements IEc2Service {
throw new Error('Maximum percent must be 100 for daemon mode.');
}

if (props.daemon && props.minHealthyPercent !== undefined && props.minHealthyPercent !== 0) {
throw new Error('Minimum healthy percent must be 0 for daemon mode.');
if (props.minHealthyPercent !== undefined && props.maxHealthyPercent !== undefined && props.minHealthyPercent >= props.maxHealthyPercent) {
throw new Error('Minimum healthy percent must be less than maximum healthy percent.');
}

if (!props.taskDefinition.isEc2Compatible) {
Expand Down
7 changes: 4 additions & 3 deletions packages/@aws-cdk/aws-ecs/test/ec2/test.ec2-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export = {
test.done();
},

'errors if daemon and minimum not 0'(test: Test) {
'errors if minimum not less than maximum'(test: Test) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "greater than"?

// GIVEN
const stack = new cdk.Stack();
const vpc = new ec2.Vpc(stack, 'MyVpc', {});
Expand All @@ -369,9 +369,10 @@ export = {
cluster,
taskDefinition,
daemon: true,
minHealthyPercent: 50,
minHealthyPercent: 100,
maxHealthyPercent: 100,
});
}, /Minimum healthy percent must be 0 for daemon mode./);
}, /Minimum healthy percent must be less than maximum healthy percent./);

test.done();
},
Expand Down