Skip to content

Commit

Permalink
chore(ecs): add additional missing unit tests (#3679)
Browse files Browse the repository at this point in the history
* Add additional missing unit tests

* Update on aug 19 feedbacks

* Indentations and minor change
  • Loading branch information
iamhopaul123 authored and mergify[bot] committed Aug 19, 2019
1 parent f21d950 commit 98f131a
Show file tree
Hide file tree
Showing 9 changed files with 1,630 additions and 69 deletions.
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-ecs/lib/container-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ export class ContainerDefinition extends cdk.Construct {
*/
constructor(scope: cdk.Construct, id: string, private readonly props: ContainerDefinitionProps) {
super(scope, id);
if (props.memoryLimitMiB !== undefined && props.memoryReservationMiB !== undefined) {
if (props.memoryLimitMiB < props.memoryReservationMiB) {
throw new Error(`MemoryLimitMiB should not be less than MemoryReservationMiB.`);
}
}
this.essential = props.essential !== undefined ? props.essential : true;
this.taskDefinition = props.taskDefinition;
this.memoryLimitSpecified = props.memoryLimitMiB !== undefined || props.memoryReservationMiB !== undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ecs/lib/ec2/ec2-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class Ec2Service extends BaseService implements IEc2Service, elb.ILoadBal
throw new Error("Cannot use a Classic Load Balancer if NetworkMode is Bridge. Use Host or AwsVpc instead.");
}
if (this.taskDefinition.networkMode === NetworkMode.NONE) {
throw new Error("Cannot use a load balancer if NetworkMode is None. Use Host or AwsVpc instead.");
throw new Error("Cannot use a Classic Load Balancer if NetworkMode is None. Use Host or AwsVpc instead.");
}

this.loadBalancers.push({
Expand Down
Loading

0 comments on commit 98f131a

Please sign in to comment.