Skip to content

Commit

Permalink
chore: test changes - implicit app for root stacks
Browse files Browse the repository at this point in the history
Add an implicit "App" construct for root stacks
  • Loading branch information
Elad Ben-Israel committed Jul 14, 2020
1 parent 3d4fcb5 commit 69e221a
Show file tree
Hide file tree
Showing 38 changed files with 140 additions and 134 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/test/test.vpc-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export = {

// THEN
expect(stack).to(haveResourceLike('AWS::ApiGateway::VpcLink', {
Name: 'VpcLink',
Name: 'StackVpcLink0E48D8A7',
TargetArns: [
{ Ref: 'NLB03D178991' },
{ Ref: 'NLB13224D47C' },
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appmesh/test/test.virtual-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export = {
},
},
},
VirtualNodeName: 'meshtestnode428A9479',
VirtualNodeName: 'StackmeshtestnodeF42773EB',
}),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ nodeunitShim({
'MyFleetInstanceSecurityGroup774E8234': {
'Type': 'AWS::EC2::SecurityGroup',
'Properties': {
'GroupDescription': 'MyFleet/InstanceSecurityGroup',
'GroupDescription': 'TestStack/MyFleet/InstanceSecurityGroup',
'SecurityGroupEgress': [
{
'CidrIp': '0.0.0.0/0',
Expand All @@ -43,7 +43,7 @@ nodeunitShim({
'Tags': [
{
'Key': 'Name',
'Value': 'MyFleet',
'Value': 'TestStack/MyFleet',
},
],

Expand All @@ -68,7 +68,7 @@ nodeunitShim({
'Tags': [
{
'Key': 'Name',
'Value': 'MyFleet',
'Value': 'TestStack/MyFleet',
},
],
},
Expand Down Expand Up @@ -122,7 +122,7 @@ nodeunitShim({
{
'Key': 'Name',
'PropagateAtLaunch': true,
'Value': 'MyFleet',
'Value': 'TestStack/MyFleet',
},
],

Expand Down Expand Up @@ -521,7 +521,7 @@ nodeunitShim({
{
Key: 'Name',
PropagateAtLaunch: true,
Value: 'MyFleet',
Value: 'TestStack/MyFleet',
},
{
Key: 'notsuper',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ nodeunitShim({
{
Key: 'Name',
PropagateAtLaunch: true,
Value: 'ASG',
Value: 'Stack/ASG',
},
],
VPCZoneIdentifier: [
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-backup/test/vault.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test('create a vault', () => {

// THEN
expect(stack).toHaveResource('AWS::Backup::BackupVault', {
BackupVaultName: 'Vault',
BackupVaultName: 'StackVault02F737C4',
});
});

Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-batch/test/compute-environment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ describe('Batch Compute Evironment', () => {
],
Subnets: [
{
Ref: `${vpc.node.uniqueId}PrivateSubnet1Subnet865FB50A`,
Ref: 'testvpcPrivateSubnet1Subnet865FB50A',
},
{
Ref: `${vpc.node.uniqueId}PrivateSubnet2Subnet23D3396F`,
Ref: 'testvpcPrivateSubnet2Subnet23D3396F',
},
],
Tags: {
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-cloudformation/test/test.deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ export = {
const nested2 = new NestedStack(nested1, 'Nested2');

// THEN
test.throws(() => nested1.addDependency(root), /Nested stack 'Nested1' cannot depend on a parent stack ''/);
test.throws(() => nested2.addDependency(nested1), /Nested stack 'Nested1\/Nested2' cannot depend on a parent stack 'Nested1'/);
test.throws(() => nested2.addDependency(root), /Nested stack 'Nested1\/Nested2' cannot depend on a parent stack ''/);
test.throws(() => nested1.addDependency(root), /Nested stack 'Stack\/Nested1' cannot depend on a parent stack 'Stack'/);
test.throws(() => nested2.addDependency(nested1), /Nested stack 'Stack\/Nested1\/Nested2' cannot depend on a parent stack 'Stack\/Nested1'/);
test.throws(() => nested2.addDependency(root), /Nested stack 'Stack\/Nested1\/Nested2' cannot depend on a parent stack 'Stack'/);
test.done();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ export = {
},
},
Outputs: {
nestedresourceinnested59B1F01CConsumedAttribute: {
StacknestedresourceinnestedE8C78B2EConsumedAttribute: {
Value: {
'Fn::GetAtt': [
'resourceinnested',
Expand All @@ -900,7 +900,7 @@ export = {
ConsumedAttribute: {
'Fn::GetAtt': [
'nestedNestedStacknestedNestedStackResource3DD143BF',
'Outputs.nestedresourceinnested59B1F01CConsumedAttribute',
'Outputs.StacknestedresourceinnestedE8C78B2EConsumedAttribute',
],
},
}));
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codecommit/test/test.codecommit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export = {
'all',
],
DestinationArn: 'arn:aws:sns:*:123456789012:my_topic',
Name: 'MyRepository/arn:aws:sns:*:123456789012:my_topic',
Name: 'Stack/MyRepository/arn:aws:sns:*:123456789012:my_topic',
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,14 @@ describe('profiling group', () => {

test('default profiling group without name', () => {
const stack = new Stack();
new ProfilingGroup(stack, 'MyProfilingGroup', {
});
new ProfilingGroup(stack, 'MyProfilingGroup');

expect(stack).toMatch({
'Resources': {
'MyProfilingGroup829F0507': {
'Type': 'AWS::CodeGuruProfiler::ProfilingGroup',
'Properties': {
'ProfilingGroupName': 'MyProfilingGroup',
'ProfilingGroupName': 'StackMyProfilingGroup664763A5',
},
},
},
Expand All @@ -215,7 +214,7 @@ describe('profiling group', () => {
'MyProfilingGroupWithAReallyLongProfilingGroupNameThatExceedsTheLimitOfProfilingGroupNameSizeInOrderToDoSoTheNameMustBeGreaterThanTwoHundredAndFiftyFiveCharactersInSuchCasesWePickUpTheFirstOneTwentyCharactersFromTheBeginningAndTheEndAndConca4B39908C': {
'Type': 'AWS::CodeGuruProfiler::ProfilingGroup',
'Properties': {
'ProfilingGroupName': 'MyProfilingGroupWithAReallyLongProfilingGroupNameThatExceedsTheLimitOfProfilingGroupNameSizeInOrderToDoSoTheNameMustBeGrnTwoHundredAndFiftyFiveCharactersInSuchCasesWePickUpTheFirstOneTwentyCharactersFromTheBeginningAndTheEndAndConca2FE009B0',
'ProfilingGroupName': 'StackMyProfilingGroupWithAReallyLongProfilingGroupNameThatExceedsTheLimitOfProfilingGroupNameSizeInOrderToDoSoTheNameMuserThanTwoHundredAndFiftyFiveCharactersInSuchCasesWePickUpTheFirstOneTwentyCharactersFromTheBeginningAndTheEndAndB7D9636D',
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-cognito/test/user-pool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('User Pool', () => {
SnsCallerArn: {
'Fn::GetAtt': [ 'PoolsmsRoleC3352CE6', 'Arn' ],
},
ExternalId: 'Pool',
ExternalId: 'StackPool7DFA52F5',
},
lambdaTriggers: ABSENT,
});
Expand All @@ -45,7 +45,7 @@ describe('User Pool', () => {
Action: 'sts:AssumeRole',
Condition: {
StringEquals: {
'sts:ExternalId': 'Pool',
'sts:ExternalId': 'StackPool7DFA52F5',
},
},
Effect: 'Allow',
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-docdb/test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ describe('DatabaseCluster', () => {
],
],
},
functionName: 'DatabaseRotationSingleUser458A45BE',
functionName: 'StackDatabaseRotationSingleUserF00A3AD1',
vpcSubnetIds: {
'Fn::Join': [
'',
Expand Down Expand Up @@ -710,7 +710,7 @@ describe('DatabaseCluster', () => {
],
],
},
functionName: 'DatabaseRotation0D47EBD2',
functionName: 'StackDatabaseRotation6713F62B',
vpcSubnetIds: {
'Fn::Join': [
'',
Expand Down
10 changes: 5 additions & 5 deletions packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ test('if an encryption key is included, encrypt/decrypt permissions are also add
],
'Version': '2012-10-17',
},
'Description': 'Customer-managed key auto-created for encrypting DynamoDB table at Table A',
'Description': 'Customer-managed key auto-created for encrypting DynamoDB table at Stack/Table A',
'EnableKeyRotation': true,
},
'UpdateReplacePolicy': 'Retain',
Expand Down Expand Up @@ -1758,7 +1758,7 @@ describe('grants', () => {
const user = new iam.User(stack, 'user');

// WHEN
expect(() => table.grantTableListStreams(user)).toThrow(/DynamoDB Streams must be enabled on the table my-table/);
expect(() => table.grantTableListStreams(user)).toThrow(/DynamoDB Streams must be enabled on the table Stack\/my-table/);
});

test('"grantTableListStreams" allows principal to list all streams for this table', () => {
Expand Down Expand Up @@ -1804,7 +1804,7 @@ describe('grants', () => {
const user = new iam.User(stack, 'user');

// WHEN
expect(() => table.grantStreamRead(user)).toThrow(/DynamoDB Streams must be enabled on the table my-table/);
expect(() => table.grantStreamRead(user)).toThrow(/DynamoDB Streams must be enabled on the table Stack\/my-table/);
});

test('"grantStreamRead" allows principal to read and describe the table stream"', () => {
Expand Down Expand Up @@ -2268,7 +2268,7 @@ describe('global', () => {
ServiceToken: {
'Fn::GetAtt': [
'awscdkawsdynamodbReplicaProviderNestedStackawscdkawsdynamodbReplicaProviderNestedStackResource18E3F12D',
'Outputs.awscdkawsdynamodbReplicaProviderframeworkonEventF9504691Arn',
'Outputs.StackawscdkawsdynamodbReplicaProviderframeworkonEvent27E7BDE8Arn',
],
},
TableName: {
Expand All @@ -2284,7 +2284,7 @@ describe('global', () => {
ServiceToken: {
'Fn::GetAtt': [
'awscdkawsdynamodbReplicaProviderNestedStackawscdkawsdynamodbReplicaProviderNestedStackResource18E3F12D',
'Outputs.awscdkawsdynamodbReplicaProviderframeworkonEventF9504691Arn',
'Outputs.StackawscdkawsdynamodbReplicaProviderframeworkonEvent27E7BDE8Arn',
],
},
TableName: {
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-ec2/test/connections.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ nodeunitShim({

// THEN
expect(stack).to(haveResource('AWS::EC2::SecurityGroup', {
GroupDescription: 'SecurityGroup1',
GroupDescription: 'Stack/SecurityGroup1',
SecurityGroupIngress: [
{
Description: 'from 0.0.0.0/0:88',
Expand All @@ -91,7 +91,7 @@ nodeunitShim({
}));

expect(stack).to(haveResource('AWS::EC2::SecurityGroup', {
GroupDescription: 'SecurityGroup2',
GroupDescription: 'Stack/SecurityGroup2',
SecurityGroupIngress: [
{
Description: 'from 0.0.0.0/0:88',
Expand Down
32 changes: 16 additions & 16 deletions packages/@aws-cdk/aws-ec2/test/volume.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ nodeunitShim({
],
Condition: {
'ForAnyValue:StringEquals': {
'ec2:ResourceTag/VolumeGrantAttach-BD7A9717': 'd9a17c1c9e8ef6866e4dbeef41c741b2',
'ec2:ResourceTag/VolumeGrantAttach-986A0A5E': '8240681c85c17071be6d87ec6e2930c7',
},
},
}],
Expand All @@ -748,17 +748,17 @@ nodeunitShim({
cdkExpect(stack).to(haveResourceLike('AWS::EC2::Volume', {
Tags: [
{
Key: 'VolumeGrantAttach-BD7A9717',
Value: 'd9a17c1c9e8ef6866e4dbeef41c741b2',
Key: 'VolumeGrantAttach-986A0A5E',
Value: '8240681c85c17071be6d87ec6e2930c7',
},
],
}, ResourcePart.Properties));
cdkExpect(stack).to(haveResourceLike('AWS::EC2::Instance', {
Tags: [
{},
{
Key: 'VolumeGrantAttach-BD7A9717',
Value: 'd9a17c1c9e8ef6866e4dbeef41c741b2',
Key: 'VolumeGrantAttach-986A0A5E',
Value: '8240681c85c17071be6d87ec6e2930c7',
},
],
}, ResourcePart.Properties));
Expand Down Expand Up @@ -816,7 +816,7 @@ nodeunitShim({
],
Condition: {
'ForAnyValue:StringEquals': {
'ec2:ResourceTag/VolumeGrantAttach-TestSuffix': 'd9a17c1c9e8ef6866e4dbeef41c741b2',
'ec2:ResourceTag/VolumeGrantAttach-TestSuffix': '8240681c85c17071be6d87ec6e2930c7',
},
},
}],
Expand All @@ -826,7 +826,7 @@ nodeunitShim({
Tags: [
{
Key: 'VolumeGrantAttach-TestSuffix',
Value: 'd9a17c1c9e8ef6866e4dbeef41c741b2',
Value: '8240681c85c17071be6d87ec6e2930c7',
},
],
}, ResourcePart.Properties));
Expand All @@ -835,7 +835,7 @@ nodeunitShim({
{},
{
Key: 'VolumeGrantAttach-TestSuffix',
Value: 'd9a17c1c9e8ef6866e4dbeef41c741b2',
Value: '8240681c85c17071be6d87ec6e2930c7',
},
],
}, ResourcePart.Properties));
Expand Down Expand Up @@ -1051,7 +1051,7 @@ nodeunitShim({
],
Condition: {
'ForAnyValue:StringEquals': {
'ec2:ResourceTag/VolumeGrantDetach-BD7A9717': 'd9a17c1c9e8ef6866e4dbeef41c741b2',
'ec2:ResourceTag/VolumeGrantDetach-986A0A5E': '8240681c85c17071be6d87ec6e2930c7',
},
},
}],
Expand All @@ -1060,17 +1060,17 @@ nodeunitShim({
cdkExpect(stack).to(haveResourceLike('AWS::EC2::Volume', {
Tags: [
{
Key: 'VolumeGrantDetach-BD7A9717',
Value: 'd9a17c1c9e8ef6866e4dbeef41c741b2',
Key: 'VolumeGrantDetach-986A0A5E',
Value: '8240681c85c17071be6d87ec6e2930c7',
},
],
}, ResourcePart.Properties));
cdkExpect(stack).to(haveResourceLike('AWS::EC2::Instance', {
Tags: [
{},
{
Key: 'VolumeGrantDetach-BD7A9717',
Value: 'd9a17c1c9e8ef6866e4dbeef41c741b2',
Key: 'VolumeGrantDetach-986A0A5E',
Value: '8240681c85c17071be6d87ec6e2930c7',
},
],
}, ResourcePart.Properties));
Expand Down Expand Up @@ -1128,7 +1128,7 @@ nodeunitShim({
],
Condition: {
'ForAnyValue:StringEquals': {
'ec2:ResourceTag/VolumeGrantDetach-TestSuffix': 'd9a17c1c9e8ef6866e4dbeef41c741b2',
'ec2:ResourceTag/VolumeGrantDetach-TestSuffix': '8240681c85c17071be6d87ec6e2930c7',
},
},
}],
Expand All @@ -1138,7 +1138,7 @@ nodeunitShim({
Tags: [
{
Key: 'VolumeGrantDetach-TestSuffix',
Value: 'd9a17c1c9e8ef6866e4dbeef41c741b2',
Value: '8240681c85c17071be6d87ec6e2930c7',
},
],
}, ResourcePart.Properties));
Expand All @@ -1147,7 +1147,7 @@ nodeunitShim({
{},
{
Key: 'VolumeGrantDetach-TestSuffix',
Value: 'd9a17c1c9e8ef6866e4dbeef41c741b2',
Value: '8240681c85c17071be6d87ec6e2930c7',
},
],
}, ResourcePart.Properties));
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ nodeunitShim({
}));

expect(stack).to(haveResource('AWS::EC2::SecurityGroup', {
GroupDescription: 'VpcNetwork/EcrDocker/SecurityGroup',
GroupDescription: 'Stack/VpcNetwork/EcrDocker/SecurityGroup',
VpcId: {
Ref: 'VpcNetworkB258E83A',
},
Expand Down
Loading

0 comments on commit 69e221a

Please sign in to comment.