diff --git a/.gitignore b/.gitignore deleted file mode 100644 index a54f45b..0000000 --- a/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -# compiled output -**/dist -**/global-s3-assets -**/regional-s3-assets -**/open-source -**/.zip -**/tmp - -# dependencies -**/coverage -**/node_modules - -# misc -**/npm-debug.log -**/package-lock.json -**/.vscode/settings.json -**/.DS_Store -**/.vscode \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b89f81e..3a5b9ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.2.0] - 2022-10-17 +### Added +- AppRegistry Application Stack Association +- Application Insights in AppRegistry +- SonarQube properties file: sonar-project.properties +- Added unit tests with 80% code coverage +### Changed +- Changed deployment/run-unit-tests.sh to generate unit test coverage reports +### Contributors +* @sandimciin +* @eggoynes ## [1.1.0] - 2021-7-29 ### Added @@ -22,6 +33,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added extra steps when building in the Readme file. (https://github.com/awslabs/video-on-demand-on-aws-foundations/issues/4) - Updated Axios to version 0.21.1 +### Contributors +* @eggoynes ## [1.0.0] - 2020-11-05 ### Added - All files, initial version diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3fd02db..00b1ed2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ reported the issue. Please try to include as much information as you can. Detail ## Contributing via Pull Requests Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: -1. You are working against the latest source on the *master* branch. +1. You are working against the latest source on the *main* branch. 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 3. You open an issue to discuss any significant work - we would hate for your time to be wasted. @@ -57,6 +57,6 @@ If you discover a potential security issue in this project we ask that you notif ## Licensing -See the [LICENSE](https://github.com/awslabs/%%SOLUTION_NAME%%/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. +See the [LICENSE](https://github.com/awslabs/%%SOLUTION_NAME%%/blob/main/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes. diff --git a/README.md b/README.md index 5729ff4..d705f92 100644 --- a/README.md +++ b/README.md @@ -51,14 +51,14 @@ aws s3 mb s3://my-bucket-us-east-1 Build the distributable: ``` chmod +x ./build-s3-dist.sh -./build-s3-dist.sh my-bucket video-on-demand-on-aws-foundation v1.0.0 +./build-s3-dist.sh my-bucket video-on-demand-on-aws-foundation v1.2.0 ``` > **Notes**: The _build-s3-dist_ script expects the bucket name as one of its parameters, and this value should not include the region suffix. Deploy the distributable to the Amazon S3 bucket in your account: ``` -aws s3 cp ./regional-s3-assets/ s3://my-bucket-us-east-1/video-on-demand-on-aws-foundation/v1.0.0/ --recursive --acl bucket-owner-full-control +aws s3 cp ./regional-s3-assets/ s3://my-bucket-us-east-1/video-on-demand-on-aws-foundation/v1.2.0/ --recursive --acl bucket-owner-full-control ``` ### 4. Launch the CloudFormation template. diff --git a/deployment/build-s3-dist.sh b/deployment/build-s3-dist.sh index 65b7ef6..775d8ba 100755 --- a/deployment/build-s3-dist.sh +++ b/deployment/build-s3-dist.sh @@ -17,7 +17,7 @@ # Parameters: # - source-bucket-base-name: Name for the S3 bucket location where the template will source the Lambda # code from. The template will append '-[region_name]' to this bucket name. -# For example: ./build-s3-dist.sh solutions my-solution v1.0.0 +# For example: ./build-s3-dist.sh solutions my-solution v1.2.0 # The template will then expect the source code to be located in the solutions-[region_name] bucket # - solution-name: name of the solution for consistency # - version-code: version of the package @@ -30,7 +30,7 @@ cdk_version=1.63.0 # Check to see if input has been provided: if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then echo "Please provide all required parameters for the build script" - echo "For example: ./build-s3-dist.sh solutions trademarked-solution-name v1.0.0" + echo "For example: ./build-s3-dist.sh solutions trademarked-solution-name v1.2.0" exit 1 fi @@ -71,6 +71,9 @@ npm install --production echo "------------------------------------------------------------------------------" echo "[Synth] CDK Project" echo "------------------------------------------------------------------------------" +# Make sure user has the newest CDK version +npm uninstall -g aws-cdk && npm install -g aws-cdk@1 + cd $source_dir/cdk npm install cdk synth --output=$staging_dist_dir diff --git a/deployment/run-unit-tests.sh b/deployment/run-unit-tests.sh index 100b301..0a7cb66 100755 --- a/deployment/run-unit-tests.sh +++ b/deployment/run-unit-tests.sh @@ -1,15 +1,73 @@ -cd ../source/cdk -npm install --silent -npm test +#!/bin/bash -cd ../custom-resource -npm install --silent -npm test +[ "$DEBUG" == 'true' ] && set -x +set -e -cd ../job-submit -npm install --silent -npm test +prepare_jest_coverage_report() { + local component_name=$1 -cd ../job-complete -npm install --silent -npm test + if [ ! -d "coverage" ]; then + echo "ValidationError: Missing required directory coverage after running unit tests" + exit 129 + fi + + # prepare coverage reports + rm -fr coverage/lcov-report + mkdir -p $coverage_reports_top_path/jest + coverage_report_path=$coverage_reports_top_path/jest/$component_name + rm -fr $coverage_report_path + mv coverage $coverage_report_path +} + +run_javascript_test() { + local component_path=$1 + local component_name=$2 + + echo "------------------------------------------------------------------------------" + echo "[Test] Run javascript unit test with coverage for $component_name" + echo "------------------------------------------------------------------------------" + echo "cd $component_path" + cd $component_path + + # install dependencies + npm install --silent + # run unit tests + npm test + + + + # prepare coverage reports + prepare_jest_coverage_report $component_name +} + +# Get reference for all important folders +template_dir="$PWD" +source_dir="$template_dir/../source" +coverage_reports_top_path=$source_dir/test/coverage-reports + +# Test the attached Lambda function +declare -a lambda_packages=( + "cdk" + "custom-resource" + "job-complete" + "job-submit" +) + +for lambda_package in "${lambda_packages[@]}" +do + rm -rf $source_dir/$lambda_package/coverage + mkdir $source_dir/$lambda_package/coverage + run_javascript_test $source_dir/$lambda_package $lambda_package + + # Check the result of the test and exit if a failure is identified + if [ $? -eq 0 ] + then + echo "Test for $lambda_package passed" + else + echo "******************************************************************************" + echo "Lambda test FAILED for $lambda_package" + echo "******************************************************************************" + exit 1 + fi + +done \ No newline at end of file diff --git a/source/cdk/bin/vod-foundation.ts b/source/cdk/bin/vod-foundation.ts index 05dbe54..8e549c7 100644 --- a/source/cdk/bin/vod-foundation.ts +++ b/source/cdk/bin/vod-foundation.ts @@ -4,4 +4,4 @@ import * as cdk from '@aws-cdk/core'; import { VodFoundation } from '../lib/vod-foundation-stack'; const app = new cdk.App(); -new VodFoundation(app, 'VodFoundation'); +new VodFoundation(app, 'VodFoundation'); // NOSONAR diff --git a/source/cdk/lib/vod-foundation-stack.ts b/source/cdk/lib/vod-foundation-stack.ts index 759a9d3..c70d2e1 100644 --- a/source/cdk/lib/vod-foundation-stack.ts +++ b/source/cdk/lib/vod-foundation-stack.ts @@ -4,6 +4,8 @@ import * as iam from '@aws-cdk/aws-iam'; import * as lambda from '@aws-cdk/aws-lambda'; import * as subs from '@aws-cdk/aws-sns-subscriptions'; import { HttpMethods } from '@aws-cdk/aws-s3'; +import * as appreg from '@aws-cdk/aws-servicecatalogappregistry'; +import * as applicationinsights from '@aws-cdk/aws-applicationinsights'; /** * AWS Solution Constructs: https://docs.aws.amazon.com/solutions/latest/constructs/ */ @@ -18,11 +20,13 @@ export class VodFoundation extends cdk.Stack { /** * CloudFormation Template Descrption */ - this.templateOptions.description = '(SO0146) v1.1.0: Video on Demand on AWS Foundation Solution Implementation'; + const solutionId = 'SO0146' + const solutionName = 'Video on Demand on AWS Foundation' + this.templateOptions.description = '(SO0146) v1.2.0: Video on Demand on AWS Foundation Solution Implementation'; /** * Mapping for sending anonymous metrics to AWS Solution Builders API */ - new cdk.CfnMapping(this, 'Send', { + new cdk.CfnMapping(this, 'Send', { // NOSONAR mapping: { AnonymousUsage: { Data: 'Yes' @@ -173,12 +177,14 @@ export class VodFoundation extends cdk.Stack { rules_to_suppress: [{ id: 'W58', reason: 'Invalid warning: function has access to cloudwatch' - },{ - id: 'W89', - reason: 'AWS Lambda does not require VPC for this solution.' - },{ - id: 'W92', - reason: 'ReservedConcurrentExecutions not required' + }, + { + id: 'W89', + reason: 'Invalid warning: lambda not needed in VPC' + }, + { + id: 'W92', + reason: 'Invalid warning: lambda does not need ReservedConcurrentExecutions' }] } }; @@ -237,13 +243,15 @@ export class VodFoundation extends cdk.Stack { rules_to_suppress: [{ id: 'W58', reason: 'Invalid warning: function has access to cloudwatch' - },{ + }, + { id: 'W89', - reason: 'AWS Lambda does not require VPC for this solution.' - },{ + reason: 'Invalid warning: lambda not needed in VPC' + }, + { id: 'W92', - reason: 'ReservedConcurrentExecutions not required' - }] + reason: 'Invalid warning: lambda does not need ReservedConcurrentExecutions' + }] } }; /** @@ -290,20 +298,22 @@ export class VodFoundation extends cdk.Stack { rules_to_suppress: [{ id: 'W58', reason: 'Invalid warning: function has access to cloudwatch' - },{ + }, + { id: 'W89', - reason: 'AWS Lambda does not require VPC for this solution.' - },{ + reason: 'Invalid warning: lambda not needed in VPC' + }, + { id: 'W92', - reason: 'ReservedConcurrentExecutions not required' - }] + reason: 'Invalid warning: lambda does not need ReservedConcurrentExecutions' + }] } }; /** * Custom resource to configure the source S3 bucket; upload default job-settings file and * enabble event notifications to trigger the job-submit lambda function */ - new cdk.CustomResource(this, 'S3Config', { + new cdk.CustomResource(this, 'S3Config', { // NOSONAR serviceToken: customResourceLambda.functionArn, properties: { SourceBucket: source.bucketName, @@ -314,7 +324,7 @@ export class VodFoundation extends cdk.Stack { * Solution constructs, creates a CloudWatch event rule to trigger the process * outputs lambda functions. */ - new EventsRuleToLambda(this, 'EventTrigger', { + new EventsRuleToLambda(this, 'EventTrigger', { // NOSONAR existingLambdaObj: jobComplete, eventRuleProps: { enabled: true, @@ -344,7 +354,7 @@ export class VodFoundation extends cdk.Stack { const snsTopic = new LambdaToSns(this, 'Notification', { existingLambdaObj: jobSubmit }); - new LambdaToSns(this, 'CompleteSNS', { + new LambdaToSns(this, 'CompleteSNS', { // NOSONAR existingLambdaObj: jobComplete, existingTopicObj: snsTopic.snsTopic }); @@ -352,25 +362,63 @@ export class VodFoundation extends cdk.Stack { * Subscribe the admin email address to the SNS topic created but the construct. */ snsTopic.snsTopic.addSubscription(new subs.EmailSubscription(adminEmail.valueAsString)) + + /** + * AppRegistry + */ + const applicationName = `vod-foundation-${cdk.Aws.STACK_NAME}`; + const attributeGroup = new appreg.AttributeGroup(this, 'AppRegistryAttributeGroup', { + attributeGroupName: cdk.Aws.STACK_NAME, + description: "Attribute group for solution information.", + attributes: { + ApplicationType: 'AWS-Solutions', + SolutionVersion: '%%VERSION%%', + SolutionID: solutionId, + SolutionName: solutionName + } + }); + const appRegistry = new appreg.Application(this, 'AppRegistryApp', { + applicationName: applicationName, + description: `Service Catalog application to track and manage all your resources. The SolutionId is ${solutionId} and SolutionVersion is %%VERSION%%.` + }); + appRegistry.associateStack(this); + cdk.Tags.of(appRegistry).add('solutionId', solutionId); + cdk.Tags.of(appRegistry).add('SolutionName', solutionName); + cdk.Tags.of(appRegistry).add('SolutionDomain', 'CloudFoundations'); + cdk.Tags.of(appRegistry).add('SolutionVersion', '%%VERSION%%'); + cdk.Tags.of(appRegistry).add('appRegistryApplicationName', 'vod-foundation-stack'); + cdk.Tags.of(appRegistry).add('ApplicationType', 'AWS-Solutions'); + + appRegistry.node.addDependency(attributeGroup); + appRegistry.associateAttributeGroup(attributeGroup); + + const appInsights = new applicationinsights.CfnApplication(this, 'ApplicationInsightsApp', { + resourceGroupName: `AWS_AppRegistry_Application-${applicationName}`, + autoConfigurationEnabled: true, + cweMonitorEnabled: true, + opsCenterEnabled: true + }); + appInsights.node.addDependency(appRegistry); + /** * Stack Outputs */ - new cdk.CfnOutput(this, 'SourceBucket', { + new cdk.CfnOutput(this, 'SourceBucket', { // NOSONAR value: source.bucketName, description: 'Source S3 Bucket used to host source video and MediaConvert job settings files', exportName: `${ cdk.Aws.STACK_NAME}-SourceBucket` }); - new cdk.CfnOutput(this, 'DestinationBucket', { + new cdk.CfnOutput(this, 'DestinationBucket', { // NOSONAR value: destination.bucketName, description: 'Source S3 Bucket used to host all MediaConvert ouputs', exportName: `${ cdk.Aws.STACK_NAME}-DestinationBucket` }); - new cdk.CfnOutput(this, 'CloudFrontDomain', { + new cdk.CfnOutput(this, 'CloudFrontDomain', { // NOSONAR value: cloudFront.cloudFrontWebDistribution.distributionDomainName, description: 'CloudFront Domain Name', exportName: `${ cdk.Aws.STACK_NAME}-CloudFrontDomain` }); - new cdk.CfnOutput(this, 'SnsTopic', { + new cdk.CfnOutput(this, 'SnsTopic', { // NOSONAR value: snsTopic.snsTopic.topicName, description: 'SNS Topic used to capture the VOD workflow outputs including errors', exportName: `${ cdk.Aws.STACK_NAME}-SnsTopic` diff --git a/source/cdk/package.json b/source/cdk/package.json index 78cef7d..6bf0c68 100644 --- a/source/cdk/package.json +++ b/source/cdk/package.json @@ -7,28 +7,30 @@ "scripts": { "build": "tsc", "watch": "tsc -w", - "test": "jest", + "test": "jest --coverage --updateSnapshot", "cdk": "cdk" }, "devDependencies": { - "@aws-cdk/assert": "1.110.0", + "@aws-cdk/assert": "1.173.0", "@types/jest": "^26.0.10", "@types/node": "10.17.27", - "aws-cdk": "^1.63.0", - "jest": "^26.4.2", - "ts-jest": "^26.2.0", + "aws-cdk": "^1.173.0", + "jest": "^26.6.3", + "ts-jest": "^26.5.6", "ts-node": "^8.1.0", - "typescript": "~3.9.7" + "typescript": "^3.9.10" }, "dependencies": { - "@aws-cdk/core": "1.110.0", - "@aws-cdk/aws-s3": "1.110.0", - "@aws-cdk/aws-iam": "1.110.0", - "@aws-cdk/aws-lambda": "1.110.0", - "@aws-cdk/aws-sns-subscriptions": "1.110.0", - "@aws-solutions-constructs/aws-cloudfront-s3": "1.110.0", - "@aws-solutions-constructs/aws-events-rule-lambda": "1.110.0", - "@aws-solutions-constructs/aws-lambda-sns": "1.110.0", + "@aws-cdk/core": "1.173.0", + "@aws-cdk/aws-s3": "1.173.0", + "@aws-cdk/aws-iam": "1.173.0", + "@aws-cdk/aws-lambda": "1.173.0", + "@aws-cdk/aws-servicecatalogappregistry": "1.173.0", + "@aws-cdk/aws-applicationinsights": "1.173.0", + "@aws-cdk/aws-sns-subscriptions": "1.173.0", + "@aws-solutions-constructs/aws-cloudfront-s3": "1.173.0", + "@aws-solutions-constructs/aws-events-rule-lambda": "1.173.0", + "@aws-solutions-constructs/aws-lambda-sns": "1.173.0", "source-map-support": "^0.5.16" } } diff --git a/source/cdk/tsconfig.json b/source/cdk/tsconfig.json index b42bdf3..7b568e9 100644 --- a/source/cdk/tsconfig.json +++ b/source/cdk/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "ES2018", "module": "commonjs", - "lib": ["es2018"], + "lib": ["es2018", "ES6"], "declaration": true, "strict": true, "noImplicitAny": true, @@ -21,5 +21,8 @@ "resolveJsonModule": true, "esModuleInterop": true }, - "exclude": ["cdk.out"] + "exclude": [ + "node_modules", + "cdk.out" + ] } \ No newline at end of file diff --git a/source/custom-resource/lib/cfn/index.js b/source/custom-resource/lib/cfn/index.js index 83abc5d..bff55a9 100644 --- a/source/custom-resource/lib/cfn/index.js +++ b/source/custom-resource/lib/cfn/index.js @@ -35,6 +35,7 @@ const sendResponse = async (event, context, responseStatus, responseData) => { data = await axios(params); } catch (err) { + console.error(err); throw err; } return data.status; diff --git a/source/custom-resource/lib/mediaconvert/index.js b/source/custom-resource/lib/mediaconvert/index.js index c672bea..72339d3 100644 --- a/source/custom-resource/lib/mediaconvert/index.js +++ b/source/custom-resource/lib/mediaconvert/index.js @@ -7,7 +7,6 @@ const options = { customUserAgent: process.env.SOLUTION_IDENTIFIER }; const AWS = require('aws-sdk'); -//AWS.config.logger = console; /** * Get MediaConvert API Endpoint for the account/region @@ -19,6 +18,7 @@ const getEndpoint = async () => { const data = await mediaconvert.describeEndpoints().promise(); endpoint = data.Endpoints[0].Url; } catch (err) { + console.error(err); throw err; } return endpoint; diff --git a/source/custom-resource/lib/s3/index.js b/source/custom-resource/lib/s3/index.js index 48d164d..16dbc4a 100644 --- a/source/custom-resource/lib/s3/index.js +++ b/source/custom-resource/lib/s3/index.js @@ -8,7 +8,6 @@ const options = { customUserAgent: process.env.SOLUTION_IDENTIFIER }; const AWS = require('aws-sdk'); const fs = require('fs'); -//AWS.config.logger = console; /** * Create Default configuration in the source S3 bucket @@ -28,10 +27,10 @@ const setDefaults = async (bucket) => { Key: 'jobs-manifest.json' }).promise(); } catch (err) { + console.error(err); throw err; } console.log('creating files complete') - return; }; /** @@ -338,9 +337,9 @@ const putNotification = async (bucket,lambdaArn) => { } }).promise(); } catch (err) { + console.error(err); throw err; } - return; }; diff --git a/source/custom-resource/package.json b/source/custom-resource/package.json index 0ac5a9f..dc488eb 100644 --- a/source/custom-resource/package.json +++ b/source/custom-resource/package.json @@ -7,7 +7,7 @@ "description": "cfn custom resources for video on demand", "main": "index.js", "scripts": { - "test": "jest --collect-coverage lib/**/*.spec.js" + "test": "jest --coverage" }, "dependencies": { "axios": "^0.21.1", @@ -15,7 +15,7 @@ }, "devDependencies": { "aws-sdk": "^2.609.0", - "jest": "^26.4.2" + "jest": "^26.6.3" }, "private": true, "author": { diff --git a/source/job-complete/jest.config.js b/source/job-complete/jest.config.js new file mode 100644 index 0000000..d08f50f --- /dev/null +++ b/source/job-complete/jest.config.js @@ -0,0 +1,6 @@ +module.exports = { + roots: ['/lib'], + testMatch: ['**/*.spec.js'], + coveragePathIgnorePatterns: ['/lib/utils.test.js'], + coverageReporters: [['lcov', { projectRoot: '../' }], 'text'] +}; diff --git a/source/job-complete/lib/utils.js b/source/job-complete/lib/utils.js index b2e5cdd..9e2d034 100644 --- a/source/job-complete/lib/utils.js +++ b/source/job-complete/lib/utils.js @@ -120,6 +120,7 @@ const processJobDetails = async (endpoint,cloudfrontUrl,data) => { if (jobDetails.Outputs[output] < 1) delete jobDetails.Outputs[output]; } } catch (err) { + console.error(err); throw err; } console.log(`JOB DETAILS:: ${JSON.stringify(jobDetails, null, 2)}`); @@ -176,9 +177,9 @@ const sendSns = async (topic,stackName,status,data) => { Subject: `${stackName}: Job ${status} id:${id}`, }).promise(); } catch (err) { + console.error(err); throw err; } - return; }; /** @@ -232,7 +233,6 @@ const sendMetrics = async (solutionId,version,uuid,results) => { } catch (err) { console.log(err); } - return; }; diff --git a/source/job-complete/package.json b/source/job-complete/package.json index 18bc619..fd4dc12 100644 --- a/source/job-complete/package.json +++ b/source/job-complete/package.json @@ -7,7 +7,7 @@ "description": "cfn custom resources for video on demand", "main": "index.js", "scripts": { - "test": "jest --collect-coverage lib/*.spec.js" + "test": "jest --coverage" }, "dependencies": { "axios": "^0.21.1", @@ -16,7 +16,7 @@ }, "devDependencies": { "aws-sdk": "^2.609.0", - "jest": "^26.4.2" + "jest": "^26.6.3" }, "private": true, "author": { diff --git a/source/job-submit/jest.config.js b/source/job-submit/jest.config.js new file mode 100644 index 0000000..0fbfe62 --- /dev/null +++ b/source/job-submit/jest.config.js @@ -0,0 +1,5 @@ +module.exports = { + roots: ['/lib'], + testMatch: ['**/*.spec.js'], + coverageReporters: [['lcov', { projectRoot: '../' }], 'text'] +}; diff --git a/source/job-submit/lib/utils.js b/source/job-submit/lib/utils.js index cfca7ff..c24684f 100644 --- a/source/job-submit/lib/utils.js +++ b/source/job-submit/lib/utils.js @@ -124,9 +124,9 @@ const createJob = async (job, endpoint) => { await mediaconvert.createJob(job).promise(); console.log(`job subbmited to MediaConvert:: ${JSON.stringify(job, null, 2)}`); } catch (err) { + console.error(err); throw err; } - return; }; @@ -149,9 +149,9 @@ const sendError = async (topic,stackName,logGroupName,err) => { Subject: `${stackName}: Encoding Job Submit Failed`, }).promise(); } catch (err) { + console.error(err); throw err; } - return; }; diff --git a/source/job-submit/package.json b/source/job-submit/package.json index 44f7a35..95164b4 100644 --- a/source/job-submit/package.json +++ b/source/job-submit/package.json @@ -7,7 +7,7 @@ "description": "cfn custom resources for video on demand", "main": "index.js", "scripts": { - "test": "jest --collect-coverage lib/*.spec.js" + "test": "jest --coverage" }, "dependencies": { "lodash": "*", @@ -15,7 +15,7 @@ }, "devDependencies": { "aws-sdk": "^2.609.0", - "jest": "^26.4.2" + "jest": "^26.6.3" }, "private": true, "author": { diff --git a/source/test/coverage-reports/jest/cdk/clover.xml b/source/test/coverage-reports/jest/cdk/clover.xml new file mode 100644 index 0000000..7f280ce --- /dev/null +++ b/source/test/coverage-reports/jest/cdk/clover.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/test/coverage-reports/jest/cdk/coverage-final.json b/source/test/coverage-reports/jest/cdk/coverage-final.json new file mode 100644 index 0000000..0b8c809 --- /dev/null +++ b/source/test/coverage-reports/jest/cdk/coverage-final.json @@ -0,0 +1,2 @@ +{"/codebuild/output/src926407134/src/source/cdk/lib/vod-foundation-stack.ts": {"path":"/codebuild/output/src926407134/src/source/cdk/lib/vod-foundation-stack.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":38}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":40}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":46}},"4":{"start":{"line":5,"column":0},"end":{"line":5,"column":55}},"5":{"start":{"line":6,"column":0},"end":{"line":6,"column":46}},"6":{"start":{"line":7,"column":0},"end":{"line":7,"column":65}},"7":{"start":{"line":8,"column":0},"end":{"line":8,"column":72}},"8":{"start":{"line":12,"column":0},"end":{"line":12,"column":77}},"9":{"start":{"line":13,"column":0},"end":{"line":13,"column":86}},"10":{"start":{"line":14,"column":0},"end":{"line":14,"column":71}},"11":{"start":{"line":19,"column":8},"end":{"line":19,"column":32}},"12":{"start":{"line":23,"column":27},"end":{"line":23,"column":35}},"13":{"start":{"line":24,"column":29},"end":{"line":24,"column":64}},"14":{"start":{"line":25,"column":8},"end":{"line":25,"column":120}},"15":{"start":{"line":29,"column":8},"end":{"line":35,"column":11}},"16":{"start":{"line":39,"column":27},"end":{"line":43,"column":10}},"17":{"start":{"line":47,"column":27},"end":{"line":51,"column":10}},"18":{"start":{"line":55,"column":30},"end":{"line":55,"column":83}},"19":{"start":{"line":56,"column":8},"end":{"line":66,"column":10}},"20":{"start":{"line":70,"column":23},"end":{"line":76,"column":10}},"21":{"start":{"line":77,"column":26},"end":{"line":77,"column":75}},"22":{"start":{"line":78,"column":8},"end":{"line":85,"column":10}},"23":{"start":{"line":89,"column":28},"end":{"line":103,"column":10}},"24":{"start":{"line":109,"column":27},"end":{"line":129,"column":10}},"25":{"start":{"line":134,"column":33},"end":{"line":136,"column":10}},"26":{"start":{"line":137,"column":35},"end":{"line":148,"column":10}},"27":{"start":{"line":149,"column":8},"end":{"line":149,"column":58}},"28":{"start":{"line":153,"column":37},"end":{"line":172,"column":10}},"29":{"start":{"line":174,"column":34},"end":{"line":174,"column":103}},"30":{"start":{"line":175,"column":8},"end":{"line":190,"column":10}},"31":{"start":{"line":194,"column":39},"end":{"line":196,"column":10}},"32":{"start":{"line":201,"column":26},"end":{"line":232,"column":10}},"33":{"start":{"line":234,"column":8},"end":{"line":238,"column":11}},"34":{"start":{"line":240,"column":29},"end":{"line":240,"column":87}},"35":{"start":{"line":241,"column":8},"end":{"line":256,"column":10}},"36":{"start":{"line":264,"column":28},"end":{"line":294,"column":10}},"37":{"start":{"line":295,"column":31},"end":{"line":295,"column":91}},"38":{"start":{"line":296,"column":8},"end":{"line":311,"column":10}},"39":{"start":{"line":316,"column":8},"end":{"line":322,"column":11}},"40":{"start":{"line":327,"column":8},"end":{"line":348,"column":11}},"41":{"start":{"line":354,"column":25},"end":{"line":356,"column":10}},"42":{"start":{"line":357,"column":8},"end":{"line":360,"column":11}},"43":{"start":{"line":364,"column":8},"end":{"line":364,"column":null}},"44":{"start":{"line":369,"column":32},"end":{"line":369,"column":70}},"45":{"start":{"line":370,"column":31},"end":{"line":379,"column":10}},"46":{"start":{"line":380,"column":28},"end":{"line":383,"column":10}},"47":{"start":{"line":384,"column":8},"end":{"line":384,"column":41}},"48":{"start":{"line":385,"column":8},"end":{"line":385,"column":63}},"49":{"start":{"line":386,"column":8},"end":{"line":386,"column":67}},"50":{"start":{"line":387,"column":8},"end":{"line":387,"column":75}},"51":{"start":{"line":388,"column":8},"end":{"line":388,"column":71}},"52":{"start":{"line":389,"column":8},"end":{"line":389,"column":91}},"53":{"start":{"line":390,"column":8},"end":{"line":390,"column":73}},"54":{"start":{"line":392,"column":8},"end":{"line":392,"column":55}},"55":{"start":{"line":393,"column":8},"end":{"line":393,"column":60}},"56":{"start":{"line":395,"column":28},"end":{"line":400,"column":10}},"57":{"start":{"line":401,"column":8},"end":{"line":401,"column":52}},"58":{"start":{"line":406,"column":8},"end":{"line":410,"column":11}},"59":{"start":{"line":411,"column":8},"end":{"line":415,"column":11}},"60":{"start":{"line":416,"column":8},"end":{"line":420,"column":11}},"61":{"start":{"line":421,"column":8},"end":{"line":425,"column":11}},"62":{"start":{"line":17,"column":0},"end":{"line":17,"column":13}}},"fnMap":{"0":{"name":"(anonymous_6)","decl":{"start":{"line":18,"column":4},"end":{"line":18,"column":16}},"loc":{"start":{"line":18,"column":72},"end":{"line":426,"column":5}}}},"branchMap":{},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1,"11":1,"12":1,"13":1,"14":1,"15":1,"16":1,"17":1,"18":1,"19":1,"20":1,"21":1,"22":1,"23":1,"24":1,"25":1,"26":1,"27":1,"28":1,"29":1,"30":1,"31":1,"32":1,"33":1,"34":1,"35":1,"36":1,"37":1,"38":1,"39":1,"40":1,"41":1,"42":1,"43":1,"44":1,"45":1,"46":1,"47":1,"48":1,"49":1,"50":1,"51":1,"52":1,"53":1,"54":1,"55":1,"56":1,"57":1,"58":1,"59":1,"60":1,"61":1,"62":1},"f":{"0":1},"b":{}} +} diff --git a/source/test/coverage-reports/jest/cdk/lcov.info b/source/test/coverage-reports/jest/cdk/lcov.info new file mode 100644 index 0000000..287fa78 --- /dev/null +++ b/source/test/coverage-reports/jest/cdk/lcov.info @@ -0,0 +1,74 @@ +TN: +SF:lib/vod-foundation-stack.ts +FN:18,(anonymous_6) +FNF:1 +FNH:1 +FNDA:1,(anonymous_6) +DA:1,1 +DA:2,1 +DA:3,1 +DA:4,1 +DA:5,1 +DA:6,1 +DA:7,1 +DA:8,1 +DA:12,1 +DA:13,1 +DA:14,1 +DA:17,1 +DA:19,1 +DA:23,1 +DA:24,1 +DA:25,1 +DA:29,1 +DA:39,1 +DA:47,1 +DA:55,1 +DA:56,1 +DA:70,1 +DA:77,1 +DA:78,1 +DA:89,1 +DA:109,1 +DA:134,1 +DA:137,1 +DA:149,1 +DA:153,1 +DA:174,1 +DA:175,1 +DA:194,1 +DA:201,1 +DA:234,1 +DA:240,1 +DA:241,1 +DA:264,1 +DA:295,1 +DA:296,1 +DA:316,1 +DA:327,1 +DA:354,1 +DA:357,1 +DA:364,1 +DA:369,1 +DA:370,1 +DA:380,1 +DA:384,1 +DA:385,1 +DA:386,1 +DA:387,1 +DA:388,1 +DA:389,1 +DA:390,1 +DA:392,1 +DA:393,1 +DA:395,1 +DA:401,1 +DA:406,1 +DA:411,1 +DA:416,1 +DA:421,1 +LF:63 +LH:63 +BRF:0 +BRH:0 +end_of_record diff --git a/source/test/coverage-reports/jest/custom-resource/clover.xml b/source/test/coverage-reports/jest/custom-resource/clover.xml new file mode 100644 index 0000000..7a741d2 --- /dev/null +++ b/source/test/coverage-reports/jest/custom-resource/clover.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/test/coverage-reports/jest/custom-resource/coverage-final.json b/source/test/coverage-reports/jest/custom-resource/coverage-final.json new file mode 100644 index 0000000..da07d55 --- /dev/null +++ b/source/test/coverage-reports/jest/custom-resource/coverage-final.json @@ -0,0 +1,4 @@ +{"/codebuild/output/src926407134/src/source/custom-resource/lib/cfn/index.js": {"path":"/codebuild/output/src926407134/src/source/custom-resource/lib/cfn/index.js","statementMap":{"0":{"start":{"line":5,"column":14},"end":{"line":5,"column":30}},"1":{"start":{"line":10,"column":21},"end":{"line":42,"column":1}},"2":{"start":{"line":13,"column":2},"end":{"line":40,"column":5}},"3":{"start":{"line":14,"column":25},"end":{"line":23,"column":6}},"4":{"start":{"line":25,"column":19},"end":{"line":34,"column":5}},"5":{"start":{"line":36,"column":8},"end":{"line":36,"column":35}},"6":{"start":{"line":38,"column":8},"end":{"line":38,"column":27}},"7":{"start":{"line":39,"column":8},"end":{"line":39,"column":18}},"8":{"start":{"line":41,"column":4},"end":{"line":41,"column":23}},"9":{"start":{"line":44,"column":0},"end":{"line":46,"column":2}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":10,"column":21},"end":{"line":10,"column":22}},"loc":{"start":{"line":10,"column":77},"end":{"line":42,"column":1}},"line":10}},"branchMap":{},"s":{"0":1,"1":1,"2":2,"3":2,"4":2,"5":2,"6":1,"7":1,"8":1,"9":1},"f":{"0":2},"b":{},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"63115191ac1a6207089c5ce70b9463313d97f279"} +,"/codebuild/output/src926407134/src/source/custom-resource/lib/mediaconvert/index.js": {"path":"/codebuild/output/src926407134/src/source/custom-resource/lib/mediaconvert/index.js","statementMap":{"0":{"start":{"line":7,"column":16},"end":{"line":7,"column":68}},"1":{"start":{"line":8,"column":12},"end":{"line":8,"column":30}},"2":{"start":{"line":14,"column":20},"end":{"line":25,"column":1}},"3":{"start":{"line":16,"column":4},"end":{"line":23,"column":5}},"4":{"start":{"line":17,"column":29},"end":{"line":17,"column":58}},"5":{"start":{"line":18,"column":21},"end":{"line":18,"column":69}},"6":{"start":{"line":19,"column":8},"end":{"line":19,"column":41}},"7":{"start":{"line":21,"column":8},"end":{"line":21,"column":27}},"8":{"start":{"line":22,"column":8},"end":{"line":22,"column":18}},"9":{"start":{"line":24,"column":4},"end":{"line":24,"column":20}},"10":{"start":{"line":28,"column":0},"end":{"line":30,"column":2}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":14,"column":20},"end":{"line":14,"column":21}},"loc":{"start":{"line":14,"column":32},"end":{"line":25,"column":1}},"line":14}},"branchMap":{},"s":{"0":1,"1":1,"2":1,"3":2,"4":2,"5":2,"6":1,"7":1,"8":1,"9":1,"10":1},"f":{"0":2},"b":{},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"09e6f7f8b614054a06fb49c4fac9baeee5bb7cd9"} +,"/codebuild/output/src926407134/src/source/custom-resource/lib/s3/index.js": {"path":"/codebuild/output/src926407134/src/source/custom-resource/lib/s3/index.js","statementMap":{"0":{"start":{"line":7,"column":16},"end":{"line":7,"column":68}},"1":{"start":{"line":8,"column":12},"end":{"line":8,"column":30}},"2":{"start":{"line":9,"column":11},"end":{"line":9,"column":24}},"3":{"start":{"line":15,"column":20},"end":{"line":34,"column":1}},"4":{"start":{"line":16,"column":4},"end":{"line":16,"column":33}},"5":{"start":{"line":17,"column":4},"end":{"line":32,"column":5}},"6":{"start":{"line":18,"column":19},"end":{"line":18,"column":38}},"7":{"start":{"line":19,"column":8},"end":{"line":23,"column":21}},"8":{"start":{"line":24,"column":8},"end":{"line":28,"column":21}},"9":{"start":{"line":30,"column":8},"end":{"line":30,"column":27}},"10":{"start":{"line":31,"column":8},"end":{"line":31,"column":18}},"11":{"start":{"line":33,"column":4},"end":{"line":33,"column":42}},"12":{"start":{"line":39,"column":24},"end":{"line":343,"column":1}},"13":{"start":{"line":41,"column":4},"end":{"line":342,"column":5}},"14":{"start":{"line":42,"column":19},"end":{"line":42,"column":38}},"15":{"start":{"line":44,"column":8},"end":{"line":338,"column":21}},"16":{"start":{"line":340,"column":8},"end":{"line":340,"column":27}},"17":{"start":{"line":341,"column":8},"end":{"line":341,"column":18}},"18":{"start":{"line":346,"column":0},"end":{"line":349,"column":2}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":15,"column":20},"end":{"line":15,"column":21}},"loc":{"start":{"line":15,"column":38},"end":{"line":34,"column":1}},"line":15},"1":{"name":"(anonymous_1)","decl":{"start":{"line":39,"column":24},"end":{"line":39,"column":25}},"loc":{"start":{"line":39,"column":52},"end":{"line":343,"column":1}},"line":39}},"branchMap":{},"s":{"0":1,"1":1,"2":1,"3":1,"4":2,"5":2,"6":2,"7":2,"8":1,"9":1,"10":1,"11":1,"12":1,"13":2,"14":2,"15":2,"16":1,"17":1,"18":1},"f":{"0":2,"1":2},"b":{},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"2f28ec3fd46606cd8067113b51af4672ca95dccb"} +} diff --git a/source/test/coverage-reports/jest/custom-resource/lcov.info b/source/test/coverage-reports/jest/custom-resource/lcov.info new file mode 100644 index 0000000..6b8cb6f --- /dev/null +++ b/source/test/coverage-reports/jest/custom-resource/lcov.info @@ -0,0 +1,75 @@ +TN: +SF:lib/cfn/index.js +FN:10,(anonymous_0) +FNF:1 +FNH:1 +FNDA:2,(anonymous_0) +DA:5,1 +DA:10,1 +DA:13,2 +DA:14,2 +DA:25,2 +DA:36,2 +DA:38,1 +DA:39,1 +DA:41,1 +DA:44,1 +LF:10 +LH:10 +BRF:0 +BRH:0 +end_of_record +TN: +SF:lib/mediaconvert/index.js +FN:14,(anonymous_0) +FNF:1 +FNH:1 +FNDA:2,(anonymous_0) +DA:7,1 +DA:8,1 +DA:14,1 +DA:16,2 +DA:17,2 +DA:18,2 +DA:19,1 +DA:21,1 +DA:22,1 +DA:24,1 +DA:28,1 +LF:11 +LH:11 +BRF:0 +BRH:0 +end_of_record +TN: +SF:lib/s3/index.js +FN:15,(anonymous_0) +FN:39,(anonymous_1) +FNF:2 +FNH:2 +FNDA:2,(anonymous_0) +FNDA:2,(anonymous_1) +DA:7,1 +DA:8,1 +DA:9,1 +DA:15,1 +DA:16,2 +DA:17,2 +DA:18,2 +DA:19,2 +DA:24,1 +DA:30,1 +DA:31,1 +DA:33,1 +DA:39,1 +DA:41,2 +DA:42,2 +DA:44,2 +DA:340,1 +DA:341,1 +DA:346,1 +LF:19 +LH:19 +BRF:0 +BRH:0 +end_of_record diff --git a/source/test/coverage-reports/jest/job-complete/lcov.info b/source/test/coverage-reports/jest/job-complete/lcov.info new file mode 100644 index 0000000..9710f85 --- /dev/null +++ b/source/test/coverage-reports/jest/job-complete/lcov.info @@ -0,0 +1,127 @@ +TN: +SF:job-complete/lib/utils.js +FN:13,(anonymous_0) +FN:44,(anonymous_1) +FN:75,(anonymous_2) +FN:77,(anonymous_3) +FN:103,(anonymous_4) +FN:110,(anonymous_5) +FN:134,(anonymous_6) +FN:190,(anonymous_7) +FN:204,(anonymous_8) +FN:205,(anonymous_9) +FNF:10 +FNH:10 +FNDA:3,(anonymous_0) +FNDA:1,(anonymous_1) +FNDA:2,(anonymous_2) +FNDA:6,(anonymous_3) +FNDA:4,(anonymous_4) +FNDA:4,(anonymous_5) +FNDA:3,(anonymous_6) +FNDA:2,(anonymous_7) +FNDA:8,(anonymous_8) +FNDA:42,(anonymous_9) +DA:5,1 +DA:6,1 +DA:7,1 +DA:13,1 +DA:15,3 +DA:16,3 +DA:17,3 +DA:21,3 +DA:25,2 +DA:27,2 +DA:32,1 +DA:33,1 +DA:43,1 +DA:44,1 +DA:45,1 +DA:46,1 +DA:47,1 +DA:48,1 +DA:49,1 +DA:51,0 +DA:52,0 +DA:55,2 +DA:61,1 +DA:67,2 +DA:75,1 +DA:76,2 +DA:77,6 +DA:78,2 +DA:82,2 +DA:84,2 +DA:85,2 +DA:87,1 +DA:103,1 +DA:104,4 +DA:105,2 +DA:107,2 +DA:108,0 +DA:110,2 +DA:111,4 +DA:119,1 +DA:120,6 +DA:123,1 +DA:124,1 +DA:126,1 +DA:127,1 +DA:134,1 +DA:135,3 +DA:138,3 +DA:141,3 +DA:146,1 +DA:147,1 +DA:153,1 +DA:159,1 +DA:160,1 +DA:164,1 +DA:169,1 +DA:170,1 +DA:171,1 +DA:173,3 +DA:174,3 +DA:180,1 +DA:181,1 +DA:190,1 +DA:191,2 +DA:192,2 +DA:193,2 +DA:194,2 +DA:195,2 +DA:196,2 +DA:197,2 +DA:204,2 +DA:205,8 +DA:206,42 +DA:207,2 +DA:214,2 +DA:222,2 +DA:231,2 +DA:232,2 +DA:234,1 +DA:240,1 +LF:80 +LH:77 +BRDA:27,0,0,1 +BRDA:27,0,1,1 +BRDA:45,1,0,1 +BRDA:45,1,1,0 +BRDA:104,2,0,2 +BRDA:104,2,1,2 +BRDA:107,3,0,0 +BRDA:107,3,1,2 +BRDA:120,4,0,3 +BRDA:120,4,1,3 +BRDA:141,5,0,1 +BRDA:141,5,1,0 +BRDA:141,5,2,1 +BRDA:141,5,3,1 +BRDA:169,6,0,1 +BRDA:169,6,1,0 +BRDA:206,7,0,2 +BRDA:206,7,1,40 +BRF:18 +BRH:14 +end_of_record diff --git a/source/test/coverage-reports/jest/job-submit/lcov.info b/source/test/coverage-reports/jest/job-submit/lcov.info new file mode 100644 index 0000000..c9a6fd1 --- /dev/null +++ b/source/test/coverage-reports/jest/job-submit/lcov.info @@ -0,0 +1,104 @@ +TN: +SF:job-submit/lib/utils.js +FN:10,(anonymous_0) +FN:44,(anonymous_1) +FN:46,(anonymous_2) +FN:118,(anonymous_3) +FN:136,(anonymous_4) +FNF:5 +FNH:5 +FNDA:3,(anonymous_0) +FNDA:2,(anonymous_1) +FNDA:10,(anonymous_2) +FNDA:2,(anonymous_3) +FNDA:2,(anonymous_4) +DA:5,1 +DA:10,1 +DA:11,3 +DA:13,3 +DA:17,3 +DA:18,3 +DA:22,2 +DA:27,2 +DA:28,1 +DA:31,2 +DA:36,1 +DA:44,1 +DA:45,2 +DA:46,2 +DA:47,10 +DA:48,10 +DA:49,10 +DA:50,5 +DA:52,5 +DA:54,10 +DA:56,0 +DA:59,2 +DA:60,2 +DA:61,2 +DA:62,2 +DA:63,2 +DA:64,2 +DA:65,2 +DA:66,2 +DA:67,2 +DA:68,10 +DA:70,2 +DA:71,2 +DA:73,2 +DA:74,2 +DA:76,2 +DA:77,2 +DA:79,2 +DA:80,2 +DA:82,2 +DA:83,2 +DA:85,0 +DA:91,2 +DA:92,2 +DA:94,2 +DA:98,2 +DA:99,0 +DA:105,2 +DA:107,0 +DA:112,2 +DA:118,1 +DA:119,2 +DA:123,2 +DA:124,2 +DA:125,1 +DA:127,1 +DA:128,1 +DA:136,1 +DA:137,2 +DA:138,2 +DA:141,2 +DA:142,2 +DA:146,2 +DA:152,1 +DA:153,1 +DA:158,1 +LF:66 +LH:62 +BRDA:27,0,0,1 +BRDA:27,0,1,1 +BRDA:27,1,0,2 +BRDA:27,1,1,1 +BRDA:27,1,2,0 +BRDA:49,2,0,5 +BRDA:49,2,1,5 +BRDA:68,3,0,2 +BRDA:68,3,1,2 +BRDA:68,3,2,2 +BRDA:68,3,3,2 +BRDA:68,3,4,2 +BRDA:68,3,5,0 +BRDA:91,4,0,2 +BRDA:91,4,1,0 +BRDA:98,5,0,0 +BRDA:98,5,1,2 +BRDA:98,6,0,2 +BRDA:98,6,1,0 +BRF:19 +BRH:14 +end_of_record