From 54889cd1e678e0418dd941141440b86d1498e672 Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Mon, 26 Mar 2018 15:01:31 -0400 Subject: [PATCH 01/14] Update lambda.js for activities --- packages/integration-tests/index.js | 3 +- packages/integration-tests/lambda.js | 200 +++++++++++++++++---------- 2 files changed, 132 insertions(+), 71 deletions(-) diff --git a/packages/integration-tests/index.js b/packages/integration-tests/index.js index b8a731f0633..e1d3353bf16 100644 --- a/packages/integration-tests/index.js +++ b/packages/integration-tests/index.js @@ -161,5 +161,6 @@ async function testWorkflow(stackName, bucketName, workflowName, inputFile) { module.exports = { testWorkflow, executeWorkflow, - getLambdaOutput: lambda.getLambdaOutput + ActivityStep: lambda.ActivityStep, + LambdaStep: lambda.LambdaStep }; diff --git a/packages/integration-tests/lambda.js b/packages/integration-tests/lambda.js index de454dab22a..f5fad9d17c3 100644 --- a/packages/integration-tests/lambda.js +++ b/packages/integration-tests/lambda.js @@ -2,88 +2,148 @@ const { sfn } = require('@cumulus/common/aws'); -const lambdaScheduleEvents = [ - 'LambdaFunctionScheduled', - 'LambdaFunctionScheduleFailed' -]; - -const lambdaStartedEvents = [ - 'LambdaFunctionStartFailed', - 'LambdaFunctionStarted' -]; - -const lambdaCompletedEvents = [ - 'LambdaFunctionFailed', - 'LambdaFunctionSucceeded', - 'LambdaFunctionTimedOut' -]; +class SfnStep { + getStartEvent(executionHistory, scheduleEvent) { + return executionHistory.events.find((event) => { + const isStartEvent = this.startEvents.includes(event.type); + const previousEventIsScheduleEvent = event.previousEventId === scheduleEvent.id; + return isStartEvent && previousEventIsScheduleEvent; + }); + } -/** - * Get the events for the lambda execution for the given workflow execution. - * This function currently assumes one execution of the given lambda per workflow. - * - * @param {string} workflowExecutionArn - Arn of the workflow execution - * @param {string} lambdaName - name of the lambda - * @returns {Object} an object containing a schedule event, start event, and complete - * event if exist, null if cannot find the lambda - */ -async function getLambdaExecution(workflowExecutionArn, lambdaName) { - const executionHistory = ( - await sfn().getExecutionHistory({ executionArn: workflowExecutionArn }).promise() - ); - - // Get the event where the lambda was scheduled - const scheduleEvent = executionHistory.events.find((event) => ( - lambdaScheduleEvents.includes(event.type)) && - (event.lambdaFunctionScheduledEventDetails.resource.includes(lambdaName)) - ); - - if (scheduleEvent === null) { - console.log(`Could not find lambda ${lambdaName} in execution.`); - return null; + getCompletedEvent(executionHistory, startEvent) { + return executionHistory.events.find((event) => { + const isCompletionEvent = this.completionEvents.includes(event.type); + const previousEventIsStartEvent = event.previousEventId === startEvent.id; + return isCompletionEvent && previousEventIsStartEvent; + }); } - let startEvent = null; - let completeEvent = null; + /** + * Get the events for the lambda execution for the given workflow execution. + * This function currently assumes one execution of the given lambda per workflow. + * + * @param {string} workflowExecutionArn - Arn of the workflow execution + * @param {string} lambdaName - name of the lambda + * @returns {Object} an object containing a schedule event, start event, and complete + * event if exist, null if cannot find the lambda + */ + async getLambdaExecution(workflowExecutionArn, lambdaName) { + const executionHistory = ( + await sfn().getExecutionHistory({ executionArn: workflowExecutionArn }).promise() + ); + + // Get the event where the lambda was scheduled + const scheduleEvent = executionHistory.events.find((event) => { + const eventScheduled = this.scheduleEvents.includes(event.type); + const eventDetails = event[this.eventDetailsKeys.scheduled]; + const isStepEvent = eventDetails && eventDetails.resource.includes(lambdaName); + return eventScheduled && isStepEvent; + }); + + if (scheduleEvent === null || scheduleEvent === undefined) { + console.log(`Could not find lambda ${lambdaName} in execution.`); + return null; + } + + let startEvent = null; + let completeEvent = null; - if (scheduleEvent.type !== 'LambdaFunctionScheduleFailed') { - startEvent = executionHistory.events.find((event) => - (lambdaStartedEvents.includes(event.type)) && - (event.previousEventId === scheduleEvent.id)); + if (scheduleEvent.type !== this.startFailedEvent) { + startEvent = this.getStartEvent(executionHistory, scheduleEvent, this); - if (startEvent !== null && startEvent.type !== 'LambdaFunctionStartFailed') { - completeEvent = executionHistory.events.find((event) => - (lambdaCompletedEvents.includes(event.type)) && - (event.previousEventId === startEvent.id)); + if (startEvent !== null && startEvent.type !== this.startFailedEvent) { + completeEvent = this.getCompletedEvent(executionHistory, startEvent, this); + } } + + return { scheduleEvent, startEvent, completeEvent }; } - return { scheduleEvent, startEvent, completeEvent }; -} + /** + * Get the output payload from the lambda, if the lambda succeeds + * + * @param {string} workflowExecutionArn - Arn of the workflow execution + * @param {string} lambdaName - name of the lambda + * @returns {Object} object containing the payload, null if error + */ + async getLambdaOutput(workflowExecutionArn, lambdaName) { + const lambdaExecution = await this.getLambdaExecution(workflowExecutionArn, lambdaName, this); + + if (lambdaExecution === null) { + console.log(`Could not find lambda ${lambdaName} in execution.`); + return null; + } + + if (lambdaExecution.completeEvent === null || + lambdaExecution.completeEvent.type !== this.successEvent) { + console.log(`Lambda ${lambdaName} was not successful.`); + return null; + } -/** - * Get the output payload from the lambda, if the lambda succeeds - * - * @param {string} workflowExecutionArn - Arn of the workflow execution - * @param {string} lambdaName - name of the lambda - * @returns {Object} object containing the payload, null if error - */ -async function getLambdaOutput(workflowExecutionArn, lambdaName) { - const lambdaExecution = await getLambdaExecution(workflowExecutionArn, lambdaName); - - if (lambdaExecution === null) { - console.log(`Could not find lambda ${lambdaName} in execution.`); - return null; + const succeededDetails = JSON.parse(lambdaExecution.completeEvent[this.eventDetailsKeys.succeeded].output.toString()); + return succeededDetails; } +}; + +const lambdaCompletedEvents = [ + 'LambdaFunctionFailed', + 'LambdaFunctionSucceeded', + 'LambdaFunctionTimedOut' +]; - if (lambdaExecution.completeEvent === null || - lambdaExecution.completeEvent.type !== 'LambdaFunctionSucceeded') { - console.log(`Lambda ${lambdaName} was not successful.`); - return null; +class LambdaStep extends SfnStep { + constructor() { + super(); + this.scheduleFailedEvent = 'LambdaFunctionScheduleFailed'; + this.scheduleEvents = [ + this.scheduleFailedEvent, + 'LambdaFunctionScheduled' + ]; + this.startFailedEvent = 'LambdaFunctionStartFailed'; + this.startEvents = [ + this.startFailedEvent, + 'LambdaFunctionStarted' + ]; + this.successEvent = 'LambdaFunctionSucceeded'; + this.completionEvents = [ + this.successEvent, + 'LambdaFunctionFailed', + 'LambdaFunctionTimedOut' + ]; + this.eventDetailsKeys = { + scheduled: 'lambdaFunctionScheduledEventDetails', + succeeded: 'lambdaFunctionSucceededEventDetails' + }; } +} - const succeededDetails = JSON.parse(lambdaExecution.completeEvent.lambdaFunctionSucceededEventDetails.output.toString()); - return succeededDetails; +class ActivityStep extends SfnStep { + constructor() { + super(); + this.scheduleFailedEvent = 'ActivityScheduleFailed'; + this.scheduleEvents = [ + 'ActivityScheduled', + this.scheduleFailedEvent + ]; + this.startEvents = [ + 'ActivityStarted' // there is no 'ActivityStartFailed' + ]; + this.startFailedEvent = undefined, + this.successEvent = 'ActivitySucceeded'; + this.completionEvents = [ + this.successEvent, + 'ActivityFailed', + 'ActivityTimedOut' + ]; + this.eventDetailsKeys = { + scheduled: 'activityScheduledEventDetails', + succeeded: 'activitySucceededEventDetails' + }; + } } -exports.getLambdaOutput = getLambdaOutput; +module.exports = { + ActivityStep, + LambdaStep +}; From 903c78cd27b4c151493bd168118c1ecb7f89595b Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Mon, 26 Mar 2018 15:05:26 -0400 Subject: [PATCH 02/14] Rename lambda module to sfnStep --- packages/integration-tests/index.js | 6 ++-- .../{lambda.js => sfnStep.js} | 36 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) rename packages/integration-tests/{lambda.js => sfnStep.js} (77%) diff --git a/packages/integration-tests/index.js b/packages/integration-tests/index.js index e1d3353bf16..b156c1ecebc 100644 --- a/packages/integration-tests/index.js +++ b/packages/integration-tests/index.js @@ -3,7 +3,7 @@ const uuidv4 = require('uuid/v4'); const fs = require('fs-extra'); const { s3, sfn } = require('@cumulus/common/aws'); -const lambda = require('./lambda'); +const sfnStep = require('./sfnStep'); const executionStatusNumRetries = 20; const waitPeriodMs = 5000; @@ -161,6 +161,6 @@ async function testWorkflow(stackName, bucketName, workflowName, inputFile) { module.exports = { testWorkflow, executeWorkflow, - ActivityStep: lambda.ActivityStep, - LambdaStep: lambda.LambdaStep + ActivityStep: sfnStep.ActivityStep, + LambdaStep: sfnStep.LambdaStep }; diff --git a/packages/integration-tests/lambda.js b/packages/integration-tests/sfnStep.js similarity index 77% rename from packages/integration-tests/lambda.js rename to packages/integration-tests/sfnStep.js index f5fad9d17c3..55053cc9b46 100644 --- a/packages/integration-tests/lambda.js +++ b/packages/integration-tests/sfnStep.js @@ -20,29 +20,29 @@ class SfnStep { } /** - * Get the events for the lambda execution for the given workflow execution. - * This function currently assumes one execution of the given lambda per workflow. + * Get the events for the step execution for the given workflow execution. + * This function currently assumes one execution of the given step (by step name) per workflow. * * @param {string} workflowExecutionArn - Arn of the workflow execution - * @param {string} lambdaName - name of the lambda + * @param {string} stepName - name of the step * @returns {Object} an object containing a schedule event, start event, and complete - * event if exist, null if cannot find the lambda + * event if exist, null if cannot find the step */ - async getLambdaExecution(workflowExecutionArn, lambdaName) { + async getStepExecution(workflowExecutionArn, stepName) { const executionHistory = ( await sfn().getExecutionHistory({ executionArn: workflowExecutionArn }).promise() ); - // Get the event where the lambda was scheduled + // Get the event where the step was scheduled const scheduleEvent = executionHistory.events.find((event) => { const eventScheduled = this.scheduleEvents.includes(event.type); const eventDetails = event[this.eventDetailsKeys.scheduled]; - const isStepEvent = eventDetails && eventDetails.resource.includes(lambdaName); + const isStepEvent = eventDetails && eventDetails.resource.includes(stepName); return eventScheduled && isStepEvent; }); if (scheduleEvent === null || scheduleEvent === undefined) { - console.log(`Could not find lambda ${lambdaName} in execution.`); + console.log(`Could not find step ${stepName} in execution.`); return null; } @@ -61,27 +61,27 @@ class SfnStep { } /** - * Get the output payload from the lambda, if the lambda succeeds + * Get the output payload from the step, if the step succeeds * * @param {string} workflowExecutionArn - Arn of the workflow execution - * @param {string} lambdaName - name of the lambda + * @param {string} stepName - name of the step * @returns {Object} object containing the payload, null if error */ - async getLambdaOutput(workflowExecutionArn, lambdaName) { - const lambdaExecution = await this.getLambdaExecution(workflowExecutionArn, lambdaName, this); + async getStepOutput(workflowExecutionArn, stepName) { + const stepExecution = await this.getStepExecution(workflowExecutionArn, stepName, this); - if (lambdaExecution === null) { - console.log(`Could not find lambda ${lambdaName} in execution.`); + if (stepExecution === null) { + console.log(`Could not find step ${stepName} in execution.`); return null; } - if (lambdaExecution.completeEvent === null || - lambdaExecution.completeEvent.type !== this.successEvent) { - console.log(`Lambda ${lambdaName} was not successful.`); + if (stepExecution.completeEvent === null || + stepExecution.completeEvent.type !== this.successEvent) { + console.log(`Step ${stepName} was not successful.`); return null; } - const succeededDetails = JSON.parse(lambdaExecution.completeEvent[this.eventDetailsKeys.succeeded].output.toString()); + const succeededDetails = JSON.parse(stepExecution.completeEvent[this.eventDetailsKeys.succeeded].output.toString()); return succeededDetails; } }; From 78254451a6d3a1b5c0db4945d4728ce59c8d6258 Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Mon, 26 Mar 2018 15:16:53 -0400 Subject: [PATCH 03/14] Add item to changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 393a813295c..ba837efab0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - **CUMULUS-271: "Empty response body from rules PUT endpoint"** Added the updated rule to response body. - Increased memory allotment for `CustomBootstrap` lambda function. Resolves failed deployments where `CustomBootstrap` lambda function was failing with error `Process exited before completing request`. This was causing deployments to stall, fail to update and fail to rollback. This error is thrown when the lambda function tries to use more memory than it is allotted. +### Added +- `@cumulus/integration-tests` supports testing the output of an activity-type step in addition to a lambda-type step. + ## [v1.2.0] - 2018-03-20 ### Fixed From 990055e2e2d5017d5d16f1c20d286750dd7d4c8a Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Mon, 26 Mar 2018 15:19:52 -0400 Subject: [PATCH 04/14] Minor formatting --- packages/integration-tests/sfnStep.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/integration-tests/sfnStep.js b/packages/integration-tests/sfnStep.js index 55053cc9b46..0919cc370db 100644 --- a/packages/integration-tests/sfnStep.js +++ b/packages/integration-tests/sfnStep.js @@ -126,10 +126,8 @@ class ActivityStep extends SfnStep { 'ActivityScheduled', this.scheduleFailedEvent ]; - this.startEvents = [ - 'ActivityStarted' // there is no 'ActivityStartFailed' - ]; - this.startFailedEvent = undefined, + this.startEvents = [ 'ActivityStarted' ]; + this.startFailedEvent = undefined, // there is no 'ActivityStartFailed' this.successEvent = 'ActivitySucceeded'; this.completionEvents = [ this.successEvent, From 890808459c78ecca998ac7fb596867dca180f9ca Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Mon, 26 Mar 2018 16:05:30 -0400 Subject: [PATCH 05/14] Fix eslint errors --- packages/integration-tests/index.js | 6 ++-- packages/integration-tests/sfnStep.js | 50 +++++++++++++++++++-------- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/packages/integration-tests/index.js b/packages/integration-tests/index.js index b156c1ecebc..ead8fdba1a2 100644 --- a/packages/integration-tests/index.js +++ b/packages/integration-tests/index.js @@ -69,11 +69,13 @@ async function waitForCompletedExecution(executionArn) { let statusCheckCount = 0; // While execution is running, check status on a time interval + /* eslint-disable no-await-in-loop */ while (executionStatus === 'RUNNING' && statusCheckCount < executionStatusNumRetries) { await timeout(waitPeriodMs); executionStatus = await getExecutionStatus(executionArn); - statusCheckCount++; + statusCheckCount += 1; } + /* eslint-enable no-await-in-loop */ if (executionStatus === 'RUNNING' && statusCheckCount >= executionStatusNumRetries) { //eslint-disable-next-line max-len @@ -123,7 +125,7 @@ async function startWorkflowExecution(workflowArn, inputFile) { async function executeWorkflow(stackName, bucketName, workflowName, inputFile) { const workflowArn = await getWorkflowArn(stackName, bucketName, workflowName); const execution = await startWorkflowExecution(workflowArn, inputFile); - const executionArn = execution.executionArn; + const { executionArn } = execution; console.log(`Executing workflow: ${workflowName}. Execution ARN ${executionArn}`); diff --git a/packages/integration-tests/sfnStep.js b/packages/integration-tests/sfnStep.js index 0919cc370db..6882ff7dc4d 100644 --- a/packages/integration-tests/sfnStep.js +++ b/packages/integration-tests/sfnStep.js @@ -2,7 +2,18 @@ const { sfn } = require('@cumulus/common/aws'); +/** + * `SfnStep` provides methods for getting the output of a step within an AWS + * Step Function for a specific execution. +*/ class SfnStep { + /** + * `getStartEvent` gets the "start" event for a step, given its schedule event + * + * @param {Object} executionHistory - AWS Step Function execution history + * @param {Object} scheduleEvent - AWS Step Function schedule-type event + * @returns {Object} - AWS Step Function start-type event + */ getStartEvent(executionHistory, scheduleEvent) { return executionHistory.events.find((event) => { const isStartEvent = this.startEvents.includes(event.type); @@ -11,12 +22,19 @@ class SfnStep { }); } - getCompletedEvent(executionHistory, startEvent) { + /** + * `getCompletionEvent` gets the "completion" event for a step, given its start event + * + * @param {Object} executionHistory - AWS Step Function execution history + * @param {Object} startEvent - AWS Step Function start-type event + * @returns {Object} - AWS Step Function completion-type event + */ + getCompletionEvent(executionHistory, startEvent) { return executionHistory.events.find((event) => { const isCompletionEvent = this.completionEvents.includes(event.type); const previousEventIsStartEvent = event.previousEventId === startEvent.id; return isCompletionEvent && previousEventIsStartEvent; - }); + }); } /** @@ -36,7 +54,7 @@ class SfnStep { // Get the event where the step was scheduled const scheduleEvent = executionHistory.events.find((event) => { const eventScheduled = this.scheduleEvents.includes(event.type); - const eventDetails = event[this.eventDetailsKeys.scheduled]; + const eventDetails = event[this.eventDetailsKeys.scheduled]; const isStepEvent = eventDetails && eventDetails.resource.includes(stepName); return eventScheduled && isStepEvent; }); @@ -53,7 +71,7 @@ class SfnStep { startEvent = this.getStartEvent(executionHistory, scheduleEvent, this); if (startEvent !== null && startEvent.type !== this.startFailedEvent) { - completeEvent = this.getCompletedEvent(executionHistory, startEvent, this); + completeEvent = this.getCompletionEvent(executionHistory, startEvent, this); } } @@ -84,18 +102,16 @@ class SfnStep { const succeededDetails = JSON.parse(stepExecution.completeEvent[this.eventDetailsKeys.succeeded].output.toString()); return succeededDetails; } -}; - -const lambdaCompletedEvents = [ - 'LambdaFunctionFailed', - 'LambdaFunctionSucceeded', - 'LambdaFunctionTimedOut' -]; +} +/** + * `LambdaStep` is a step inside a step function that runs an AWS Lambda function. + */ class LambdaStep extends SfnStep { + //eslint-disable-next-line require-jsdoc constructor() { super(); - this.scheduleFailedEvent = 'LambdaFunctionScheduleFailed'; + this.scheduleFailedEvent = 'LambdaFunctionScheduleFailed'; this.scheduleEvents = [ this.scheduleFailedEvent, 'LambdaFunctionScheduled' @@ -118,7 +134,11 @@ class LambdaStep extends SfnStep { } } +/** + * `ActivityStep` is a step inside a step function that runs an AWS ECS activity. + */ class ActivityStep extends SfnStep { + //eslint-disable-next-line require-jsdoc constructor() { super(); this.scheduleFailedEvent = 'ActivityScheduleFailed'; @@ -126,13 +146,13 @@ class ActivityStep extends SfnStep { 'ActivityScheduled', this.scheduleFailedEvent ]; - this.startEvents = [ 'ActivityStarted' ]; - this.startFailedEvent = undefined, // there is no 'ActivityStartFailed' + this.startEvents = ['ActivityStarted']; + this.startFailedEvent = undefined; // there is no 'ActivityStartFailed' this.successEvent = 'ActivitySucceeded'; this.completionEvents = [ this.successEvent, 'ActivityFailed', - 'ActivityTimedOut' + 'ActivityTimedOut' ]; this.eventDetailsKeys = { scheduled: 'activityScheduledEventDetails', From 4284251b276555e860ebf02e84775201af58d1ce Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Mon, 26 Mar 2018 16:17:25 -0400 Subject: [PATCH 06/14] Add name to root package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 9310bedd87b..5f18f2d60a1 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "name": "@cumulus", "private": true, "version": "1.0.0", "description": "Cumulus Framework for ingesting and processing Nasa Earth data streams", From b4ca277179c83f35104e3f0e608e6dd7a23ef5a4 Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Mon, 26 Mar 2018 16:18:10 -0400 Subject: [PATCH 07/14] Use valid name --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5f18f2d60a1..15d057dba94 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@cumulus", + "name": "cumulus", "private": true, "version": "1.0.0", "description": "Cumulus Framework for ingesting and processing Nasa Earth data streams", From 0d48e2cad84e6a997a6496a85da44362cc3c3765 Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Mon, 26 Mar 2018 16:23:21 -0400 Subject: [PATCH 08/14] Revert chage to package.json --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 15d057dba94..9310bedd87b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,4 @@ { - "name": "cumulus", "private": true, "version": "1.0.0", "description": "Cumulus Framework for ingesting and processing Nasa Earth data streams", From 1d984a0fc75942e4f5ffe5bd5925fb618e0b961d Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Mon, 26 Mar 2018 17:00:18 -0400 Subject: [PATCH 09/14] Update .eslint-ratchet-high-water-mark --- .eslint-ratchet-high-water-mark | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslint-ratchet-high-water-mark b/.eslint-ratchet-high-water-mark index a4ea6e7a770..fd57c18b80a 100644 --- a/.eslint-ratchet-high-water-mark +++ b/.eslint-ratchet-high-water-mark @@ -1 +1 @@ -2059 +2054 From 1d9f3efb238ff45c0351769b7f54127c18383442 Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Thu, 29 Mar 2018 12:36:35 -0400 Subject: [PATCH 10/14] Return succeeded details without unnecessary const --- packages/integration-tests/sfnStep.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/integration-tests/sfnStep.js b/packages/integration-tests/sfnStep.js index 6882ff7dc4d..4be05e9075d 100644 --- a/packages/integration-tests/sfnStep.js +++ b/packages/integration-tests/sfnStep.js @@ -99,8 +99,7 @@ class SfnStep { return null; } - const succeededDetails = JSON.parse(stepExecution.completeEvent[this.eventDetailsKeys.succeeded].output.toString()); - return succeededDetails; + return JSON.parse(stepExecution.completeEvent[this.eventDetailsKeys.succeeded].output.toString()); } } From 07640602e5759e5ed8f1abe3a5cf37ffd891d71b Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Thu, 29 Mar 2018 12:42:10 -0400 Subject: [PATCH 11/14] Add getLambdaOutput map to sfnStep.LambdaStep.getStepOutput --- packages/integration-tests/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/integration-tests/index.js b/packages/integration-tests/index.js index ead8fdba1a2..8b1a638cac8 100644 --- a/packages/integration-tests/index.js +++ b/packages/integration-tests/index.js @@ -164,5 +164,9 @@ module.exports = { testWorkflow, executeWorkflow, ActivityStep: sfnStep.ActivityStep, - LambdaStep: sfnStep.LambdaStep + LambdaStep: sfnStep.LambdaStep, + /** + * @deprecated Since version 1.3. To be deleted version 2.0. sfnStep.LambdaStep.getStepOutput instead. + */ + getLambdaOutput: sfnStep.LambdaStep.getStepOutput }; From 5bd08d72fe252e7f04caba76f1ea66d86f7c4468 Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Thu, 29 Mar 2018 12:44:30 -0400 Subject: [PATCH 12/14] Refactor executionArn --- packages/integration-tests/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/integration-tests/index.js b/packages/integration-tests/index.js index 8b1a638cac8..352f8aacc0c 100644 --- a/packages/integration-tests/index.js +++ b/packages/integration-tests/index.js @@ -124,8 +124,7 @@ async function startWorkflowExecution(workflowArn, inputFile) { */ async function executeWorkflow(stackName, bucketName, workflowName, inputFile) { const workflowArn = await getWorkflowArn(stackName, bucketName, workflowName); - const execution = await startWorkflowExecution(workflowArn, inputFile); - const { executionArn } = execution; + const { executionArn } = await startWorkflowExecution(workflowArn, inputFile); console.log(`Executing workflow: ${workflowName}. Execution ARN ${executionArn}`); From d0c90e128526ca308e287f2d22d36aed3af5e7e7 Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Thu, 29 Mar 2018 12:45:13 -0400 Subject: [PATCH 13/14] simplify conditional for scheduleEvent presence --- packages/integration-tests/sfnStep.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integration-tests/sfnStep.js b/packages/integration-tests/sfnStep.js index 4be05e9075d..4a30cba45e1 100644 --- a/packages/integration-tests/sfnStep.js +++ b/packages/integration-tests/sfnStep.js @@ -59,7 +59,7 @@ class SfnStep { return eventScheduled && isStepEvent; }); - if (scheduleEvent === null || scheduleEvent === undefined) { + if (!scheduleEvent) { console.log(`Could not find step ${stepName} in execution.`); return null; } From c099a12f3e7d8135a4206b501e341e270c29b30c Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Thu, 29 Mar 2018 12:51:37 -0400 Subject: [PATCH 14/14] Update eslint-ratchet-high-water-mark --- .eslint-ratchet-high-water-mark | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslint-ratchet-high-water-mark b/.eslint-ratchet-high-water-mark index d0c13ddaf93..4e98696eb77 100644 --- a/.eslint-ratchet-high-water-mark +++ b/.eslint-ratchet-high-water-mark @@ -1 +1 @@ -1348 \ No newline at end of file +1344 \ No newline at end of file