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

test (T130 - Fix Sagemaker Integration Tests) #172

Merged
merged 7 commits into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
86 changes: 85 additions & 1 deletion .viperlightignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,88 @@ source/patterns/@aws-solutions-constructs/core/test/cloudfront-distribution-s3-h
source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/test.s3-sqs.test.ts:251
source/use_cases/aws-custom-glue-etl/stream-producer/generate_data.py:86
source/use_cases/aws-custom-glue-etl/stream-producer/generate_data.py:87
source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/test/lambda-secretsmanager.test.ts:481
source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/test/lambda-secretsmanager.test.ts:481
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:6
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:9
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:12
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:15
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:18
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:21
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:24
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:27
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:30
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:33
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:36
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:39
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:42
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:45
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:48
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:51
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:54
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:57
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:60
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:63
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.deployFunction.expected.json:66
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:609
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:612
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:615
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:618
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:621
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:624
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:627
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:630
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:633
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:636
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:639
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:642
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:645
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:648
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:651
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:654
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:657
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:660
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:663
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:666
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingFunction.expected.json:669
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:6
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:9
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:12
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:15
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:18
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:21
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:24
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:27
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:30
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:33
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:36
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:39
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:42
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:45
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:48
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:51
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:54
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:57
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:60
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:63
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/integ.existingSageMakerEndpoint.expected.json:66
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:24
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:27
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:30
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:33
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:36
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:39
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:42
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:45
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:48
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:51
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:54
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:57
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:60
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:63
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:66
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:69
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:72
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:75
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:78
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:81
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/test/test-helper.ts:84
3 changes: 2 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ sonar.javascript.lcov.reportPaths= \
source/patterns/@aws-solutions-constructs/aws-lambda-step-function/coverage/lcov.info, \
source/patterns/@aws-solutions-constructs/aws-s3-sqs/coverage/lcov.info, \
source/patterns/@aws-solutions-constructs/aws-kinesisstreams-gluejob/coverage/lcov.info, \
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/coverage/lcov.info
source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/coverage/lcov.info \
source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/coverage/lcov.info

# Encoding of the source files
sonar.sourceEncoding=UTF-8
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
},
"dependencies": {
"@aws-cdk/aws-ec2": "0.0.0",
"@aws-cdk/aws-s3": "0.0.0",
"@aws-cdk/aws-s3-assets": "0.0.0",
"@aws-cdk/aws-iam": "0.0.0",
"@aws-cdk/aws-lambda": "0.0.0",
"@aws-cdk/aws-sagemaker": "0.0.0",
Expand Down Expand Up @@ -82,6 +84,8 @@
},
"peerDependencies": {
"@aws-cdk/aws-ec2": "0.0.0",
"@aws-cdk/aws-s3": "0.0.0",
"@aws-cdk/aws-s3-assets": "0.0.0",
"@aws-cdk/aws-iam": "0.0.0",
"@aws-cdk/aws-lambda": "0.0.0",
"@aws-cdk/aws-sagemaker": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,98 @@
{
"Description": "Integration Test for aws-lambda-sagemakerendpoint",
"Mappings": {
"mappings": {
"us-east-1": {
"containerArn": "382416733822.dkr.ecr.us-east-1.amazonaws.com/linear-learner:latest"
},
"us-east-2": {
"containerArn": "404615174143.dkr.ecr.us-east-2.amazonaws.com/linear-learner:latest"
},
"us-west-1": {
"containerArn": "632365934929.dkr.ecr.us-west-1.amazonaws.com/linear-learner:latest"
},
"us-west-2": {
"containerArn": "174872318107.dkr.ecr.us-west-2.amazonaws.com/linear-learner:latest"
},
"af-south-1": {
"containerArn": "455444449433.dkr.ecr.af-south-1.amazonaws.com/linear-learner:latest"
},
"ap-east-1": {
"containerArn": "286214385809.dkr.ecr.ap-east-1.amazonaws.com/linear-learner:latest"
},
"ap-south-1": {
"containerArn": "991648021394.dkr.ecr.ap-south-1.amazonaws.com/linear-learner:latest"
},
"ap-northeast-2": {
"containerArn": "835164637446.dkr.ecr.ap-northeast-2.amazonaws.com/linear-learner:latest"
},
"ap-southeast-1": {
"containerArn": "475088953585.dkr.ecr.ap-southeast-1.amazonaws.com/linear-learner:latest"
},
"ap-southeast-2": {
"containerArn": "712309505854.dkr.ecr.ap-southeast-2.amazonaws.com/linear-learner:latest"
},
"ap-northeast-1": {
"containerArn": "351501993468.dkr.ecr.ap-northeast-1.amazonaws.com/linear-learner:latest"
},
"ca-central-1": {
"containerArn": "469771592824.dkr.ecr.ca-central-1.amazonaws.com/linear-learner:latest"
},
"eu-central-1": {
"containerArn": "664544806723.dkr.ecr.eu-central-1.amazonaws.com/linear-learner:latest"
},
"eu-west-1": {
"containerArn": "438346466558.dkr.ecr.eu-west-1.amazonaws.com/linear-learner:latest"
},
"eu-west-2": {
"containerArn": "644912444149.dkr.ecr.eu-west-2.amazonaws.com/linear-learner:latest"
},
"eu-west-3": {
"containerArn": "749696950732.dkr.ecr.eu-west-3.amazonaws.com/linear-learner:latest"
},
"eu-north-1": {
"containerArn": "669576153137.dkr.ecr.eu-north-1.amazonaws.com/linear-learner:latest"
},
"eu-south-1": {
"containerArn": "257386234256.dkr.ecr.eu-south-1.amazonaws.com/linear-learner:latest"
},
"me-south-1": {
"containerArn": "249704162688.dkr.ecr.me-south-1.amazonaws.com/linear-learner:latest"
},
"sa-east-1": {
"containerArn": "855470959533.dkr.ecr.sa-east-1.amazonaws.com/linear-learner:latest"
},
"us-gov-west-1": {
"containerArn": "226302683700.dkr.ecr.us-gov-west-1.amazonaws.com/linear-learner:latest"
}
}
},
"Parameters": {
"AssetParameterse4dc8c22c79add1b62eb2b2d313770cba3dc11a6a8f8e386dd8723853be0265dS3BucketB08A768F": {
"Type": "String",
"Description": "S3 bucket for asset \"e4dc8c22c79add1b62eb2b2d313770cba3dc11a6a8f8e386dd8723853be0265d\""
},
"AssetParameterse4dc8c22c79add1b62eb2b2d313770cba3dc11a6a8f8e386dd8723853be0265dS3VersionKey660A39C3": {
"Type": "String",
"Description": "S3 key for asset version \"e4dc8c22c79add1b62eb2b2d313770cba3dc11a6a8f8e386dd8723853be0265d\""
},
"AssetParameterse4dc8c22c79add1b62eb2b2d313770cba3dc11a6a8f8e386dd8723853be0265dArtifactHashBE6BED27": {
"Type": "String",
"Description": "Artifact hash for asset \"e4dc8c22c79add1b62eb2b2d313770cba3dc11a6a8f8e386dd8723853be0265d\""
},
"AssetParametersd894a15aa0242919d44274cbb8ddd33f39cce242789e85e67e642da0a2926e15S3BucketE0481499": {
"Type": "String",
"Description": "S3 bucket for asset \"d894a15aa0242919d44274cbb8ddd33f39cce242789e85e67e642da0a2926e15\""
},
"AssetParametersd894a15aa0242919d44274cbb8ddd33f39cce242789e85e67e642da0a2926e15S3VersionKey9A1AB349": {
"Type": "String",
"Description": "S3 key for asset version \"d894a15aa0242919d44274cbb8ddd33f39cce242789e85e67e642da0a2926e15\""
},
"AssetParametersd894a15aa0242919d44274cbb8ddd33f39cce242789e85e67e642da0a2926e15ArtifactHash4C89D4A0": {
"Type": "String",
"Description": "Artifact hash for asset \"d894a15aa0242919d44274cbb8ddd33f39cce242789e85e67e642da0a2926e15\""
}
},
"Resources": {
"testlambdasagemakerSagemakerRoleD84546B8": {
"Type": "AWS::IAM::Role",
Expand Down Expand Up @@ -247,8 +340,53 @@
]
},
"PrimaryContainer": {
"Image": "<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest",
"ModelDataUrl": "s3://<bucket-name>/<prefix>/model.tar.gz"
"Image": {
"Fn::FindInMap": [
"mappings",
{
"Ref": "AWS::Region"
},
"containerArn"
]
},
"ModelDataUrl": {
"Fn::Join": [
"",
[
"s3://",
{
"Ref": "AssetParameterse4dc8c22c79add1b62eb2b2d313770cba3dc11a6a8f8e386dd8723853be0265dS3BucketB08A768F"
},
"/",
{
"Fn::Select": [
0,
{
"Fn::Split": [
"||",
{
"Ref": "AssetParameterse4dc8c22c79add1b62eb2b2d313770cba3dc11a6a8f8e386dd8723853be0265dS3VersionKey660A39C3"
}
]
}
]
},
{
"Fn::Select": [
1,
{
"Fn::Split": [
"||",
{
"Ref": "AssetParameterse4dc8c22c79add1b62eb2b2d313770cba3dc11a6a8f8e386dd8723853be0265dS3VersionKey660A39C3"
}
]
}
]
}
]
]
}
}
},
"DependsOn": [
Expand Down Expand Up @@ -531,19 +669,5 @@
}
}
}
},
"Parameters": {
"AssetParametersd894a15aa0242919d44274cbb8ddd33f39cce242789e85e67e642da0a2926e15S3BucketE0481499": {
"Type": "String",
"Description": "S3 bucket for asset \"d894a15aa0242919d44274cbb8ddd33f39cce242789e85e67e642da0a2926e15\""
},
"AssetParametersd894a15aa0242919d44274cbb8ddd33f39cce242789e85e67e642da0a2926e15S3VersionKey9A1AB349": {
"Type": "String",
"Description": "S3 key for asset version \"d894a15aa0242919d44274cbb8ddd33f39cce242789e85e67e642da0a2926e15\""
},
"AssetParametersd894a15aa0242919d44274cbb8ddd33f39cce242789e85e67e642da0a2926e15ArtifactHash4C89D4A0": {
"Type": "String",
"Description": "Artifact hash for asset \"d894a15aa0242919d44274cbb8ddd33f39cce242789e85e67e642da0a2926e15\""
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@
import { Stack, Duration, App } from '@aws-cdk/core';
import { LambdaToSagemakerEndpoint, LambdaToSagemakerEndpointProps } from '../lib';
import * as lambda from '@aws-cdk/aws-lambda';
import { getSagemakerModel } from './test-helper';

// Setup
const app = new App();
const stack = new Stack(app, 'test-lambda-sagemakerendpoint');
stack.templateOptions.description = 'Integration Test for aws-lambda-sagemakerendpoint';

const [containerMap, modelAsset ] = getSagemakerModel(stack);

const constructProps: LambdaToSagemakerEndpointProps = {
modelProps: {
primaryContainer: {
image: '<AccountId>.dkr.ecr.<region>.amazonaws.com/linear-learner:latest',
modelDataUrl: 's3://<bucket-name>/<prefix>/model.tar.gz',
image: containerMap.findInMap(Stack.of(stack).region, "containerArn"),
modelDataUrl: modelAsset.s3ObjectUrl
},
},
lambdaFunctionProps: {
Expand All @@ -37,7 +40,9 @@ const constructProps: LambdaToSagemakerEndpointProps = {
},
};

new LambdaToSagemakerEndpoint(stack, 'test-lambda-sagemaker', constructProps);
const lambdaToSagemakerConstruct = new LambdaToSagemakerEndpoint(stack, 'test-lambda-sagemaker', constructProps);

lambdaToSagemakerConstruct.node.addDependency(modelAsset);

// Synth
app.synth();
Loading