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, RUN_PROCESS_INPUTS_FORM } from "./run-process-panel-actions";
7 import { navigateTo } from "store/navigation/navigation-action";
9 describe("run-process-panel-actions", () => {
10 describe("runProcess", () => {
11 const newProcessUUID = 'newProcessUUID';
12 let dispatch, getState, services;
17 containerRequestService: {
18 create: cy.stub().callsFake(async () => ({
23 cy.spy(navigateTo).as('navigateTo');
26 it("should return when userUuid is null", async () => {
33 await runProcess(dispatch, getState, services);
36 expect(dispatch).not.to.be.called;
39 it("should run workflow with project-uuid", async () => {
44 email: "test@gmail.com",
45 firstName: "TestFirstName",
46 lastName: "TestLastName",
47 uuid: "zzzzz-tpzed-yid70bw31f51234",
48 ownerUuid: "zzzzz-tpzed-000000000000000",
51 username: "testfirstname",
58 processPathname: "/projects/zzzzz-tpzed-yid70bw31f51234",
59 processOwnerUuid: "zzzzz-tpzed-yid70bw31f51234",
61 kind: "arvados#workflow",
62 etag: "8gh5xlhlgo61yqscyl1spw8tc",
63 uuid: "zzzzz-7fd4e-2tlnerdkxnl4fjt",
64 ownerUuid: "zzzzz-tpzed-o4njwilpp4ov321",
65 createdAt: "2020-07-15T19:40:50.296041000Z",
66 modifiedByClientUuid: "zzzzz-ozdt8-libnr89sc5nq111",
67 modifiedByUserUuid: "zzzzz-tpzed-o4njwilpp4ov321",
68 modifiedAt: "2020-07-15T19:40:50.296376000Z",
71 "Reverse the lines in a document, then sort those lines.",
73 '{\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}',
77 [RUN_PROCESS_BASIC_FORM]: {
79 name: "basicFormTestName",
80 description: "basicFormTestDescription",
83 [RUN_PROCESS_INPUTS_FORM]: {
92 await runProcess(dispatch, getState, services);
95 expect(services.containerRequestService.create).to.be.calledWithMatch(testCreateArgs);
96 expect(dispatch).to.be.calledWithMatch(navigateTo(newProcessUUID));
108 path: '/var/spool/cwl/cwl.output.json',
110 '/var/lib/cwl/workflow.json': {
116 doc: 'Reverse the lines in a document, then sort those lines.',
120 class: 'http://arvados.org/cwl#WorkflowRunnerResources',
121 acrContainerImage: 'arvados/jobs:2.0.4',
128 doc: 'The input file to be processed.',
134 doc: 'If true, reverse (decending) sort',
135 id: '#main/reverse_sort',
141 doc: 'The output with the lines reversed and sorted.',
143 outputSource: '#main/sorted/output',
152 id: '#main/rev/input',
153 source: '#main/input',
156 out: ['#main/rev/output'],
163 id: '#main/sorted/input',
164 source: '#main/rev/output',
167 id: '#main/sorted/reverse',
168 source: '#main/reverse_sort',
171 out: ['#main/sorted/output'],
172 run: '#sorttool.cwl',
178 class: 'CommandLineTool',
179 doc: 'Reverse each line using the `rev` command',
182 class: 'ResourceRequirement',
189 id: '#revtool.cwl/input',
196 id: '#revtool.cwl/output',
203 stdout: 'output.txt',
207 class: 'CommandLineTool',
208 doc: 'Sort lines using the `sort` command',
211 class: 'ResourceRequirement',
218 id: '#sorttool.cwl/reverse',
226 id: '#sorttool.cwl/input',
235 id: '#sorttool.cwl/output',
242 stdout: 'output.txt',
248 '/var/lib/cwl/cwl.input.json': {
256 const testCreateArgs = {
258 'arvados-cwl-runner',
261 "--no-log-timestamps",
263 '--project-uuid=zzzzz-tpzed-yid70bw31f51234',
264 '/var/lib/cwl/workflow.json#main',
265 '/var/lib/cwl/cwl.input.json',
267 containerImage: 'arvados/jobs:2.0.4',
268 cwd: '/var/spool/cwl',
269 description: undefined,
271 secretMounts: undefined,
272 name: 'basicFormTestName',
273 outputName: 'Output from basicFormTestName',
274 outputPath: '/var/spool/cwl',
275 ownerUuid: 'zzzzz-tpzed-yid70bw31f51234',
278 workflowName: 'revsort.cwl',
279 template_uuid: 'zzzzz-7fd4e-2tlnerdkxnl4fjt',
281 runtimeConstraints: {
283 ram: 16256 * (1024 * 1024),
286 schedulingParameters: { max_run_time: undefined },