Skip to content

Commit

Permalink
Merge branch 'main' into kinesisfirehose-extra-role
Browse files Browse the repository at this point in the history
  • Loading branch information
msambol authored Aug 30, 2023
2 parents b356335 + 0bab4f7 commit 0794c8f
Show file tree
Hide file tree
Showing 843 changed files with 140,893 additions and 12,693 deletions.
20 changes: 11 additions & 9 deletions INTEGRATION_TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
This document describes the purpose of integration tests as well as acting as a guide
on what type of changes require integrations tests and how you should write integration tests.

- [What are CDK Integration Tests](#what-are-cdk-integration-tests)
- [When are integration tests required](#when-are-integration-tests-required)
- [How to write Integration Tests](#how-to-write-integration-tests)
- [Creating a test](#creating-a-test)
- [New L2 Constructs](#new-l2-constructs)
- [Existing L2 Constructs](#existing-l2-constructs)
- [Assertions](#assertions)
- [Running Integration Tests](#running-integration-tests)
- [Integration Tests](#integration-tests)
- [What are CDK Integration Tests](#what-are-cdk-integration-tests)
- [When are Integration Tests Required](#when-are-integration-tests-required)
- [How to write Integration Tests](#how-to-write-integration-tests)
- [Creating a Test](#creating-a-test)
- [New L2 Constructs](#new-l2-constructs)
- [Existing L2 Constructs](#existing-l2-constructs)
- [Assertions](#assertions)
- [Running Integration Tests](#running-integration-tests)
- [Running large numbers of Tests](#running-large-numbers-of-tests)

## What are CDK Integration Tests

Expand Down Expand Up @@ -94,7 +96,7 @@ const stack = new cdk.Stack(app, 'aws-cdk-lambda-1');
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_LATEST,
});

new integ.IntegTest(app, 'LambdaTest', {
Expand Down
2 changes: 1 addition & 1 deletion design/code-asset-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const resource = new serverless.CfnFunction(this, 'Func', {
bucket: asset.s3BucketName,
key: asset.s3ObjectKey
},
runtime: 'nodejs8.10',
runtime: 'nodejs18.x',
handler: 'index.handler'
});

Expand Down
18 changes: 9 additions & 9 deletions design/construct-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ This is a Lambda function that has it’s handler code written as an asset:

```typescript
new lambda.Function(this, 'HelloWorldHandler', {
runtime: lambda.Runtime.NODE_JS_8_10,
runtime: lambda.Runtime.NODEJS_LATEST,
code: lambda.Code.directory('lambda'),
handler: 'hello.handler'
});
Expand Down Expand Up @@ -119,19 +119,19 @@ The construct tree will be a list of paths that are indexed into a map of constr

### Construct properties

|Property |Type |Required |Source | Description |
|--- |--- |--- |--- | --- |
|path |string |Required |`construct.node.path` | Full, absolute path of the construct within the tree |
|children |Array |Not Required |`construct.node.children` | All direct children of this construct. Array of the absolute paths of the constructs. Will be used to walk entire list of constructs |
|attributes |Array |Not Required |`construct.node.attributes` | Attributes describing all constructs/resources/properties that are encapsulated by the construct |
| Property | Type | Required | Source | Description |
| ---------- | ------ | ------------ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| path | string | Required | `construct.node.path` | Full, absolute path of the construct within the tree |
| children | Array | Not Required | `construct.node.children` | All direct children of this construct. Array of the absolute paths of the constructs. Will be used to walk entire list of constructs |
| attributes | Array | Not Required | `construct.node.attributes` | Attributes describing all constructs/resources/properties that are encapsulated by the construct |

### Metadata Properties

The following metadata properties will be included by the construct that produces the `tree.json` output.

|Property |Type |Required | Description |
|--- |--- |--- | --- |
|attributes |Array |Not Required | constructs can fill in arbitrary metadata such as configuration, type, properties, etc |
| Property | Type | Required | Description |
| ---------- | ----- | ------------ | -------------------------------------------------------------------------------------- |
| attributes | Array | Not Required | constructs can fill in arbitrary metadata such as configuration, type, properties, etc |

Attributes are an extensible list and their keys should be namespaced by convention to avoid conflicts.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,19 +222,19 @@ class LambdaStack extends cdk.Stack {
// see the 'upgrade legacy bootstrap stack' test
const synthesizer = parent.node.tryGetContext('legacySynth') === 'true' ?
new LegacyStackSynthesizer({
fileAssetsBucketName: parent.node.tryGetContext('bootstrapBucket'),
fileAssetsBucketName: parent.node.tryGetContext('bootstrapBucket'),
})
: new DefaultStackSynthesizer({
fileAssetsBucketName: parent.node.tryGetContext('bootstrapBucket'),
})
: new DefaultStackSynthesizer({
fileAssetsBucketName: parent.node.tryGetContext('bootstrapBucket'),
})
super(parent, id, {
...props,
synthesizer: synthesizer,
});

const fn = new lambda.Function(this, 'my-function', {
code: lambda.Code.asset(path.join(__dirname, 'lambda')),
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler'
});

Expand All @@ -248,7 +248,7 @@ class LambdaHotswapStack extends cdk.Stack {

const fn = new lambda.Function(this, 'my-function', {
code: lambda.Code.asset(path.join(__dirname, 'lambda')),
runtime: lambda.Runtime.NODEJS_14_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
description: process.env.DYNAMIC_LAMBDA_PROPERTY_VALUE ?? "description",
environment: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM public.ecr.aws/lambda/nodejs:14
FROM public.ecr.aws/lambda/nodejs:18

# Assumes your function is named "app.js", and there is a package.json file in the app directory
COPY app.js package.json ./
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class OutputsStack extends cdk.Stack {
constructor(parent, id, props) {
super(parent, id, props);

const topic = new sns.Topic(this, 'MyOutput', {
const topic = new sns.Topic(this, 'MyOutput', {
topicName: `${cdk.Stack.of(this).stackName}MyTopic`
});

Expand Down Expand Up @@ -195,7 +195,7 @@ class LambdaStack extends cdk.Stack {

const fn = new lambda.Function(this, 'my-function', {
code: lambda.Code.asset(path.join(__dirname, 'lambda')),
runtime: lambda.Runtime.NODEJS_12_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler'
});

Expand Down Expand Up @@ -339,7 +339,7 @@ switch (stackSet) {
if (process.env.ENABLE_VPC_TESTING === 'DEFINE')
new DefineVpcStack(app, `${stackPrefix}-define-vpc`, { env });
if (process.env.ENABLE_VPC_TESTING === 'IMPORT')
new ImportVpcStack(app, `${stackPrefix}-import-vpc`, { env });
new ImportVpcStack(app, `${stackPrefix}-import-vpc`, { env });
}

new ConditionalResourceStack(app, `${stackPrefix}-conditional-resource`)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"version": "29.0.0",
"version": "34.0.0",
"files": {
"3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0": {
"32958f9442f31389bed730b768bd21f066c7343a5d0e87b9cad92b365e9d3c37": {
"source": {
"path": "asset.3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0.handler",
"path": "asset.32958f9442f31389bed730b768bd21f066c7343a5d0e87b9cad92b365e9d3c37.handler",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0.zip",
"objectKey": "32958f9442f31389bed730b768bd21f066c7343a5d0e87b9cad92b365e9d3c37.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"a605b6be7a978439cf7b93d6214f4ce6d30a9163415575fa17ba0a5857238906": {
"2e7d8bf0e8057cc8d78fd4928137f285242b175a548bbcf501299a118037c8d1": {
"source": {
"path": "RequestAuthorizerInteg.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "a605b6be7a978439cf7b93d6214f4ce6d30a9163415575fa17ba0a5857238906.json",
"objectKey": "2e7d8bf0e8057cc8d78fd4928137f285242b175a548bbcf501299a118037c8d1.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0.zip"
"S3Key": "32958f9442f31389bed730b768bd21f066c7343a5d0e87b9cad92b365e9d3c37.zip"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"MyAuthorizerFunctionServiceRole8A34C19E",
"Arn"
]
},
"Handler": "index.handler",
"Runtime": "nodejs14.x"
"Runtime": "nodejs16.x"
},
"DependsOn": [
"MyAuthorizerFunctionServiceRole8A34C19E"
Expand Down Expand Up @@ -191,10 +191,10 @@
"MyRestApiDeploymentB555B582d83364d66d67f510f848797cd89349d5": {
"Type": "AWS::ApiGateway::Deployment",
"Properties": {
"Description": "Automatically created by the RestApi construct",
"RestApiId": {
"Ref": "MyRestApi2D1F47A9"
},
"Description": "Automatically created by the RestApi construct"
}
},
"DependsOn": [
"MyAuthorizer6575980E",
Expand All @@ -207,12 +207,12 @@
"MyRestApiDeploymentStageprodC33B8E5F": {
"Type": "AWS::ApiGateway::Stage",
"Properties": {
"RestApiId": {
"Ref": "MyRestApi2D1F47A9"
},
"DeploymentId": {
"Ref": "MyRestApiDeploymentB555B582d83364d66d67f510f848797cd89349d5"
},
"RestApiId": {
"Ref": "MyRestApi2D1F47A9"
},
"StageName": "prod"
},
"DependsOn": [
Expand All @@ -222,20 +222,11 @@
"MyRestApiANY05143F93": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"HttpMethod": "ANY",
"ResourceId": {
"Fn::GetAtt": [
"MyRestApi2D1F47A9",
"RootResourceId"
]
},
"RestApiId": {
"Ref": "MyRestApi2D1F47A9"
},
"AuthorizationType": "CUSTOM",
"AuthorizerId": {
"Ref": "MyAuthorizer6575980E"
},
"HttpMethod": "ANY",
"Integration": {
"IntegrationResponses": [
{
Expand All @@ -252,7 +243,16 @@
{
"StatusCode": "200"
}
]
],
"ResourceId": {
"Fn::GetAtt": [
"MyRestApi2D1F47A9",
"RootResourceId"
]
},
"RestApiId": {
"Ref": "MyRestApi2D1F47A9"
}
}
},
"MyRestApiauth918A22B9": {
Expand All @@ -273,17 +273,11 @@
"MyRestApiauthANY12A3CAB7": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"HttpMethod": "ANY",
"ResourceId": {
"Ref": "MyRestApiauth918A22B9"
},
"RestApiId": {
"Ref": "MyRestApi2D1F47A9"
},
"AuthorizationType": "CUSTOM",
"AuthorizerId": {
"Ref": "MySecondAuthorizer25A69B96"
},
"HttpMethod": "ANY",
"Integration": {
"IntegrationResponses": [
{
Expand All @@ -300,17 +294,18 @@
{
"StatusCode": "200"
}
]
],
"ResourceId": {
"Ref": "MyRestApiauth918A22B9"
},
"RestApiId": {
"Ref": "MyRestApi2D1F47A9"
}
}
},
"MyAuthorizer6575980E": {
"Type": "AWS::ApiGateway::Authorizer",
"Properties": {
"Name": "RequestAuthorizerIntegMyAuthorizer5D9D41C5",
"RestApiId": {
"Ref": "MyRestApi2D1F47A9"
},
"Type": "REQUEST",
"AuthorizerUri": {
"Fn::Join": [
"",
Expand Down Expand Up @@ -360,17 +355,17 @@
]
]
},
"IdentitySource": "method.request.header.Authorization,method.request.querystring.allow"
"IdentitySource": "method.request.header.Authorization,method.request.querystring.allow",
"Name": "RequestAuthorizerIntegMyAuthorizer5D9D41C5",
"RestApiId": {
"Ref": "MyRestApi2D1F47A9"
},
"Type": "REQUEST"
}
},
"MySecondAuthorizer25A69B96": {
"Type": "AWS::ApiGateway::Authorizer",
"Properties": {
"Name": "RequestAuthorizerIntegMySecondAuthorizerCCC4ECED",
"RestApiId": {
"Ref": "MyRestApi2D1F47A9"
},
"Type": "REQUEST",
"AuthorizerUri": {
"Fn::Join": [
"",
Expand Down Expand Up @@ -420,7 +415,12 @@
]
]
},
"IdentitySource": "method.request.header.Authorization,method.request.querystring.allow"
"IdentitySource": "method.request.header.Authorization,method.request.querystring.allow",
"Name": "RequestAuthorizerIntegMySecondAuthorizerCCC4ECED",
"RestApiId": {
"Ref": "MyRestApi2D1F47A9"
},
"Type": "REQUEST"
}
}
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"29.0.0"}
{"version":"34.0.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "29.0.0",
"version": "34.0.0",
"testCases": {
"integ.request-authorizer.lit": {
"stacks": [
Expand Down
Loading

0 comments on commit 0794c8f

Please sign in to comment.