1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { runProcess } from "./run-process-panel-actions";
6 import { RUN_PROCESS_BASIC_FORM } from "views/run-process-panel/run-process-basic-form";
7 import { RUN_PROCESS_INPUTS_FORM } from "views/run-process-panel/run-process-inputs-form";
8 import { navigateTo } from "store/navigation/navigation-action";
10 describe("run-process-panel-actions", () => {
11 describe("runProcess", () => {
12 const newProcessUUID = 'newProcessUUID';
13 let dispatch, getState, services;
18 containerRequestService: {
19 create: cy.stub().callsFake(async () => ({
24 cy.spy(navigateTo).as('navigateTo');
27 it("should return when userUuid is null", async () => {
34 await runProcess(dispatch, getState, services);
37 expect(dispatch).not.to.be.called;
40 it("should run workflow with project-uuid", async () => {
45 email: "test@gmail.com",
46 firstName: "TestFirstName",
47 lastName: "TestLastName",
48 uuid: "zzzzz-tpzed-yid70bw31f51234",
49 ownerUuid: "zzzzz-tpzed-000000000000000",
52 username: "testfirstname",
59 processPathname: "/projects/zzzzz-tpzed-yid70bw31f51234",
60 processOwnerUuid: "zzzzz-tpzed-yid70bw31f51234",
62 href: "/workflows/zzzzz-7fd4e-2tlnerdkxnl4fjt",
63 kind: "arvados#workflow",
64 etag: "8gh5xlhlgo61yqscyl1spw8tc",
65 uuid: "zzzzz-7fd4e-2tlnerdkxnl4fjt",
66 ownerUuid: "zzzzz-tpzed-o4njwilpp4ov321",
67 createdAt: "2020-07-15T19:40:50.296041000Z",
68 modifiedByClientUuid: "zzzzz-ozdt8-libnr89sc5nq111",
69 modifiedByUserUuid: "zzzzz-tpzed-o4njwilpp4ov321",
70 modifiedAt: "2020-07-15T19:40:50.296376000Z",
73 "Reverse the lines in a document, then sort those lines.",
75 '{\n "$graph": [\n {\n "class": "Workflow",\n "doc": "Reverse the lines in a document, then sort those lines.",\n "id": "#main",\n "hints":[{"class":"http://arvados.org/cwl#WorkflowRunnerResources","acrContainerImage":"arvados/jobs:2.0.4", "ramMin": 16000}], "inputs": [\n {\n "default": null,\n "doc": "The input file to be processed.",\n "id": "#main/input",\n "type": "File"\n },\n {\n "default": true,\n "doc": "If true, reverse (decending) sort",\n "id": "#main/reverse_sort",\n "type": "boolean"\n }\n ],\n "outputs": [\n {\n "doc": "The output with the lines reversed and sorted.",\n "id": "#main/output",\n "outputSource": "#main/sorted/output",\n "type": "File"\n }\n ],\n "steps": [\n {\n "id": "#main/rev",\n "in": [\n {\n "id": "#main/rev/input",\n "source": "#main/input"\n }\n ],\n "out": [\n "#main/rev/output"\n ],\n "run": "#revtool.cwl"\n },\n {\n "id": "#main/sorted",\n "in": [\n {\n "id": "#main/sorted/input",\n "source": "#main/rev/output"\n },\n {\n "id": "#main/sorted/reverse",\n "source": "#main/reverse_sort"\n }\n ],\n "out": [\n "#main/sorted/output"\n ],\n "run": "#sorttool.cwl"\n }\n ]\n },\n {\n "baseCommand": "rev",\n "class": "CommandLineTool",\n "doc": "Reverse each line using the `rev` command",\n "hints": [\n {\n "class": "ResourceRequirement",\n "ramMin": 8\n }\n ],\n "id": "#revtool.cwl",\n "inputs": [\n {\n "id": "#revtool.cwl/input",\n "inputBinding": {},\n "type": "File"\n }\n ],\n "outputs": [\n {\n "id": "#revtool.cwl/output",\n "outputBinding": {\n "glob": "output.txt"\n },\n "type": "File"\n }\n ],\n "stdout": "output.txt"\n },\n {\n "baseCommand": "sort",\n "class": "CommandLineTool",\n "doc": "Sort lines using the `sort` command",\n "hints": [\n {\n "class": "ResourceRequirement",\n "ramMin": 8\n }\n ],\n "id": "#sorttool.cwl",\n "inputs": [\n {\n "id": "#sorttool.cwl/reverse",\n "inputBinding": {\n "position": 1,\n "prefix": "-r"\n },\n "type": "boolean"\n },\n {\n "id": "#sorttool.cwl/input",\n "inputBinding": {\n "position": 2\n },\n "type": "File"\n }\n ],\n "outputs": [\n {\n "id": "#sorttool.cwl/output",\n "outputBinding": {\n "glob": "output.txt"\n },\n "type": "File"\n }\n ],\n "stdout": "output.txt"\n }\n ],\n "cwlVersion": "v1.0"\n}',
79 [RUN_PROCESS_BASIC_FORM]: {
81 name: "basicFormTestName",
82 description: "basicFormTestDescription",
85 [RUN_PROCESS_INPUTS_FORM]: {
94 await runProcess(dispatch, getState, services);
97 expect(services.containerRequestService.create).to.be.calledWithMatch(testCreateArgs);
98 expect(dispatch).to.be.calledWithMatch(navigateTo(newProcessUUID));
110 path: '/var/spool/cwl/cwl.output.json',
112 '/var/lib/cwl/workflow.json': {
118 doc: 'Reverse the lines in a document, then sort those lines.',
122 class: 'http://arvados.org/cwl#WorkflowRunnerResources',
123 acrContainerImage: 'arvados/jobs:2.0.4',
130 doc: 'The input file to be processed.',
136 doc: 'If true, reverse (decending) sort',
137 id: '#main/reverse_sort',
143 doc: 'The output with the lines reversed and sorted.',
145 outputSource: '#main/sorted/output',
154 id: '#main/rev/input',
155 source: '#main/input',
158 out: ['#main/rev/output'],
165 id: '#main/sorted/input',
166 source: '#main/rev/output',
169 id: '#main/sorted/reverse',
170 source: '#main/reverse_sort',
173 out: ['#main/sorted/output'],
174 run: '#sorttool.cwl',
180 class: 'CommandLineTool',
181 doc: 'Reverse each line using the `rev` command',
184 class: 'ResourceRequirement',
191 id: '#revtool.cwl/input',
198 id: '#revtool.cwl/output',
205 stdout: 'output.txt',
209 class: 'CommandLineTool',
210 doc: 'Sort lines using the `sort` command',
213 class: 'ResourceRequirement',
220 id: '#sorttool.cwl/reverse',
228 id: '#sorttool.cwl/input',
237 id: '#sorttool.cwl/output',
244 stdout: 'output.txt',
250 '/var/lib/cwl/cwl.input.json': {
258 const testCreateArgs = {
260 'arvados-cwl-runner',
263 "--no-log-timestamps",
265 '--project-uuid=zzzzz-tpzed-yid70bw31f51234',
266 '/var/lib/cwl/workflow.json#main',
267 '/var/lib/cwl/cwl.input.json',
269 containerImage: 'arvados/jobs:2.0.4',
270 cwd: '/var/spool/cwl',
271 description: undefined,
273 secretMounts: undefined,
274 name: 'basicFormTestName',
275 outputName: 'Output from basicFormTestName',
276 outputPath: '/var/spool/cwl',
277 ownerUuid: 'zzzzz-tpzed-yid70bw31f51234',
280 workflowName: 'revsort.cwl',
281 template_uuid: 'zzzzz-7fd4e-2tlnerdkxnl4fjt',
283 runtimeConstraints: {
285 ram: 16256 * (1024 * 1024),
288 schedulingParameters: { max_run_time: undefined },