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

chore(ecs): add additional missing unit tests #3679

Merged
merged 4 commits into from
Aug 19, 2019
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
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