Skip to content

Commit

Permalink
chore: add test for combined use of props and addPortMappings
Browse files Browse the repository at this point in the history
  • Loading branch information
misterjoshua committed Feb 26, 2021
1 parent 9247299 commit 4f05bb3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/@aws-cdk/aws-ecs/test/container-definition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,33 @@ describe('container definition', () => {
});
});

test('can add port mappings using props and addPortMappings and both are included', () => {
// GIVEN
const stack = new cdk.Stack();
const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef');

// WHEN
const containerDefinition = taskDefinition.addContainer('cont', {
image: ecs.ContainerImage.fromRegistry('test'),
memoryLimitMiB: 1024,
portMappings: [{ containerPort: 80 }],
});

containerDefinition.addPortMappings({ containerPort: 443 });

// THEN
expect(stack).toHaveResourceLike('AWS::ECS::TaskDefinition', {
ContainerDefinitions: [
{
PortMappings: [
{ ContainerPort: 80 },
{ ContainerPort: 443 },
],
},
],
});
});

describe('Environment Files', () => {
describe('with EC2 task definitions', () => {
test('can add asset environment file to the container definition', () => {
Expand Down

0 comments on commit 4f05bb3

Please sign in to comment.