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: replace Node16 runtimes in unit tests with symbolic runtime #27011

Merged
merged 7 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Match, Template } from 'aws-cdk-lib/assertions';
import { HttpApi } from '@aws-cdk/aws-apigatewayv2-alpha';
import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda';
import { lambda.Runtime.NODEJS_LATEST } from 'aws-cdk-lib/aws-lambda/lib/helpers-internal';
import { Duration, Stack } from 'aws-cdk-lib';
import { DummyRouteIntegration } from './integration';
import { HttpLambdaAuthorizer, HttpLambdaResponseType } from '../../lib';
Expand All @@ -13,7 +14,7 @@ describe('HttpLambdaAuthorizer', () => {
const api = new HttpApi(stack, 'HttpApi');

const handler = new Function(stack, 'auth-function', {
runtime: Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
code: Code.fromInline('exports.handler = () => {return true}'),
handler: 'index.handler',
});
Expand Down Expand Up @@ -49,7 +50,7 @@ describe('HttpLambdaAuthorizer', () => {
const api = new HttpApi(stack, 'HttpApi');

const handler = new Function(stack, 'auth-function', {
runtime: Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
code: Code.fromInline('exports.handler = () => {return true}'),
handler: 'index.handler',
});
Expand Down Expand Up @@ -78,7 +79,7 @@ describe('HttpLambdaAuthorizer', () => {
const api = new HttpApi(stack, 'HttpApi');

const handler = new Function(stack, 'auth-function', {
runtime: Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
code: Code.fromInline('exports.handler = () => {return true}'),
handler: 'index.handler',
});
Expand Down Expand Up @@ -107,7 +108,7 @@ describe('HttpLambdaAuthorizer', () => {
const api = new HttpApi(stack, 'HttpApi');

const handler = new Function(stack, 'auth-function', {
runtime: Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
code: Code.fromInline('exports.handler = () => {return true}'),
handler: 'index.handler',
});
Expand Down Expand Up @@ -136,7 +137,7 @@ describe('HttpLambdaAuthorizer', () => {
const api = new HttpApi(stack, 'HttpApi');

const handler = new Function(stack, 'auth-functon', {
runtime: Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
code: Code.fromInline('exports.handler = () => {return true}'),
handler: 'index.handler',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Template } from 'aws-cdk-lib/assertions';
import { WebSocketApi } from '@aws-cdk/aws-apigatewayv2-alpha';
import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha';
import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda';
import { lambda.Runtime.NODEJS_LATEST } from 'aws-cdk-lib/aws-lambda/lib/helpers-internal';
import { Stack } from 'aws-cdk-lib';
import { WebSocketIamAuthorizer } from '../../lib';

Expand All @@ -10,7 +11,7 @@ describe('WebSocketLambdaAuthorizer', () => {
const stack = new Stack();

const handler = new Function(stack, 'auth-function', {
runtime: Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
code: Code.fromInline('exports.handler = () => {return true}'),
handler: 'index.handler',
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Template } from 'aws-cdk-lib/assertions';
import { WebSocketApi } from '@aws-cdk/aws-apigatewayv2-alpha';
import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha';
import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda';
import { Code, Function } from 'aws-cdk-lib/aws-lambda';
import { lambda.Runtime.NODEJS_LATEST } from 'aws-cdk-lib/aws-lambda/lib/helpers-internal';
import { Stack } from 'aws-cdk-lib';
import { WebSocketLambdaAuthorizer } from '../../lib';

Expand All @@ -11,7 +12,7 @@ describe('WebSocketLambdaAuthorizer', () => {
const stack = new Stack();

const handler = new Function(stack, 'auth-function', {
runtime: Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
code: Code.fromInline('exports.handler = () => {return true}'),
handler: 'index.handler',
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Match, Template } from 'aws-cdk-lib/assertions';
import { HttpApi, HttpRoute, HttpRouteKey, MappingValue, ParameterMapping, PayloadFormatVersion } from '@aws-cdk/aws-apigatewayv2-alpha';
import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda';
import { Code, Function } from 'aws-cdk-lib/aws-lambda';
import { lambda.Runtime.NODEJS_LATEST } from 'aws-cdk-lib/aws-lambda/lib/helpers-internal';
import { App, Stack } from 'aws-cdk-lib';
import { HttpLambdaIntegration } from '../../lib';

Expand Down Expand Up @@ -111,7 +112,7 @@ describe('LambdaProxyIntegration', () => {
function fooFunction(stack: Stack, id: string) {
return new Function(stack, id, {
code: Code.fromInline('foo'),
runtime: Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
});
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Template } from 'aws-cdk-lib/assertions';
import { WebSocketApi } from '@aws-cdk/aws-apigatewayv2-alpha';
import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda';
import { Code, Function } from 'aws-cdk-lib/aws-lambda';
import { lambda.Runtime.NODEJS_LATEST } from 'aws-cdk-lib/aws-lambda/lib/helpers-internal';
import { Stack } from 'aws-cdk-lib';
import { WebSocketLambdaIntegration } from '../../lib';

Expand Down Expand Up @@ -50,7 +51,7 @@ describe('LambdaWebSocketIntegration', () => {
function fooFunction(stack: Stack, id: string) {
return new Function(stack, id, {
code: Code.fromInline('foo'),
runtime: Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as iot from '@aws-cdk/aws-iot-alpha';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as cdk from 'aws-cdk-lib';
import * as actions from '../../lib';
import { lambda.Runtime.NODEJS_LATEST } from 'aws-cdk-lib/aws-lambda/lib/helpers-internal';

test('create a topic rule with lambda action and a lambda permission to be invoked by the topic rule', () => {
// GIVEN
Expand All @@ -11,7 +12,7 @@ test('create a topic rule with lambda action and a lambda permission to be invok
sql: iot.IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id FROM 'device/+/data'"),
});
const func = new lambda.Function(stack, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
code: lambda.Code.fromInline('console.log("foo")'),
});
Expand Down Expand Up @@ -60,7 +61,7 @@ test('create two different permissions, when two topic rules have the same actio
// GIVEN
const stack = new cdk.Stack();
const func = new lambda.Function(stack, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
code: lambda.Code.fromInline('console.log("foo")'),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as iam from 'aws-cdk-lib/aws-iam';
import * as firehose from '@aws-cdk/aws-kinesisfirehose-alpha';
import * as kms from 'aws-cdk-lib/aws-kms';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import { lambda.Runtime.NODEJS_LATEST } from 'aws-cdk-lib/aws-lambda/lib/helpers-internal';
import * as logs from 'aws-cdk-lib/aws-logs';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as cdk from 'aws-cdk-lib';
Expand Down Expand Up @@ -240,7 +241,7 @@ describe('S3 destination', () => {

beforeEach(() => {
lambdaFunction = new lambda.Function(stack, 'DataProcessorFunction', {
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
code: lambda.Code.fromInline('foo'),
handler: 'bar',
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as path from 'path';
import { Template } from 'aws-cdk-lib/assertions';
import { Code, Runtime } from 'aws-cdk-lib/aws-lambda';
import { lambda.Runtime.NODEJS_LATEST } from 'aws-cdk-lib/aws-lambda/lib/helpers-internal';
import { AssetHashType, DockerImage, Stack } from 'aws-cdk-lib';
import { PythonFunction } from '../lib';
import { Bundling, BundlingProps } from '../lib/bundling';
Expand Down Expand Up @@ -112,7 +113,7 @@ test('throws when entry does not exist', () => {
test('throws with the wrong runtime family', () => {
expect(() => new PythonFunction(stack, 'handler1', {
entry: path.join(__dirname, 'lambda-handler'),
runtime: Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
})).toThrow(/Only `PYTHON` runtimes are supported/);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Template } from 'aws-cdk-lib/assertions';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import { lambda.Runtime.NODEJS_LATEST } from 'aws-cdk-lib/aws-lambda/lib/helpers-internal';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as cdk from 'aws-cdk-lib';
import { AccessPoint } from '../lib';
Expand All @@ -12,7 +13,7 @@ beforeEach(() => {
stack = new cdk.Stack();
bucket = new s3.Bucket(stack, 'MyBucket');
handler = new lambda.Function(stack, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.hello',
code: new lambda.InlineCode('def hello(): pass'),
});
Expand Down
20 changes: 10 additions & 10 deletions packages/aws-cdk-lib/aws-apigateway/test/authorizers/lambda.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('lambda authorizer', () => {
const func = new lambda.Function(stack, 'myfunction', {
handler: 'handler',
code: lambda.Code.fromInline('foo'),
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
});

const auth = new TokenAuthorizer(stack, 'myauthorizer', {
Expand Down Expand Up @@ -84,7 +84,7 @@ describe('lambda authorizer', () => {
const func = new lambda.Function(stack, 'myfunction', {
handler: 'handler',
code: lambda.Code.fromInline('foo'),
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
});

const auth = new RequestAuthorizer(stack, 'myauthorizer', {
Expand Down Expand Up @@ -159,7 +159,7 @@ describe('lambda authorizer', () => {
const func = new lambda.Function(stack, 'myfunction', {
handler: 'handler',
code: lambda.Code.fromInline('foo'),
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
});

expect(() => new RequestAuthorizer(stack, 'myauthorizer', {
Expand All @@ -175,7 +175,7 @@ describe('lambda authorizer', () => {
const func = new lambda.Function(stack, 'myfunction', {
handler: 'handler',
code: lambda.Code.fromInline('foo'),
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
});

const auth = new TokenAuthorizer(stack, 'myauthorizer', {
Expand Down Expand Up @@ -248,7 +248,7 @@ describe('lambda authorizer', () => {
const func = new lambda.Function(stack, 'myfunction', {
handler: 'handler',
code: lambda.Code.fromInline('foo'),
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
});

const auth = new RequestAuthorizer(stack, 'myauthorizer', {
Expand Down Expand Up @@ -319,7 +319,7 @@ describe('lambda authorizer', () => {
const func = new lambda.Function(stack, 'myfunction', {
handler: 'handler',
code: lambda.Code.fromInline('foo'),
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
});

const role = new iam.Role(stack, 'authorizerassumerole', {
Expand Down Expand Up @@ -409,7 +409,7 @@ describe('lambda authorizer', () => {
const func = new lambda.Function(stack, 'myfunction', {
handler: 'handler',
code: lambda.Code.fromInline('foo'),
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
});

const role = new iam.Role(stack, 'authorizerassumerole', {
Expand Down Expand Up @@ -500,7 +500,7 @@ describe('lambda authorizer', () => {
const func = new lambda.Function(stack, 'myfunction', {
handler: 'handler',
code: lambda.Code.fromInline('foo'),
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
});
const auth = new TokenAuthorizer(stack, 'myauthorizer', {
handler: func,
Expand All @@ -514,7 +514,7 @@ describe('lambda authorizer', () => {
const func = new lambda.Function(stack, 'myfunction', {
handler: 'handler',
code: lambda.Code.fromInline('foo'),
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
});
const auth = new RequestAuthorizer(stack, 'myauthorizer', {
handler: func,
Expand Down Expand Up @@ -559,7 +559,7 @@ describe('lambda authorizer', () => {
const func = new lambda.Function(stack, 'myfunction', {
handler: 'handler',
code: lambda.Code.fromInline('foo'),
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
});

const auth = new RequestAuthorizer(stack, 'myauthorizer', {
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-apigateway/test/cors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ describe('cors', () => {
const handler = new lambda.Function(stack, 'handler', {
handler: 'index.handler',
code: lambda.Code.fromInline('boom'),
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
});

// WHEN
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk-lib/aws-apigateway/test/deployment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ describe('deployment', () => {
const stack2 = new Stack();
const handler1 = new lambda.Function(stack1, 'handler1', {
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda')),
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
});
const handler2 = new lambda.Function(stack2, 'handler2', {
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda')),
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('lambda', () => {
// GIVEN
const stack = new cdk.Stack();
const fn = new lambda.Function(stack, 'Handler', {
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
code: lambda.Code.fromInline('foo'),
handler: 'index.handler',
});
Expand Down Expand Up @@ -102,7 +102,7 @@ describe('lambda', () => {
// GIVEN
const stack = new cdk.Stack();
const fn = new lambda.Function(stack, 'Handler', {
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
code: lambda.Code.fromInline('foo'),
handler: 'index.handler',
});
Expand Down Expand Up @@ -138,7 +138,7 @@ describe('lambda', () => {
// GIVEN
const stack = new cdk.Stack();
const fn = new lambda.Function(stack, 'Handler', {
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
code: lambda.Code.fromInline('foo'),
handler: 'index.handler',
});
Expand All @@ -162,7 +162,7 @@ describe('lambda', () => {
const api = new apigateway.RestApi(stack, 'test-api');

const handler = new lambda.Function(stack, 'MyFunc', {
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
code: lambda.Code.fromInline('loo'),
});
Expand Down Expand Up @@ -228,7 +228,7 @@ describe('lambda', () => {
});

const handler = new lambda.Function(stack, 'MyFunc', {
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
code: lambda.Code.fromInline('loo'),
});
Expand All @@ -249,7 +249,7 @@ describe('lambda', () => {
const method = restapi.root.addMethod('ANY');
const handler = new lambda.Function(stack, 'MyFunc', {
functionName: 'ThisFunction',
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
code: lambda.Code.fromInline('loo'),
});
Expand All @@ -269,7 +269,7 @@ describe('lambda', () => {
const restapi = new apigateway.RestApi(stack, 'RestApi');
const method = restapi.root.addMethod('ANY');
const handler = new lambda.Function(stack, 'MyFunc', {
runtime: lambda.Runtime.NODEJS_16_X,
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
code: lambda.Code.fromInline('loo'),
});
Expand Down
Loading
Loading