Skip to content

Commit

Permalink
fix: handle fullInputs for relaunch workflow (#171)
Browse files Browse the repository at this point in the history
* fix: handle fullInputs for relaunch workflow

Signed-off-by: Jason Porter <[email protected]>

* fix: handle fullInputs for relaunch workflow
 - added unit tests
Signed-off-by: Jason Porter <[email protected]>
  • Loading branch information
jsonporter authored Jun 3, 2021
1 parent d27e70d commit 8a4fd82
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,44 @@ describe('RelaunchExecutionForm', () => {
});
});

describe('Launch form with full inputs', () => {
let values: LiteralValueMap;
beforeEach(() => {
workflowInputDefinitions = {
workflowSimpleString: mockSimpleVariables.simpleString,
workflowSimpleInteger: mockSimpleVariables.simpleInteger
};
workflow.closure!.compiledWorkflow!.primary.template.interface!.inputs = {
variables: workflowInputDefinitions
};
executionInputs = {
literals: {
workflowSimpleString: primitiveLiteral({
stringValue: simpleStringValue
}),
workflowSimpleInteger: primitiveLiteral({
integer: simpleIntegerValue
})
}
};
executionData.fullInputs = executionInputs;
execution.closure.computedInputs = executionInputs;
values = createValuesMap(workflowInputDefinitions, executionInputs);
});
it('correctly uses fullInputs when value is present and does not call getRemoteLiteralMap()', async () => {
delete execution.closure.computedInputs;
const { getByText } = renderForm();
await waitFor(() => getByText(mockContentString));
expect(mockGetExecutionData).toHaveBeenCalledWith(execution.id);
expect(mockGetRemoteLiteralMap).not.toHaveBeenCalled();
checkLaunchFormProps({
initialParameters: expect.objectContaining({
values
})
});
});
});

describe('with single task execution', () => {
let values: LiteralValueMap;
let authRole: Admin.IAuthRole;
Expand Down
12 changes: 11 additions & 1 deletion src/components/Executions/useWorkflowExecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,17 @@ export const fetchWorkflowExecutionInputs = async (
if (execution.closure.computedInputs) {
return execution.closure.computedInputs;
}
const { inputs } = await getExecutionData(execution.id);
/** Note:
* getExecutionData will retun signed urls (`inputs`) as well as raw values
* (`fullInputs`) if input payload isn't too large.
*
* If a signed URL is returned `fullInputs` will be null; use `fullInputs`
* when available.
*/
const { inputs, fullInputs } = await getExecutionData(execution.id);
if (fullInputs) {
return LiteralMap.create(fullInputs);
}
if (
!inputs.url ||
!inputs.bytes ||
Expand Down

0 comments on commit 8a4fd82

Please sign in to comment.