1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { ContainerState } from "models/container";
7 describe("Process tests", function () {
12 // Only set up common users once. These aren't set up as aliases because
13 // aliases are cleaned up after every test. Also it doesn't make sense
14 // to set the same users on beforeEach() over and over again, so we
15 // separate a little from Cypress' 'Best Practices' here.
16 cy.getUser("admin", "Admin", "User", true, true)
19 adminUser = this.adminUser;
21 cy.getUser("activeuser", "Active", "User", false, true)
24 activeUser = this.activeUser;
29 function createContainerRequest(user, name, docker_image, command, reuse = false, state = "Uncommitted") {
30 return cy.setupDockerImage(docker_image).then(function (dockerImage) {
31 return cy.createContainerRequest(user.token, {
34 container_image: dockerImage.portable_data_hash, // for some reason, docker_image doesn't work here
35 output_path: "stdout.txt",
37 runtime_constraints: {
53 describe('Multiselect Toolbar', () => {
54 it('shows the appropriate buttons in the toolbar', () => {
56 const msButtonTooltips = [
62 'Copy and re-run process',
68 createContainerRequest(
70 `test_container_request ${Math.floor(Math.random() * 999999)}`,
72 ["echo", "hello world"],
75 ).then(function (containerRequest) {
76 cy.loginAs(activeUser);
77 cy.goToPath(`/processes/${containerRequest.uuid}`);
78 cy.get("[data-cy=process-details]").should("contain", containerRequest.name);
79 cy.get("[data-cy=process-details-attributes-modifiedby-user]").contains(`Active User (${activeUser.user.uuid})`);
80 cy.get("[data-cy=process-details-attributes-runtime-user]").should("not.exist");
81 cy.get("[data-cy=side-panel-tree]").contains("Home Projects").click();
83 cy.get('[data-cy=mpv-tabs]').contains("Workflow Runs").click();
84 cy.get('[data-cy=data-table-row]').contains(containerRequest.name).should('exist').parents('[data-cy=data-table-row]').click()
86 cy.get('[data-cy=multiselect-button]').should('have.length', msButtonTooltips.length)
87 for (let i = 0; i < msButtonTooltips.length; i++) {
88 cy.get('[data-cy=multiselect-button]').eq(i).trigger('mouseover');
89 cy.get('body').contains(msButtonTooltips[i]).should('exist')
90 cy.get('[data-cy=multiselect-button]').eq(i).trigger('mouseout');
96 describe("Details panel", function () {
97 it("shows process details", function () {
98 createContainerRequest(
100 `test_container_request ${Math.floor(Math.random() * 999999)}`,
102 ["echo", "hello world"],
105 ).then(function (containerRequest) {
106 cy.loginAs(activeUser);
107 cy.goToPath(`/processes/${containerRequest.uuid}`);
108 cy.get("[data-cy=process-details]").should("contain", containerRequest.name);
109 cy.get("[data-cy=process-details-attributes-modifiedby-user]").contains(`Active User (${activeUser.user.uuid})`);
110 cy.get("[data-cy=process-details-attributes-runtime-user]").should("not.exist");
113 // Fake submitted by another user to test "runtime user" field.
115 // Need to override both group contents and direct get,
116 // because it displays the the cached value from
117 // 'contents' for a few moments while requesting the full
119 cy.intercept({ method: "GET", url: "**/arvados/v1/groups/*/contents?*" }, req => {
120 req.on('response', res => {
121 if (!res.body.items) {
124 res.body.items.forEach(item => {
125 item.modified_by_user_uuid = "zzzzz-tpzed-000000000000000";
129 cy.intercept({ method: "GET", url: "**/arvados/v1/container_requests/*" }, req => {
130 req.on('response', res => {
131 res.body.modified_by_user_uuid = "zzzzz-tpzed-000000000000000";
135 createContainerRequest(
137 `test_container_request ${Math.floor(Math.random() * 999999)}`,
139 ["echo", "hello world"],
142 ).then(function (containerRequest) {
143 cy.loginAs(activeUser);
144 cy.goToPath(`/processes/${containerRequest.uuid}`);
145 cy.get("[data-cy=process-details]").should("contain", containerRequest.name);
146 cy.get("[data-cy=process-details-attributes-modifiedby-user]").contains(`zzzzz-tpzed-000000000000000`);
147 cy.get("[data-cy=process-details-attributes-runtime-user]").contains(`Active User (${activeUser.user.uuid})`);
151 it("should show runtime status indicators", function () {
152 // Setup running container with runtime_status error & warning messages
153 createContainerRequest(activeUser, "test_container_request", "arvados/jobs", ["echo", "hello world"], false, "Committed")
154 .as("containerRequest")
155 .then(function (containerRequest) {
156 expect(containerRequest.state).to.equal("Committed");
157 expect(containerRequest.container_uuid).not.to.be.equal("");
159 cy.getContainer(activeUser.token, containerRequest.container_uuid).then(function (queuedContainer) {
160 expect(queuedContainer.state).to.be.equal("Queued");
162 cy.updateContainer(adminUser.token, containerRequest.container_uuid, {
164 }).then(function (lockedContainer) {
165 expect(lockedContainer.state).to.be.equal("Locked");
167 cy.updateContainer(adminUser.token, lockedContainer.uuid, {
170 error: "Something went wrong",
171 errorDetail: "Process exited with status 1",
172 warning: "Free disk space is low",
175 .as("runningContainer")
176 .then(function (runningContainer) {
177 expect(runningContainer.state).to.be.equal("Running");
178 expect(runningContainer.runtime_status).to.be.deep.equal({
179 error: "Something went wrong",
180 errorDetail: "Process exited with status 1",
181 warning: "Free disk space is low",
186 // Test that the UI shows the error and warning messages
187 cy.getAll("@containerRequest", "@runningContainer").then(function ([containerRequest]) {
188 cy.loginAs(activeUser);
189 cy.goToPath(`/processes/${containerRequest.uuid}`);
190 cy.get("[data-cy=process-runtime-status-error]")
191 .should("contain", "Something went wrong")
192 .and("contain", "Process exited with status 1");
193 cy.get("[data-cy=process-runtime-status-warning]")
194 .should("contain", "Free disk space is low")
195 .and("contain", "No additional warning details available");
198 // Force container_count for testing
199 let containerCount = 2;
200 cy.intercept({ method: "GET", url: "**/arvados/v1/container_requests/*" }, req => {
201 req.on('response', res => {
202 res.body.container_count = containerCount;
206 cy.getAll("@containerRequest", "@runningContainer").then(function ([containerRequest]) {
207 cy.goToPath(`/processes/${containerRequest.uuid}`);
209 cy.get("[data-cy=process-runtime-status-retry-warning]", { timeout: 7000 }).should("contain", "Process retried 1 time")
212 cy.getAll("@containerRequest", "@runningContainer", "@retry1").then(function ([containerRequest]) {
214 cy.goToPath(`/processes/${containerRequest.uuid}`);
216 cy.get("[data-cy=process-runtime-status-retry-warning]", { timeout: 7000 }).should("contain", "Process retried 2 times");
220 it("allows copying processes", function () {
221 const crName = "first_container_request";
222 const copiedCrName = "copied_container_request";
223 createContainerRequest(activeUser, crName, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (containerRequest) {
224 cy.loginAs(activeUser);
225 cy.goToPath(`/processes/${containerRequest.uuid}`);
226 cy.get("[data-cy=process-details]").should("contain", crName);
228 cy.get("[data-cy=process-details]").find('button[title="More options"]').click();
229 cy.get("ul[data-cy=context-menu]").contains("Copy and re-run process").click();
232 cy.get("[data-cy=form-dialog]").within(() => {
233 cy.get("input[name=name]").clear().type(copiedCrName);
234 cy.get("[data-cy=projects-tree-home-tree-picker]").click();
235 cy.get("[data-cy=form-submit-btn]").click();
238 cy.get("[data-cy=process-details]").should("contain", copiedCrName);
239 cy.get("[data-cy=process-details]").find("button").contains("Run");
242 const getFakeContainer = fakeContainerUuid => ({
243 href: `/containers/${fakeContainerUuid}`,
244 kind: "arvados#container",
245 etag: "ecfosljpnxfari9a8m7e4yv06",
246 uuid: fakeContainerUuid,
247 owner_uuid: "zzzzz-tpzed-000000000000000",
248 created_at: "2023-02-13T15:55:47.308915000Z",
249 modified_by_client_uuid: "zzzzz-ozdt8-q6dzdi1lcc03155",
250 modified_by_user_uuid: "zzzzz-tpzed-000000000000000",
251 modified_at: "2023-02-15T19:12:45.987086000Z",
253 "arvados-cwl-runner",
256 "--project-uuid=zzzzz-j7d0g-yr18k784zplfeza",
257 "/var/lib/cwl/workflow.json#main",
258 "/var/lib/cwl/cwl.input.json",
260 container_image: "4ad7d11381df349e464694762db14e04+303",
261 cwd: "/var/spool/cwl",
265 locked_by_uuid: null,
268 output_path: "/var/spool/cwl",
270 runtime_constraints: {
275 hardware_capability: "",
277 keep_cache_disk: 2147483648,
285 scheduling_parameters: {
290 runtime_user_uuid: "zzzzz-tpzed-vllbpebicy84rd5",
291 runtime_auth_scopes: ["all"],
293 gateway_address: null,
294 interactive_session_started: false,
295 output_storage_classes: ["default"],
296 output_properties: {},
298 subrequests_cost: 0.0,
301 it("shows cancel button when appropriate", function () {
302 // Ignore collection requests
304 { method: "GET", url: `**/arvados/v1/collections/*` },
311 // Uncommitted container
312 const crUncommitted = `Test process ${Math.floor(Math.random() * 999999)}`;
313 createContainerRequest(activeUser, crUncommitted, "arvados/jobs", ["echo", "hello world"], false, "Uncommitted").then(function (
316 cy.loginAs(activeUser);
317 // Navigate to process and verify run / cancel button
318 cy.goToPath(`/processes/${containerRequest.uuid}`);
320 cy.get("[data-cy=process-details]").should("contain", crUncommitted);
321 cy.get("[data-cy=process-run-button]").should("exist");
322 cy.get("[data-cy=process-cancel-button]").should("not.exist");
326 const crQueued = `Test process ${Math.floor(Math.random() * 999999)}`;
327 const fakeCrUuid = "zzzzz-dz642-000000000000001";
328 createContainerRequest(activeUser, crQueued, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (
331 // Fake container uuid
332 cy.intercept({ method: "GET", url: `**/arvados/v1/container_requests/${containerRequest.uuid}` }, req => {
333 req.on('response', res => {
334 res.body.output_uuid = fakeCrUuid;
335 res.body.priority = 500;
336 res.body.state = "Committed";
341 const container = getFakeContainer(fakeCrUuid);
343 { method: "GET", url: `**/arvados/v1/container/${fakeCrUuid}` },
346 body: { ...container, state: "Queued", priority: 500 },
350 // Navigate to process and verify cancel button
351 cy.goToPath(`/processes/${containerRequest.uuid}`);
353 cy.get("[data-cy=process-details]").should("contain", crQueued);
354 cy.get("[data-cy=process-cancel-button]").contains("Cancel");
358 const crLocked = `Test process ${Math.floor(Math.random() * 999999)}`;
359 const fakeCrLockedUuid = "zzzzz-dz642-000000000000002";
360 createContainerRequest(activeUser, crLocked, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (
363 // Fake container uuid
364 cy.intercept({ method: "GET", url: `**/arvados/v1/container_requests/${containerRequest.uuid}` }, req => {
365 req.on('response', res => {
366 res.body.output_uuid = fakeCrLockedUuid;
367 res.body.priority = 500;
368 res.body.state = "Committed";
373 const container = getFakeContainer(fakeCrLockedUuid);
375 { method: "GET", url: `**/arvados/v1/container/${fakeCrLockedUuid}` },
378 body: { ...container, state: "Locked", priority: 500 },
382 // Navigate to process and verify cancel button
383 cy.goToPath(`/processes/${containerRequest.uuid}`);
385 cy.get("[data-cy=process-details]").should("contain", crLocked);
386 cy.get("[data-cy=process-cancel-button]").contains("Cancel");
390 const crOnHold = `Test process ${Math.floor(Math.random() * 999999)}`;
391 const fakeCrOnHoldUuid = "zzzzz-dz642-000000000000003";
392 createContainerRequest(activeUser, crOnHold, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (
395 // Fake container uuid
396 cy.intercept({ method: "GET", url: `**/arvados/v1/container_requests/${containerRequest.uuid}` }, req => {
397 req.on('response', res => {
398 res.body.output_uuid = fakeCrOnHoldUuid;
399 res.body.priority = 0;
400 res.body.state = "Committed";
405 const container = getFakeContainer(fakeCrOnHoldUuid);
407 { method: "GET", url: `**/arvados/v1/container/${fakeCrOnHoldUuid}` },
410 body: { ...container, state: "Queued", priority: 0 },
414 // Navigate to process and verify cancel button
415 cy.goToPath(`/processes/${containerRequest.uuid}`);
417 cy.get("[data-cy=process-details]").should("contain", crOnHold);
418 cy.get("[data-cy=process-run-button]").should("exist");
419 cy.get("[data-cy=process-cancel-button]").should("not.exist");
424 describe("Logs panel", function () {
425 it("shows live process logs", function () {
426 cy.intercept({ method: "GET", url: "**/arvados/v1/containers/*" }, req => {
427 req.on('response', res => {
428 res.body.state = ContainerState.RUNNING;
432 const crName = "test_container_request";
433 createContainerRequest(activeUser, crName, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (containerRequest) {
434 // Create empty log file before loading process page
435 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", [""]);
437 cy.loginAs(activeUser);
438 cy.goToPath(`/processes/${containerRequest.uuid}`);
439 cy.get("[data-cy=process-details]").should("contain", crName);
440 cy.get("[data-cy=process-logs]").should("contain", "No logs yet").and("not.contain", "hello world");
443 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", ["2023-07-18T20:14:48.128642814Z hello world"]).then(() => {
444 cy.get("[data-cy=process-logs]", { timeout: 7000 }).should("not.contain", "No logs yet").and("contain", "hello world");
447 // Append new log line to different file
448 cy.appendLog(adminUser.token, containerRequest.uuid, "stderr.txt", ["2023-07-18T20:14:49.128642814Z hello new line"]).then(() => {
449 cy.get("[data-cy=process-logs]", { timeout: 7000 }).should("not.contain", "No logs yet").and("contain", "hello new line");
454 it("filters process logs by event type", function () {
455 const nodeInfoLogs = [
457 "Linux compute-99cb150b26149780de44b929577e1aed-19rgca8vobuvc4p 5.4.0-1059-azure #62~18.04.1-Ubuntu SMP Tue Sep 14 17:53:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux",
460 "vendor_id : GenuineIntel",
463 "model name : Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz",
465 const crunchRunLogs = [
466 "2022-03-22T13:56:22.542417997Z using local keepstore process (pid 3733) at http://localhost:46837, writing logs to keepstore.txt in log collection",
467 "2022-03-22T13:56:26.237571754Z crunch-run 2.4.0~dev20220321141729 (go1.17.1) started",
468 "2022-03-22T13:56:26.244704134Z crunch-run process has uid=0(root) gid=0(root) groups=0(root)",
469 "2022-03-22T13:56:26.244862836Z Executing container 'zzzzz-dz642-1wokwvcct9s9du3' using docker runtime",
470 "2022-03-22T13:56:26.245037738Z Executing on host 'compute-99cb150b26149780de44b929577e1aed-19rgca8vobuvc4p'",
473 "2022-03-22T13:56:22.542417987Z Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dui nisi, hendrerit porta sapien a, pretium dignissim purus.",
474 "2022-03-22T13:56:22.542417997Z Integer viverra, mauris finibus aliquet ultricies, dui mauris cursus justo, ut venenatis nibh ex eget neque.",
475 "2022-03-22T13:56:22.542418007Z In hac habitasse platea dictumst.",
476 "2022-03-22T13:56:22.542418027Z Fusce fringilla turpis id accumsan faucibus. Donec congue congue ex non posuere. In semper mi quis tristique rhoncus.",
477 "2022-03-22T13:56:22.542418037Z Interdum et malesuada fames ac ante ipsum primis in faucibus.",
478 "2022-03-22T13:56:22.542418047Z Quisque fermentum tortor ex, ut suscipit velit feugiat faucibus.",
479 "2022-03-22T13:56:22.542418057Z Donec vitae porta risus, at luctus nulla. Mauris gravida iaculis ipsum, id sagittis tortor egestas ac.",
480 "2022-03-22T13:56:22.542418067Z Maecenas condimentum volutpat nulla. Integer lacinia maximus risus eu posuere.",
481 "2022-03-22T13:56:22.542418077Z Donec vitae leo id augue gravida bibendum.",
482 "2022-03-22T13:56:22.542418087Z Nam libero libero, pretium ac faucibus elementum, mattis nec ex.",
483 "2022-03-22T13:56:22.542418097Z Nullam id laoreet nibh. Vivamus tellus metus, pretium quis justo ut, bibendum varius metus. Pellentesque vitae accumsan lorem, quis tincidunt augue.",
484 "2022-03-22T13:56:22.542418107Z Aliquam viverra nisi nulla, et efficitur dolor mattis in.",
485 "2022-03-22T13:56:22.542418117Z Sed at enim sit amet nulla tincidunt mattis. Aenean eget aliquet ex, non ultrices ex. Nulla ex tortor, vestibulum aliquam tempor ac, aliquam vel est.",
486 "2022-03-22T13:56:22.542418127Z Fusce auctor faucibus libero id venenatis. Etiam sodales, odio eu cursus efficitur, quam sem blandit ex, quis porttitor enim dui quis lectus. In id tincidunt felis.",
487 "2022-03-22T13:56:22.542418137Z Phasellus non ex quis arcu tempus faucibus molestie in sapien.",
488 "2022-03-22T13:56:22.542418147Z Duis tristique semper dolor, vitae pulvinar risus.",
489 "2022-03-22T13:56:22.542418157Z Aliquam tortor elit, luctus nec tortor eget, porta tristique nulla.",
490 "2022-03-22T13:56:22.542418167Z Nulla eget mollis ipsum.",
493 createContainerRequest(activeUser, "test_container_request", "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (
496 cy.appendLog(adminUser.token, containerRequest.uuid, "node-info.txt", nodeInfoLogs).as("nodeInfoLogs");
497 cy.appendLog(adminUser.token, containerRequest.uuid, "crunch-run.txt", crunchRunLogs).as("crunchRunLogs");
498 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", stdoutLogs).as("stdoutLogs");
500 cy.getAll("@stdoutLogs", "@nodeInfoLogs", "@crunchRunLogs").then(function () {
501 cy.loginAs(activeUser);
502 cy.goToPath(`/processes/${containerRequest.uuid}`);
503 // Should show main logs by default
504 cy.get("[data-cy=process-logs-filter]", { timeout: 7000 }).should("contain", "Main logs");
505 cy.get("[data-cy=process-logs]")
506 .should("contain", stdoutLogs[Math.floor(Math.random() * stdoutLogs.length)])
507 .and("not.contain", nodeInfoLogs[Math.floor(Math.random() * nodeInfoLogs.length)])
508 .and("contain", crunchRunLogs[Math.floor(Math.random() * crunchRunLogs.length)]);
510 cy.get("[data-cy=process-logs-filter]").click();
511 cy.get("body").contains("li", "All logs").click();
512 cy.get("[data-cy=process-logs]")
513 .should("contain", stdoutLogs[Math.floor(Math.random() * stdoutLogs.length)])
514 .and("contain", nodeInfoLogs[Math.floor(Math.random() * nodeInfoLogs.length)])
515 .and("contain", crunchRunLogs[Math.floor(Math.random() * crunchRunLogs.length)]);
516 // Select 'node-info' logs
517 cy.get("[data-cy=process-logs-filter]").click();
518 cy.get("body").contains("li", "node-info").click();
519 cy.get("[data-cy=process-logs]")
520 .should("not.contain", stdoutLogs[Math.floor(Math.random() * stdoutLogs.length)])
521 .and("contain", nodeInfoLogs[Math.floor(Math.random() * nodeInfoLogs.length)])
522 .and("not.contain", crunchRunLogs[Math.floor(Math.random() * crunchRunLogs.length)]);
523 // Select 'stdout' logs
524 cy.get("[data-cy=process-logs-filter]").click();
525 cy.get("body").contains("li", "stdout").click();
526 cy.get("[data-cy=process-logs]")
527 .should("contain", stdoutLogs[Math.floor(Math.random() * stdoutLogs.length)])
528 .and("not.contain", nodeInfoLogs[Math.floor(Math.random() * nodeInfoLogs.length)])
529 .and("not.contain", crunchRunLogs[Math.floor(Math.random() * crunchRunLogs.length)]);
534 it("sorts combined logs", function () {
535 const crName = "test_container_request";
536 createContainerRequest(activeUser, crName, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (containerRequest) {
537 cy.appendLog(adminUser.token, containerRequest.uuid, "node-info.txt", [
545 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", [
546 "2023-07-18T20:14:48.128642814Z first",
547 "2023-07-18T20:14:49.128642814Z third",
550 cy.appendLog(adminUser.token, containerRequest.uuid, "stderr.txt", ["2023-07-18T20:14:48.528642814Z second"]).as("stderr");
552 cy.loginAs(activeUser);
553 cy.goToPath(`/processes/${containerRequest.uuid}`);
554 cy.get("[data-cy=process-details]").should("contain", crName);
555 cy.get("[data-cy=process-logs]").should("contain", "No logs yet");
557 cy.getAll("@node-info", "@stdout", "@stderr").then(() => {
558 // Verify sorted main logs
559 cy.get("[data-cy=process-logs] span > p", { timeout: 7000 }).eq(0).should("contain", "2023-07-18T20:14:48.128642814Z first");
560 cy.get("[data-cy=process-logs] span > p").eq(1).should("contain", "2023-07-18T20:14:48.528642814Z second");
561 cy.get("[data-cy=process-logs] span > p").eq(2).should("contain", "2023-07-18T20:14:49.128642814Z third");
563 // Switch to All logs
564 cy.get("[data-cy=process-logs-filter]").click();
565 cy.get("body").contains("li", "All logs").click();
566 // Verify non-sorted lines were preserved
567 cy.get("[data-cy=process-logs] span > p").eq(0).should("contain", "3: nodeinfo 1");
568 cy.get("[data-cy=process-logs] span > p").eq(1).should("contain", "2: nodeinfo 2");
569 cy.get("[data-cy=process-logs] span > p").eq(2).should("contain", "1: nodeinfo 3");
570 cy.get("[data-cy=process-logs] span > p").eq(3).should("contain", "2: nodeinfo 4");
571 cy.get("[data-cy=process-logs] span > p").eq(4).should("contain", "3: nodeinfo 5");
572 // Verify sorted logs
573 cy.get("[data-cy=process-logs] span > p").eq(5).should("contain", "2023-07-18T20:14:48.128642814Z first");
574 cy.get("[data-cy=process-logs] span > p").eq(6).should("contain", "2023-07-18T20:14:48.528642814Z second");
575 cy.get("[data-cy=process-logs] span > p").eq(7).should("contain", "2023-07-18T20:14:49.128642814Z third");
580 it("preserves original ordering of lines within the same log type", function () {
581 const crName = "test_container_request";
582 createContainerRequest(activeUser, crName, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (containerRequest) {
583 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", [
585 "2023-07-18T20:14:46.000000000Z A out 1",
586 // Comes fourth in a contiguous block
587 "2023-07-18T20:14:48.128642814Z A out 2",
588 "2023-07-18T20:14:48.128642814Z X out 3",
589 "2023-07-18T20:14:48.128642814Z A out 4",
592 cy.appendLog(adminUser.token, containerRequest.uuid, "stderr.txt", [
594 "2023-07-18T20:14:47.000000000Z Z err 1",
595 // Comes third in a contiguous block
596 "2023-07-18T20:14:48.128642814Z B err 2",
597 "2023-07-18T20:14:48.128642814Z C err 3",
598 "2023-07-18T20:14:48.128642814Z Y err 4",
599 "2023-07-18T20:14:48.128642814Z Z err 5",
600 "2023-07-18T20:14:48.128642814Z A err 6",
603 cy.loginAs(activeUser);
604 cy.goToPath(`/processes/${containerRequest.uuid}`);
605 cy.get("[data-cy=process-details]").should("contain", crName);
606 cy.get("[data-cy=process-logs]").should("contain", "No logs yet");
608 cy.getAll("@stdout", "@stderr").then(() => {
609 // Switch to All logs
610 cy.get("[data-cy=process-logs-filter]").click();
611 cy.get("body").contains("li", "All logs").click();
612 // Verify sorted logs
613 cy.get("[data-cy=process-logs] span > p").eq(0).should("contain", "2023-07-18T20:14:46.000000000Z A out 1");
614 cy.get("[data-cy=process-logs] span > p").eq(1).should("contain", "2023-07-18T20:14:47.000000000Z Z err 1");
615 cy.get("[data-cy=process-logs] span > p").eq(2).should("contain", "2023-07-18T20:14:48.128642814Z B err 2");
616 cy.get("[data-cy=process-logs] span > p").eq(3).should("contain", "2023-07-18T20:14:48.128642814Z C err 3");
617 cy.get("[data-cy=process-logs] span > p").eq(4).should("contain", "2023-07-18T20:14:48.128642814Z Y err 4");
618 cy.get("[data-cy=process-logs] span > p").eq(5).should("contain", "2023-07-18T20:14:48.128642814Z Z err 5");
619 cy.get("[data-cy=process-logs] span > p").eq(6).should("contain", "2023-07-18T20:14:48.128642814Z A err 6");
620 cy.get("[data-cy=process-logs] span > p").eq(7).should("contain", "2023-07-18T20:14:48.128642814Z A out 2");
621 cy.get("[data-cy=process-logs] span > p").eq(8).should("contain", "2023-07-18T20:14:48.128642814Z X out 3");
622 cy.get("[data-cy=process-logs] span > p").eq(9).should("contain", "2023-07-18T20:14:48.128642814Z A out 4");
627 it("correctly generates sniplines", function () {
628 const SNIPLINE = `================ ✀ ================ ✀ ========= Some log(s) were skipped ========= ✀ ================ ✀ ================`;
629 const crName = "test_container_request";
630 createContainerRequest(activeUser, crName, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (containerRequest) {
631 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", [
632 "X".repeat(63999) + "_" + "O".repeat(100) + "_" + "X".repeat(63999),
635 cy.loginAs(activeUser);
636 cy.goToPath(`/processes/${containerRequest.uuid}`);
637 cy.get("[data-cy=process-details]").should("contain", crName);
638 cy.get("[data-cy=process-logs]").should("contain", "No logs yet");
640 // Switch to stdout since lines are unsortable (no timestamp)
641 cy.get("[data-cy=process-logs-filter]").click();
642 cy.get("body").contains("li", "stdout").click();
644 cy.getAll("@stdout").then(() => {
645 // Verify first 64KB and snipline
646 cy.get("[data-cy=process-logs] span > p", { timeout: 7000 })
648 .should("contain", "X".repeat(63999) + "_\n" + SNIPLINE);
650 cy.get("[data-cy=process-logs] span > p")
652 .should("contain", "_" + "X".repeat(63999));
653 // Verify none of the Os got through
654 cy.get("[data-cy=process-logs] span > p").should("not.contain", "O");
659 it("correctly break long lines when no obvious line separation exists", function () {
660 function randomString(length) {
661 const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
663 for (let i = 0; i < length; i++) {
664 res += chars.charAt(Math.floor(Math.random() * chars.length));
669 const logLinesQty = 10;
671 for (let i = 0; i < logLinesQty; i++) {
672 const length = Math.floor(Math.random() * 500) + 500;
673 logLines.push(randomString(length));
676 createContainerRequest(activeUser, "test_container_request", "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (
679 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", logLines).as("stdoutLogs");
681 cy.getAll("@stdoutLogs").then(function () {
682 cy.loginAs(activeUser);
683 cy.goToPath(`/processes/${containerRequest.uuid}`);
684 // Select 'stdout' log filter
685 cy.get("[data-cy=process-logs-filter]").click();
686 cy.get("body").contains("li", "stdout").click();
687 cy.get("[data-cy=process-logs] span > p")
688 .should('have.length', logLinesQty)
690 expect($p.text().length).to.be.greaterThan(499);
692 // This looks like an ugly hack, but I was not able
693 // to get [client|scroll]Width attributes through
694 // the usual Cypress methods.
695 const parentClientWidth = $p[0].parentElement.clientWidth;
696 const parentScrollWidth = $p[0].parentElement.scrollWidth
697 // Scrollbar should not be visible
698 expect(parentClientWidth).to.be.eq(parentScrollWidth);
705 describe("I/O panel", function () {
709 id: "#main/input_file",
710 label: "Label Description",
715 basename: "input1.tar",
717 location: "keep:00000000000000000000000000000000+01/input1.tar",
720 basename: "input1-2.txt",
722 location: "keep:00000000000000000000000000000000+01/input1-2.txt",
725 basename: "input1-3.txt",
727 location: "keep:00000000000000000000000000000000+01/input1-3.txt",
730 basename: "input1-4.txt",
732 location: "keep:00000000000000000000000000000000+01/input1-4.txt",
740 id: "#main/input_dir",
741 doc: "Doc Description",
746 basename: "11111111111111111111111111111111+01",
748 location: "keep:11111111111111111111111111111111+01",
754 id: "#main/input_bool",
755 doc: ["Doc desc 1", "Doc desc 2"],
764 id: "#main/input_int",
773 id: "#main/input_long",
782 id: "#main/input_float",
791 id: "#main/input_double",
800 id: "#main/input_string",
804 input_string: "Hello World",
809 id: "#main/input_file_array",
818 basename: "input2.tar",
820 location: "keep:00000000000000000000000000000000+02/input2.tar",
823 basename: "input3.tar",
825 location: "keep:00000000000000000000000000000000+03/input3.tar",
828 basename: "input3-2.txt",
830 location: "keep:00000000000000000000000000000000+03/input3-2.txt",
835 $import: "import_path",
842 id: "#main/input_dir_array",
851 basename: "11111111111111111111111111111111+02",
853 location: "keep:11111111111111111111111111111111+02",
856 basename: "11111111111111111111111111111111+03",
858 location: "keep:11111111111111111111111111111111+03",
861 $import: "import_path",
868 id: "#main/input_int_array",
880 $import: "import_path",
887 id: "#main/input_long_array",
898 $import: "import_path",
905 id: "#main/input_float_array",
917 $import: "import_path",
924 id: "#main/input_double_array",
931 input_double_array: [
936 $import: "import_path",
943 id: "#main/input_string_array",
950 input_string_array: [
955 $import: "import_path",
962 id: "#main/input_bool_include",
966 input_bool_include: {
967 $include: "include_path",
973 id: "#main/input_int_include",
978 $include: "include_path",
984 id: "#main/input_float_include",
988 input_float_include: {
989 $include: "include_path",
995 id: "#main/input_string_include",
999 input_string_include: {
1000 $include: "include_path",
1006 id: "#main/input_file_include",
1010 input_file_include: {
1011 $include: "include_path",
1017 id: "#main/input_directory_include",
1021 input_directory_include: {
1022 $include: "include_path",
1028 id: "#main/input_file_url",
1033 basename: "index.html",
1035 location: "http://example.com/index.html",
1041 const testOutputs = [
1044 id: "#main/output_file",
1045 label: "Label Description",
1050 basename: "cat.png",
1052 location: "cat.png",
1058 id: "#main/output_file_with_secondary",
1059 doc: "Doc Description",
1063 output_file_with_secondary: {
1064 basename: "main.dat",
1066 location: "main.dat",
1069 basename: "secondary.dat",
1071 location: "secondary.dat",
1074 basename: "secondary2.dat",
1076 location: "secondary2.dat",
1084 id: "#main/output_dir",
1085 doc: ["Doc desc 1", "Doc desc 2"],
1090 basename: "outdir1",
1092 location: "outdir1",
1098 id: "#main/output_bool",
1107 id: "#main/output_int",
1116 id: "#main/output_long",
1125 id: "#main/output_float",
1129 output_float: 100.5,
1134 id: "#main/output_double",
1138 output_double: 100.3,
1143 id: "#main/output_string",
1147 output_string: "Hello output",
1152 id: "#main/output_file_array",
1159 output_file_array: [
1161 basename: "output2.tar",
1163 location: "output2.tar",
1166 basename: "output3.tar",
1168 location: "output3.tar",
1175 id: "#main/output_dir_array",
1184 basename: "outdir2",
1186 location: "outdir2",
1189 basename: "outdir3",
1191 location: "outdir3",
1198 id: "#main/output_int_array",
1205 output_int_array: [10, 11, 12],
1210 id: "#main/output_long_array",
1217 output_long_array: [51, 52],
1222 id: "#main/output_float_array",
1229 output_float_array: [100.2, 100.4, 100.6],
1234 id: "#main/output_double_array",
1241 output_double_array: [100.1, 100.2, 100.3],
1246 id: "#main/output_string_array",
1253 output_string_array: ["Hello", "Output", "!"],
1258 const verifyIOParameter = (name, label, doc, val, collection, multipleRows) => {
1262 .within($mainRow => {
1263 cy.get($mainRow).scrollIntoView();
1264 label && cy.contains(label);
1267 cy.get($mainRow).nextUntil('[data-cy="process-io-param"]').as("secondaryRows");
1269 if (Array.isArray(val)) {
1270 val.forEach(v => cy.get("@secondaryRows").contains(v));
1272 cy.get("@secondaryRows").contains(val);
1276 cy.get("@secondaryRows").contains(collection);
1280 if (Array.isArray(val)) {
1281 val.forEach(v => cy.contains(v));
1287 cy.contains(collection);
1293 const verifyIOParameterImage = (name, url) => {
1298 cy.get('[alt="Inline Preview"]')
1299 .should("be.visible")
1301 expect($img[0].naturalWidth).to.be.greaterThan(0);
1302 expect($img[0].src).contains(url);
1307 it("displays IO parameters with keep links and previews", function () {
1308 // Create output collection for real files
1309 cy.createCollection(adminUser.token, {
1310 name: `Test collection ${Math.floor(Math.random() * 999999)}`,
1311 owner_uuid: activeUser.user.uuid,
1312 }).then(testOutputCollection => {
1313 cy.loginAs(activeUser);
1315 cy.goToPath(`/collections/${testOutputCollection.uuid}`);
1317 cy.get("[data-cy=upload-button]").click();
1319 cy.fixture("files/cat.png", "base64").then(content => {
1320 cy.get("[data-cy=drag-and-drop]").upload(content, "cat.png");
1321 cy.get("[data-cy=form-submit-btn]").click();
1322 cy.waitForDom().get("[data-cy=form-submit-btn]").should("not.exist");
1323 // Confirm final collection state.
1324 cy.get("[data-cy=collection-files-panel]").contains("cat.png").should("exist");
1327 cy.getCollection(activeUser.token, testOutputCollection.uuid).as("testOutputCollection");
1330 // Get updated collection pdh
1331 cy.getAll("@testOutputCollection").then(([testOutputCollection]) => {
1332 // Add output uuid and inputs to container request
1333 cy.intercept({ method: "GET", url: "**/arvados/v1/container_requests/*" }, req => {
1334 req.on('response', res => {
1335 if (!res.body.mounts) {
1338 res.body.output_uuid = testOutputCollection.uuid;
1339 res.body.mounts["/var/lib/cwl/cwl.input.json"] = {
1340 content: testInputs.map(param => param.input).reduce((acc, val) => Object.assign(acc, val), {}),
1342 res.body.mounts["/var/lib/cwl/workflow.json"] = {
1347 inputs: testInputs.map(input => input.definition),
1348 outputs: testOutputs.map(output => output.definition),
1356 // Stub fake output collection
1358 { method: "GET", url: `**/arvados/v1/collections/${testOutputCollection.uuid}*` },
1362 uuid: testOutputCollection.uuid,
1363 portable_data_hash: testOutputCollection.portable_data_hash,
1368 // Stub fake output json
1370 { method: "GET", url: "**/c%3Dzzzzz-4zz18-zzzzzzzzzzzzzzz/cwl.output.json" },
1373 body: testOutputs.map(param => param.output).reduce((acc, val) => Object.assign(acc, val), {}),
1377 // Stub webdav response, points to output json
1379 { method: "PROPFIND", url: "*" },
1381 fixture: "webdav-propfind-outputs.xml",
1386 createContainerRequest(activeUser, "test_container_request", "arvados/jobs", ["echo", "hello world"], false, "Committed").as(
1390 cy.getAll("@containerRequest", "@testOutputCollection").then(function ([containerRequest, testOutputCollection]) {
1391 cy.goToPath(`/processes/${containerRequest.uuid}`);
1392 cy.get("[data-cy=process-io-card] h6")
1393 .contains("Input Parameters")
1394 .parents("[data-cy=process-io-card]")
1396 cy.get(ctx).scrollIntoView();
1397 verifyIOParameter("input_file", null, "Label Description", "input1.tar", "00000000000000000000000000000000+01");
1398 verifyIOParameter("input_file", null, "Label Description", "input1-2.txt", undefined, true);
1399 verifyIOParameter("input_file", null, "Label Description", "input1-3.txt", undefined, true);
1400 verifyIOParameter("input_file", null, "Label Description", "input1-4.txt", undefined, true);
1401 verifyIOParameter("input_dir", null, "Doc Description", "/", "11111111111111111111111111111111+01");
1402 verifyIOParameter("input_bool", null, "Doc desc 1, Doc desc 2", "true");
1403 verifyIOParameter("input_int", null, null, "1");
1404 verifyIOParameter("input_long", null, null, "1");
1405 verifyIOParameter("input_float", null, null, "1.5");
1406 verifyIOParameter("input_double", null, null, "1.3");
1407 verifyIOParameter("input_string", null, null, "Hello World");
1408 verifyIOParameter("input_file_array", null, null, "input2.tar", "00000000000000000000000000000000+02");
1409 verifyIOParameter("input_file_array", null, null, "input3.tar", undefined, true);
1410 verifyIOParameter("input_file_array", null, null, "input3-2.txt", undefined, true);
1411 verifyIOParameter("input_file_array", null, null, "Cannot display value", undefined, true);
1412 verifyIOParameter("input_dir_array", null, null, "/", "11111111111111111111111111111111+02");
1413 verifyIOParameter("input_dir_array", null, null, "/", "11111111111111111111111111111111+03", true);
1414 verifyIOParameter("input_dir_array", null, null, "Cannot display value", undefined, true);
1415 verifyIOParameter("input_int_array", null, null, ["1", "3", "5", "Cannot display value"]);
1416 verifyIOParameter("input_long_array", null, null, ["10", "20", "Cannot display value"]);
1417 verifyIOParameter("input_float_array", null, null, ["10.2", "10.4", "10.6", "Cannot display value"]);
1418 verifyIOParameter("input_double_array", null, null, ["20.1", "20.2", "20.3", "Cannot display value"]);
1419 verifyIOParameter("input_string_array", null, null, ["Hello", "World", "!", "Cannot display value"]);
1420 verifyIOParameter("input_bool_include", null, null, "Cannot display value");
1421 verifyIOParameter("input_int_include", null, null, "Cannot display value");
1422 verifyIOParameter("input_float_include", null, null, "Cannot display value");
1423 verifyIOParameter("input_string_include", null, null, "Cannot display value");
1424 verifyIOParameter("input_file_include", null, null, "Cannot display value");
1425 verifyIOParameter("input_directory_include", null, null, "Cannot display value");
1426 verifyIOParameter("input_file_url", null, null, "http://example.com/index.html");
1428 cy.get("[data-cy=process-io-card] h6")
1429 .contains("Output Parameters")
1430 .parents("[data-cy=process-io-card]")
1432 cy.get(ctx).scrollIntoView();
1433 const outPdh = testOutputCollection.portable_data_hash;
1435 verifyIOParameter("output_file", null, "Label Description", "cat.png", `${outPdh}`);
1436 // Disabled until image preview returns
1437 // verifyIOParameterImage("output_file", `/c=${outPdh}/cat.png`);
1438 verifyIOParameter("output_file_with_secondary", null, "Doc Description", "main.dat", `${outPdh}`);
1439 verifyIOParameter("output_file_with_secondary", null, "Doc Description", "secondary.dat", undefined, true);
1440 verifyIOParameter("output_file_with_secondary", null, "Doc Description", "secondary2.dat", undefined, true);
1441 verifyIOParameter("output_dir", null, "Doc desc 1, Doc desc 2", "outdir1", `${outPdh}`);
1442 verifyIOParameter("output_bool", null, null, "true");
1443 verifyIOParameter("output_int", null, null, "1");
1444 verifyIOParameter("output_long", null, null, "1");
1445 verifyIOParameter("output_float", null, null, "100.5");
1446 verifyIOParameter("output_double", null, null, "100.3");
1447 verifyIOParameter("output_string", null, null, "Hello output");
1448 verifyIOParameter("output_file_array", null, null, "output2.tar", `${outPdh}`);
1449 verifyIOParameter("output_file_array", null, null, "output3.tar", undefined, true);
1450 verifyIOParameter("output_dir_array", null, null, "outdir2", `${outPdh}`);
1451 verifyIOParameter("output_dir_array", null, null, "outdir3", undefined, true);
1452 verifyIOParameter("output_int_array", null, null, ["10", "11", "12"]);
1453 verifyIOParameter("output_long_array", null, null, ["51", "52"]);
1454 verifyIOParameter("output_float_array", null, null, ["100.2", "100.4", "100.6"]);
1455 verifyIOParameter("output_double_array", null, null, ["100.1", "100.2", "100.3"]);
1456 verifyIOParameter("output_string_array", null, null, ["Hello", "Output", "!"]);
1461 it("displays IO parameters with no value", function () {
1462 const fakeOutputUUID = "zzzzz-4zz18-abcdefghijklmno";
1463 const fakeOutputPDH = "11111111111111111111111111111111+99/";
1465 cy.loginAs(activeUser);
1467 // Add output uuid and inputs to container request
1468 cy.intercept({ method: "GET", url: "**/arvados/v1/container_requests/*" }, req => {
1469 req.on('response', res => {
1470 if (!res.body.mounts) {
1473 res.body.output_uuid = fakeOutputUUID;
1474 res.body.mounts["/var/lib/cwl/cwl.input.json"] = {
1477 res.body.mounts["/var/lib/cwl/workflow.json"] = {
1482 inputs: testInputs.map(input => input.definition),
1483 outputs: testOutputs.map(output => output.definition),
1491 // Stub fake output collection
1493 { method: "GET", url: `**/arvados/v1/collections/${fakeOutputUUID}*` },
1497 uuid: fakeOutputUUID,
1498 portable_data_hash: fakeOutputPDH,
1503 // Stub fake output json
1505 { method: "GET", url: `**/c%3D${fakeOutputUUID}/cwl.output.json` },
1512 cy.readFile("cypress/fixtures/webdav-propfind-outputs.xml").then(data => {
1513 // Stub webdav response, points to output json
1515 { method: "PROPFIND", url: "*" },
1518 body: data.replace(/zzzzz-4zz18-zzzzzzzzzzzzzzz/g, fakeOutputUUID),
1523 createContainerRequest(activeUser, "test_container_request", "arvados/jobs", ["echo", "hello world"], false, "Committed").as(
1527 cy.getAll("@containerRequest").then(function ([containerRequest]) {
1528 cy.goToPath(`/processes/${containerRequest.uuid}`);
1531 cy.get("[data-cy=process-io-card] h6")
1532 .contains("Input Parameters")
1533 .parents("[data-cy=process-io-card]")
1535 cy.get(ctx).scrollIntoView();
1539 testInputs.map((input) => {
1540 verifyIOParameter(input.definition.id.split('/').slice(-1)[0], null, null, "No value");
1543 cy.get("[data-cy=process-io-card] h6")
1544 .contains("Output Parameters")
1545 .parents("[data-cy=process-io-card]")
1547 cy.get(ctx).scrollIntoView();
1549 testOutputs.map((output) => {
1550 verifyIOParameter(output.definition.id.split('/').slice(-1)[0], null, null, "No value");