Skip to content

Commit

Permalink
feat(lambda): add nodejs10x runtime and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robertd committed May 15, 2019
1 parent e4e24ab commit c9c4286
Show file tree
Hide file tree
Showing 26 changed files with 70 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"Arn"
]
},
"Runtime": "nodejs6.10"
"Runtime": "nodejs8.10"
},
"DependsOn": [
"BooksHandlerServiceRole5B6A8847"
Expand Down Expand Up @@ -270,7 +270,7 @@
"Arn"
]
},
"Runtime": "nodejs6.10"
"Runtime": "nodejs8.10"
},
"DependsOn": [
"BookHandlerServiceRole894768AD"
Expand Down Expand Up @@ -486,7 +486,7 @@
"Arn"
]
},
"Runtime": "nodejs6.10"
"Runtime": "nodejs8.10"
},
"DependsOn": [
"HelloServiceRole1E55EA16"
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ class BookStack extends cdk.Stack {
super(scope, id);

const booksHandler = new apigw.LambdaIntegration(new lambda.Function(this, 'BooksHandler', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
handler: 'index.handler',
code: lambda.Code.inline(`exports.handler = ${echoHandlerCode}`)
}));

const bookHandler = new apigw.LambdaIntegration(new lambda.Function(this, 'BookHandler', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
handler: 'index.handler',
code: lambda.Code.inline(`exports.handler = ${echoHandlerCode}`)
}));

const hello = new apigw.LambdaIntegration(new lambda.Function(this, 'Hello', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
handler: 'index.handler',
code: lambda.Code.inline(`exports.handler = ${helloCode}`)
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@
"Arn"
]
},
"Runtime": "nodejs6.10"
"Runtime": "nodejs8.10"
},
"DependsOn": [
"MyHandlerServiceRoleFFA06653"
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Test extends cdk.Stack {
});

const handler = new lambda.Function(this, 'MyHandler', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
code: lambda.Code.inline(`exports.handler = ${handlerCode}`),
handler: 'index.handler',
});
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-apigateway/test/test.lambda-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export = {
const handler = new lambda.Function(stack, 'handler', {
handler: 'index.handler',
code: lambda.Code.inline('boom'),
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

// WHEN
Expand Down Expand Up @@ -78,7 +78,7 @@ export = {
const handler = new lambda.Function(stack, 'handler', {
handler: 'index.handler',
code: lambda.Code.inline('boom'),
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});
const alias = new lambda.Alias(stack, 'alias', {
aliasName: 'my-alias',
Expand Down Expand Up @@ -145,7 +145,7 @@ export = {
const handler = new lambda.Function(stack, 'handler', {
handler: 'index.handler',
code: lambda.Code.inline('boom'),
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

// WHEN
Expand Down Expand Up @@ -184,7 +184,7 @@ export = {
const handler = new lambda.Function(stack, 'handler', {
handler: 'index.handler',
code: lambda.Code.inline('boom'),
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

test.throws(() => new apigw.LambdaRestApi(stack, 'lambda-rest-api', {
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-apigateway/test/test.lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export = {
// GIVEN
const stack = new cdk.Stack();
const fn = new lambda.Function(stack, 'Handler', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
code: lambda.Code.inline('foo'),
handler: 'index.handler'
});
Expand Down Expand Up @@ -106,7 +106,7 @@ export = {
// GIVEN
const stack = new cdk.Stack();
const fn = new lambda.Function(stack, 'Handler', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
code: lambda.Code.inline('foo'),
handler: 'index.handler'
});
Expand All @@ -132,7 +132,7 @@ export = {
const api = new apigateway.RestApi(stack, 'test-api');

const handler = new lambda.Function(stack, 'MyFunc', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
handler: 'index.handler',
code: lambda.Code.inline(``)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@
"Arn"
]
},
"Runtime": "nodejs6.10"
"Runtime": "nodejs8.10"
},
"DependsOn": [
"LambdaFunServiceRoleDefaultPolicy217FED83",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const lambdaFun = new lambda.Function(stack, 'LambdaFun', {
};
`),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});
const lambdaStage = pipeline.addStage({ name: 'Lambda' });
lambdaStage.addAction(new cpactions.LambdaInvokeAction({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ export = {
const lambdaFun = new lambda.Function(stack, 'Function', {
code: new lambda.InlineCode('bla'),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS43,
runtime: lambda.Runtime.NodeJS810,
});

const pipeline = new codepipeline.Pipeline(stack, 'Pipeline');
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-cognito/test/test.user-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export = {
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

// WHEN
Expand Down Expand Up @@ -56,7 +56,7 @@ export = {
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

// WHEN
Expand Down Expand Up @@ -93,7 +93,7 @@ export = {
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

// WHEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"Arn"
]
},
"Runtime": "nodejs6.10"
"Runtime": "nodejs8.10"
},
"DependsOn": [
"MyFuncServiceRole54065130"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const app = new cdk.App();
const stack = new cdk.Stack(app, 'lambda-events');

const fn = new lambda.Function(stack, 'MyFunc', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
handler: 'index.handler',
code: lambda.Code.inline(`exports.handler = ${handler.toString()}`)
});
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-lambda/lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class Runtime {
public static readonly NodeJS43 = new Runtime('nodejs4.3', RuntimeFamily.NodeJS, { supportsInlineCode: true });
public static readonly NodeJS610 = new Runtime('nodejs6.10', RuntimeFamily.NodeJS, { supportsInlineCode: true });
public static readonly NodeJS810 = new Runtime('nodejs8.10', RuntimeFamily.NodeJS, { supportsInlineCode: true });
public static readonly NodeJS10x = new Runtime('nodejs10.x', RuntimeFamily.NodeJS, { supportsInlineCode: true });
public static readonly Python27 = new Runtime('python2.7', RuntimeFamily.Python, { supportsInlineCode: true });
public static readonly Python36 = new Runtime('python3.6', RuntimeFamily.Python, { supportsInlineCode: true });
public static readonly Python37 = new Runtime('python3.7', RuntimeFamily.Python, { supportsInlineCode: true });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"Arn"
]
},
"Runtime": "nodejs6.10"
"Runtime": "nodejs8.10"
},
"DependsOn": [
"MyFunctionServiceRole3C357FF2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const bucketA = new s3.Bucket(stack, 'MyBucket', {
});

const fn = new lambda.Function(stack, 'MyFunction', {
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
handler: 'index.handler',
code: lambda.Code.inline(`exports.handler = ${handler.toString()}`)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"Arn"
]
},
"Runtime": "nodejs6.10"
"Runtime": "nodejs8.10"
},
"DependsOn": [
"MyLambdaServiceRoleDefaultPolicy5BBC6F68",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda/test/integ.lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,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.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

fn.addToRolePolicy(new iam.PolicyStatement().addAllResources().addAction('*'));
Expand Down
14 changes: 7 additions & 7 deletions packages/@aws-cdk/aws-lambda/test/test.alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export = {
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('hello()'),
handler: 'index.hello',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

const version = fn.addVersion('1');
Expand Down Expand Up @@ -45,7 +45,7 @@ export = {
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('hello()'),
handler: 'index.hello',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

const version = fn.newVersion();
Expand Down Expand Up @@ -73,7 +73,7 @@ export = {
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('hello()'),
handler: 'index.hello',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

const version1 = fn.addVersion('1');
Expand Down Expand Up @@ -106,7 +106,7 @@ export = {
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('hello()'),
handler: 'index.hello',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

const version = fn.addVersion('1');
Expand Down Expand Up @@ -137,7 +137,7 @@ export = {
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('hello()'),
handler: 'index.hello',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

const version = fn.addVersion('1');
Expand Down Expand Up @@ -187,7 +187,7 @@ export = {
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('hello()'),
handler: 'index.hello',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

const version = fn.addVersion('1');
Expand All @@ -206,7 +206,7 @@ export = {
const fn = new lambda.Function(stack, 'MyLambda', {
code: new lambda.InlineCode('hello()'),
handler: 'index.hello',
runtime: lambda.Runtime.NodeJS610,
runtime: lambda.Runtime.NodeJS810,
});

const version = fn.addVersion('1');
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda/test/test.code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export = {
},
'fails if larger than 4096 bytes'(test: Test) {
test.throws(
() => defineFunction(lambda.Code.inline(generateRandomString(4097)), lambda.Runtime.NodeJS610),
() => defineFunction(lambda.Code.inline(generateRandomString(4097)), lambda.Runtime.NodeJS810),
/Lambda source is too large, must be <= 4096 but is 4097/);
test.done();
}
Expand Down
Loading

0 comments on commit c9c4286

Please sign in to comment.