Skip to content

Commit 08eed2b

Browse files
committed
clean commented code in unittests
1 parent 4880bb4 commit 08eed2b

File tree

2 files changed

+0
-188
lines changed

2 files changed

+0
-188
lines changed

source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/aws-lambda-sagemakerendpoint.test.ts

Lines changed: 0 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { Stack, Duration } from '@aws-cdk/core';
1616
import { LambdaToSagemakerEndpoint, LambdaToSagemakerEndpointProps } from '../lib';
1717
import * as defaults from '@aws-solutions-constructs/core';
1818
import * as lambda from '@aws-cdk/aws-lambda';
19-
// import * as ec2 from '@aws-cdk/aws-ec2';
2019
import * as iam from '@aws-cdk/aws-iam';
2120
import { SynthUtils } from '@aws-cdk/assert';
2221
import '@aws-cdk/assert/jest';
@@ -276,46 +275,6 @@ test('Test for errot when existing Lambda function does not have vpc and deployV
276275
expect(app).toThrowError();
277276
});
278277

279-
// // -----------------------------------------------------------------------------------------------------------------------------------------
280-
// // Pattern deployment with new Lambda function, new Sagemaker endpoint, deployVpc = true and deployNatGateway = true
281-
// // -----------------------------------------------------------------------------------------------------------------------------------------
282-
// test('Pattern deployment with new Lambda function, new Sagemaker endpoint, deployVpc = true and deployNatGateway = true', () => {
283-
// // Initial Setup
284-
// const stack = new Stack();
285-
// // Create IAM Role to be assumed by Sagemaker
286-
// const sagemakerRole = new iam.Role(stack, 'SagemakerRole', {
287-
// assumedBy: new iam.ServicePrincipal('sagemaker.amazonaws.com'),
288-
// });
289-
// sagemakerRole.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonSageMakerFullAccess'));
290-
// sagemakerRole.addToPolicy(
291-
// new iam.PolicyStatement({
292-
// actions: ['s3:GetObject', 's3:PutObject', 's3:DeleteObject', 's3:ListBucket'],
293-
// resources: ['arn:aws:s3:::*'],
294-
// })
295-
// );
296-
// const props: LambdaToSagemakerEndpointProps = {
297-
// modelProps: {
298-
// executionRoleArn: sagemakerRole.roleArn,
299-
// primaryContainer: {
300-
// image: '<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest',
301-
// modelDataUrl: 's3://<bucket-name>/<prefix>/model.tar.gz',
302-
// },
303-
// },
304-
// deployVpc: true,
305-
// lambdaFunctionProps: {
306-
// runtime: lambda.Runtime.PYTHON_3_8,
307-
// code: lambda.Code.fromAsset(`${__dirname}/lambda`),
308-
// handler: 'index.handler',
309-
// timeout: Duration.minutes(5),
310-
// memorySize: 128,
311-
// },
312-
// role: sagemakerRole,
313-
// };
314-
// new LambdaToSagemakerEndpoint(stack, 'test-lambda-sagemaker', props);
315-
// // Assertion 1
316-
// expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot();
317-
// });
318-
319278
// -------------------------------------------------------------------------------------------------------
320279
// Pattern deployment with existing Lambda function (with VPC), new Sagemaker endpoint, and existingVpc
321280
// -------------------------------------------------------------------------------------------------------
@@ -466,105 +425,6 @@ test('Test for error with primaryContainer=undefined (not supplied by user)', ()
466425
expect(app).toThrowError();
467426
});
468427

469-
// // --------------------------------------------------------------------------------------------------------------------
470-
// // Pattern deployment with new Lambda function with new Sagemaker endpoint, existingVpc and deployNatGateway = false
471-
// // --------------------------------------------------------------------------------------------------------------------
472-
// test('Pattern deployment with new Lambda function with existingVpcObj and deployNatGateway = false', () => {
473-
// // Initial Setup
474-
// const stack = new Stack();
475-
// // Create IAM Role to be assumed by Sagemaker
476-
// const sagemakerRole = new iam.Role(stack, 'SagemakerRole', {
477-
// assumedBy: new iam.ServicePrincipal('sagemaker.amazonaws.com'),
478-
// });
479-
// sagemakerRole.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonSageMakerFullAccess'));
480-
// sagemakerRole.addToPolicy(
481-
// new iam.PolicyStatement({
482-
// actions: ['s3:GetObject', 's3:PutObject', 's3:DeleteObject', 's3:ListBucket'],
483-
// resources: ['arn:aws:s3:::*'],
484-
// })
485-
// );
486-
487-
// const vpc = defaults.buildVpc(stack, {
488-
// defaultVpcProps: defaults.DefaultIsolatedVpcProps(),
489-
// constructVpcProps: {
490-
// enableDnsHostnames: true,
491-
// enableDnsSupport: true,
492-
// },
493-
// });
494-
495-
// // Add S3 VPC Gateway Endpint, required by Sagemaker to access Models artifacts via AWS private network
496-
// defaults.AddAwsServiceEndpoint(stack, vpc, defaults.ServiceEndpointTypes.S3);
497-
// // Add SAGEMAKER_RUNTIME VPC Interface Endpint, required by the lambda function to invoke the SageMaker endpoint
498-
// defaults.AddAwsServiceEndpoint(stack, vpc, defaults.ServiceEndpointTypes.SAGEMAKER_RUNTIME);
499-
500-
// const props: LambdaToSagemakerEndpointProps = {
501-
// modelProps: {
502-
// executionRoleArn: sagemakerRole.roleArn,
503-
// primaryContainer: {
504-
// image: '<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest',
505-
// modelDataUrl: 's3://<bucket-name>/<prefix>/model.tar.gz',
506-
// },
507-
// },
508-
// existingVpc: vpc,
509-
// lambdaFunctionProps: {
510-
// runtime: lambda.Runtime.PYTHON_3_8,
511-
// code: lambda.Code.fromAsset(`${__dirname}/lambda`),
512-
// handler: 'index.handler',
513-
// timeout: Duration.minutes(5),
514-
// memorySize: 128,
515-
// },
516-
// role: sagemakerRole,
517-
// };
518-
// new LambdaToSagemakerEndpoint(stack, 'test-lambda-sagemaker', props);
519-
// // Assertion 1
520-
// expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot();
521-
// });
522-
523-
// // --------------------------------------------------------------------------------------------
524-
// // Pattern deployment with new Lambda function and existingSagemakerendpointObj (no vpc)
525-
// // --------------------------------------------------------------------------------------------
526-
// test('Pattern deployment with new Lambda function and existingSagemakerendpointObj (no vpc)', () => {
527-
// // Initial Setup
528-
// const stack = new Stack();
529-
// // Create IAM Role to be assumed by Sagemaker
530-
// const sagemakerRole = new iam.Role(stack, 'SagemakerRole', {
531-
// assumedBy: new iam.ServicePrincipal('sagemaker.amazonaws.com'),
532-
// });
533-
// sagemakerRole.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonSageMakerFullAccess'));
534-
// sagemakerRole.addToPolicy(
535-
// new iam.PolicyStatement({
536-
// actions: ['s3:GetObject', 's3:PutObject', 's3:DeleteObject', 's3:ListBucket'],
537-
// resources: ['arn:aws:s3:::*'],
538-
// })
539-
// );
540-
541-
// const [sagemakerEndpoint] = defaults.deploySagemakerEndpoint(stack, {
542-
// modelProps: {
543-
// executionRoleArn: sagemakerRole.roleArn,
544-
// primaryContainer: {
545-
// image: '<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest',
546-
// modelDataUrl: 's3://<bucket-name>/<prefix>/model.tar.gz',
547-
// },
548-
// },
549-
// role: sagemakerRole,
550-
// });
551-
552-
// const props: LambdaToSagemakerEndpointProps = {
553-
// existingSagemakerEndpointObj: sagemakerEndpoint,
554-
// lambdaFunctionProps: {
555-
// runtime: lambda.Runtime.PYTHON_3_8,
556-
// code: lambda.Code.fromAsset(`${__dirname}/lambda`),
557-
// handler: 'index.handler',
558-
// timeout: Duration.minutes(5),
559-
// memorySize: 128,
560-
// },
561-
// role: sagemakerRole,
562-
// };
563-
// new LambdaToSagemakerEndpoint(stack, 'test-lambda-sagemaker', props);
564-
// // Assertion 1
565-
// expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot();
566-
// });
567-
568428
// -------------------------------------------------------------------------------------------------
569429
// Test getter methods: existing Lambda function (with VPC), new Sagemaker endpoint, and existingVpc
570430
// -------------------------------------------------------------------------------------------------

source/patterns/@aws-solutions-constructs/core/test/sagemaker-helper.test.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -230,54 +230,6 @@ test('Test minimal deployment of Sagemaker Inference Endpoint with VPC', () => {
230230
expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot();
231231
});
232232

233-
// // ---------------------------------------------------------------------------
234-
// // Test minimal deployment of Sagemaker Inference Endpoint with VPC/NatGateway
235-
// // ---------------------------------------------------------------------------
236-
// test('Test minimal deployment of Sagemaker Inference Endpoint with VPC/NatGateway', () => {
237-
// // Stack
238-
// const stack = new Stack();
239-
// // Create IAM Role to be assumed by Sagemaker
240-
// const sagemakerRole = new iam.Role(stack, 'SagemakerRole', {
241-
// assumedBy: new iam.ServicePrincipal('sagemaker.amazonaws.com'),
242-
// });
243-
// sagemakerRole.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonSageMakerFullAccess'));
244-
// sagemakerRole.addToPolicy(
245-
// new iam.PolicyStatement({
246-
// actions: ['s3:GetObject', 's3:PutObject', 's3:DeleteObject', 's3:ListBucket'],
247-
// resources: ['arn:aws:s3:::*'],
248-
// })
249-
// );
250-
251-
// // create a VPC with required VPC S3 gateway and SAGEMAKER_RUNTIME Interface
252-
// const vpc = defaults.buildVpc(stack, {
253-
// defaultVpcProps: defaults.DefaultPublicPrivateVpcProps(),
254-
// constructVpcProps: {
255-
// enableDnsHostnames: true,
256-
// enableDnsSupport: true,
257-
// },
258-
// });
259-
260-
// // Add S3 VPC Gateway Endpint, required by Sagemaker to access Models artifacts via AWS private network
261-
// defaults.AddAwsServiceEndpoint(stack, vpc, defaults.ServiceEndpointTypes.S3);
262-
// // Add SAGEMAKER_RUNTIME VPC Interface Endpint, required by the lambda function to invoke the SageMaker endpoint
263-
// defaults.AddAwsServiceEndpoint(stack, vpc, defaults.ServiceEndpointTypes.SAGEMAKER_RUNTIME);
264-
265-
// // Build Sagemaker Inference Endpoint
266-
// defaults.BuildSagemakerEndpoint(stack, {
267-
// modelProps: {
268-
// executionRoleArn: sagemakerRole.roleArn,
269-
// primaryContainer: {
270-
// image: '<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest',
271-
// modelDataUrl: 's3://<bucket-name>/<prefix>/model.tar.gz',
272-
// },
273-
// },
274-
// vpc,
275-
// role: sagemakerRole,
276-
// });
277-
// // Assertion
278-
// expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot();
279-
// });
280-
281233
// -------------------------------------------------------------------------
282234
// Test deployment of Sagemaker Inference Endpoint with properties overwrite
283235
// -------------------------------------------------------------------------

0 commit comments

Comments
 (0)