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_user_uuid: "zzzzz-tpzed-000000000000000",
250 modified_at: "2023-02-15T19:12:45.987086000Z",
252 "arvados-cwl-runner",
255 "--project-uuid=zzzzz-j7d0g-yr18k784zplfeza",
256 "/var/lib/cwl/workflow.json#main",
257 "/var/lib/cwl/cwl.input.json",
259 container_image: "4ad7d11381df349e464694762db14e04+303",
260 cwd: "/var/spool/cwl",
264 locked_by_uuid: null,
267 output_path: "/var/spool/cwl",
269 runtime_constraints: {
274 hardware_capability: "",
276 keep_cache_disk: 2147483648,
284 scheduling_parameters: {
289 runtime_user_uuid: "zzzzz-tpzed-vllbpebicy84rd5",
290 runtime_auth_scopes: ["all"],
292 gateway_address: null,
293 interactive_session_started: false,
294 output_storage_classes: ["default"],
295 output_properties: {},
297 subrequests_cost: 0.0,
300 it("shows cancel button when appropriate", function () {
301 // Ignore collection requests
303 { method: "GET", url: `**/arvados/v1/collections/*` },
310 // Uncommitted container
311 const crUncommitted = `Test process ${Math.floor(Math.random() * 999999)}`;
312 createContainerRequest(activeUser, crUncommitted, "arvados/jobs", ["echo", "hello world"], false, "Uncommitted").then(function (
315 cy.loginAs(activeUser);
316 // Navigate to process and verify run / cancel button
317 cy.goToPath(`/processes/${containerRequest.uuid}`);
319 cy.get("[data-cy=process-details]").should("contain", crUncommitted);
320 cy.get("[data-cy=process-run-button]").should("exist");
321 cy.get("[data-cy=process-cancel-button]").should("not.exist");
325 const crQueued = `Test process ${Math.floor(Math.random() * 999999)}`;
326 const fakeCrUuid = "zzzzz-dz642-000000000000001";
327 createContainerRequest(activeUser, crQueued, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (
330 // Fake container uuid
331 cy.intercept({ method: "GET", url: `**/arvados/v1/container_requests/${containerRequest.uuid}` }, req => {
332 req.on('response', res => {
333 res.body.output_uuid = fakeCrUuid;
334 res.body.priority = 500;
335 res.body.state = "Committed";
340 const container = getFakeContainer(fakeCrUuid);
342 { method: "GET", url: `**/arvados/v1/container/${fakeCrUuid}` },
345 body: { ...container, state: "Queued", priority: 500 },
349 // Navigate to process and verify cancel button
350 cy.goToPath(`/processes/${containerRequest.uuid}`);
352 cy.get("[data-cy=process-details]").should("contain", crQueued);
353 cy.get("[data-cy=process-cancel-button]").contains("Cancel");
357 const crLocked = `Test process ${Math.floor(Math.random() * 999999)}`;
358 const fakeCrLockedUuid = "zzzzz-dz642-000000000000002";
359 createContainerRequest(activeUser, crLocked, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (
362 // Fake container uuid
363 cy.intercept({ method: "GET", url: `**/arvados/v1/container_requests/${containerRequest.uuid}` }, req => {
364 req.on('response', res => {
365 res.body.output_uuid = fakeCrLockedUuid;
366 res.body.priority = 500;
367 res.body.state = "Committed";
372 const container = getFakeContainer(fakeCrLockedUuid);
374 { method: "GET", url: `**/arvados/v1/container/${fakeCrLockedUuid}` },
377 body: { ...container, state: "Locked", priority: 500 },
381 // Navigate to process and verify cancel button
382 cy.goToPath(`/processes/${containerRequest.uuid}`);
384 cy.get("[data-cy=process-details]").should("contain", crLocked);
385 cy.get("[data-cy=process-cancel-button]").contains("Cancel");
389 const crOnHold = `Test process ${Math.floor(Math.random() * 999999)}`;
390 const fakeCrOnHoldUuid = "zzzzz-dz642-000000000000003";
391 createContainerRequest(activeUser, crOnHold, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (
394 // Fake container uuid
395 cy.intercept({ method: "GET", url: `**/arvados/v1/container_requests/${containerRequest.uuid}` }, req => {
396 req.on('response', res => {
397 res.body.output_uuid = fakeCrOnHoldUuid;
398 res.body.priority = 0;
399 res.body.state = "Committed";
404 const container = getFakeContainer(fakeCrOnHoldUuid);
406 { method: "GET", url: `**/arvados/v1/container/${fakeCrOnHoldUuid}` },
409 body: { ...container, state: "Queued", priority: 0 },
413 // Navigate to process and verify cancel button
414 cy.goToPath(`/processes/${containerRequest.uuid}`);
416 cy.get("[data-cy=process-details]").should("contain", crOnHold);
417 cy.get("[data-cy=process-run-button]").should("exist");
418 cy.get("[data-cy=process-cancel-button]").should("not.exist");
423 describe("Logs panel", function () {
424 it("shows live process logs", function () {
425 cy.intercept({ method: "GET", url: "**/arvados/v1/containers/*" }, req => {
426 req.on('response', res => {
427 res.body.state = ContainerState.RUNNING;
431 const crName = "test_container_request";
432 createContainerRequest(activeUser, crName, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (containerRequest) {
433 // Create empty log file before loading process page
434 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", [""]);
436 cy.loginAs(activeUser);
437 cy.goToPath(`/processes/${containerRequest.uuid}`);
438 cy.get("[data-cy=process-details]").should("contain", crName);
439 cy.get("[data-cy=process-logs]").should("contain", "No logs yet").and("not.contain", "hello world");
442 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", ["2023-07-18T20:14:48.128642814Z hello world"]).then(() => {
443 cy.get("[data-cy=process-logs]", { timeout: 7000 }).should("not.contain", "No logs yet").and("contain", "hello world");
446 // Append new log line to different file
447 cy.appendLog(adminUser.token, containerRequest.uuid, "stderr.txt", ["2023-07-18T20:14:49.128642814Z hello new line"]).then(() => {
448 cy.get("[data-cy=process-logs]", { timeout: 7000 }).should("not.contain", "No logs yet").and("contain", "hello new line");
453 it("filters process logs by event type", function () {
454 const nodeInfoLogs = [
456 "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",
459 "vendor_id : GenuineIntel",
462 "model name : Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz",
464 const crunchRunLogs = [
465 "2022-03-22T13:56:22.542417997Z using local keepstore process (pid 3733) at http://localhost:46837, writing logs to keepstore.txt in log collection",
466 "2022-03-22T13:56:26.237571754Z crunch-run 2.4.0~dev20220321141729 (go1.17.1) started",
467 "2022-03-22T13:56:26.244704134Z crunch-run process has uid=0(root) gid=0(root) groups=0(root)",
468 "2022-03-22T13:56:26.244862836Z Executing container 'zzzzz-dz642-1wokwvcct9s9du3' using docker runtime",
469 "2022-03-22T13:56:26.245037738Z Executing on host 'compute-99cb150b26149780de44b929577e1aed-19rgca8vobuvc4p'",
472 "2022-03-22T13:56:22.542417987Z Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dui nisi, hendrerit porta sapien a, pretium dignissim purus.",
473 "2022-03-22T13:56:22.542417997Z Integer viverra, mauris finibus aliquet ultricies, dui mauris cursus justo, ut venenatis nibh ex eget neque.",
474 "2022-03-22T13:56:22.542418007Z In hac habitasse platea dictumst.",
475 "2022-03-22T13:56:22.542418027Z Fusce fringilla turpis id accumsan faucibus. Donec congue congue ex non posuere. In semper mi quis tristique rhoncus.",
476 "2022-03-22T13:56:22.542418037Z Interdum et malesuada fames ac ante ipsum primis in faucibus.",
477 "2022-03-22T13:56:22.542418047Z Quisque fermentum tortor ex, ut suscipit velit feugiat faucibus.",
478 "2022-03-22T13:56:22.542418057Z Donec vitae porta risus, at luctus nulla. Mauris gravida iaculis ipsum, id sagittis tortor egestas ac.",
479 "2022-03-22T13:56:22.542418067Z Maecenas condimentum volutpat nulla. Integer lacinia maximus risus eu posuere.",
480 "2022-03-22T13:56:22.542418077Z Donec vitae leo id augue gravida bibendum.",
481 "2022-03-22T13:56:22.542418087Z Nam libero libero, pretium ac faucibus elementum, mattis nec ex.",
482 "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.",
483 "2022-03-22T13:56:22.542418107Z Aliquam viverra nisi nulla, et efficitur dolor mattis in.",
484 "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.",
485 "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.",
486 "2022-03-22T13:56:22.542418137Z Phasellus non ex quis arcu tempus faucibus molestie in sapien.",
487 "2022-03-22T13:56:22.542418147Z Duis tristique semper dolor, vitae pulvinar risus.",
488 "2022-03-22T13:56:22.542418157Z Aliquam tortor elit, luctus nec tortor eget, porta tristique nulla.",
489 "2022-03-22T13:56:22.542418167Z Nulla eget mollis ipsum.",
492 createContainerRequest(activeUser, "test_container_request", "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (
495 cy.appendLog(adminUser.token, containerRequest.uuid, "node-info.txt", nodeInfoLogs).as("nodeInfoLogs");
496 cy.appendLog(adminUser.token, containerRequest.uuid, "crunch-run.txt", crunchRunLogs).as("crunchRunLogs");
497 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", stdoutLogs).as("stdoutLogs");
499 cy.getAll("@stdoutLogs", "@nodeInfoLogs", "@crunchRunLogs").then(function () {
500 cy.loginAs(activeUser);
501 cy.goToPath(`/processes/${containerRequest.uuid}`);
502 // Should show main logs by default
503 cy.get("[data-cy=process-logs-filter]", { timeout: 7000 }).should("contain", "Main logs");
504 cy.get("[data-cy=process-logs]")
505 .should("contain", stdoutLogs[Math.floor(Math.random() * stdoutLogs.length)])
506 .and("not.contain", nodeInfoLogs[Math.floor(Math.random() * nodeInfoLogs.length)])
507 .and("contain", crunchRunLogs[Math.floor(Math.random() * crunchRunLogs.length)]);
509 cy.get("[data-cy=process-logs-filter]").click();
510 cy.get("body").contains("li", "All logs").click();
511 cy.get("[data-cy=process-logs]")
512 .should("contain", stdoutLogs[Math.floor(Math.random() * stdoutLogs.length)])
513 .and("contain", nodeInfoLogs[Math.floor(Math.random() * nodeInfoLogs.length)])
514 .and("contain", crunchRunLogs[Math.floor(Math.random() * crunchRunLogs.length)]);
515 // Select 'node-info' logs
516 cy.get("[data-cy=process-logs-filter]").click();
517 cy.get("body").contains("li", "node-info").click();
518 cy.get("[data-cy=process-logs]")
519 .should("not.contain", stdoutLogs[Math.floor(Math.random() * stdoutLogs.length)])
520 .and("contain", nodeInfoLogs[Math.floor(Math.random() * nodeInfoLogs.length)])
521 .and("not.contain", crunchRunLogs[Math.floor(Math.random() * crunchRunLogs.length)]);
522 // Select 'stdout' logs
523 cy.get("[data-cy=process-logs-filter]").click();
524 cy.get("body").contains("li", "stdout").click();
525 cy.get("[data-cy=process-logs]")
526 .should("contain", stdoutLogs[Math.floor(Math.random() * stdoutLogs.length)])
527 .and("not.contain", nodeInfoLogs[Math.floor(Math.random() * nodeInfoLogs.length)])
528 .and("not.contain", crunchRunLogs[Math.floor(Math.random() * crunchRunLogs.length)]);
533 it("sorts combined logs", function () {
534 const crName = "test_container_request";
535 createContainerRequest(activeUser, crName, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (containerRequest) {
536 cy.appendLog(adminUser.token, containerRequest.uuid, "node-info.txt", [
544 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", [
545 "2023-07-18T20:14:48.128642814Z first",
546 "2023-07-18T20:14:49.128642814Z third",
549 cy.appendLog(adminUser.token, containerRequest.uuid, "stderr.txt", ["2023-07-18T20:14:48.528642814Z second"]).as("stderr");
551 cy.loginAs(activeUser);
552 cy.goToPath(`/processes/${containerRequest.uuid}`);
553 cy.get("[data-cy=process-details]").should("contain", crName);
554 cy.get("[data-cy=process-logs]").should("contain", "No logs yet");
556 cy.getAll("@node-info", "@stdout", "@stderr").then(() => {
557 // Verify sorted main logs
558 cy.get("[data-cy=process-logs] span > p", { timeout: 7000 }).eq(0).should("contain", "2023-07-18T20:14:48.128642814Z first");
559 cy.get("[data-cy=process-logs] span > p").eq(1).should("contain", "2023-07-18T20:14:48.528642814Z second");
560 cy.get("[data-cy=process-logs] span > p").eq(2).should("contain", "2023-07-18T20:14:49.128642814Z third");
562 // Switch to All logs
563 cy.get("[data-cy=process-logs-filter]").click();
564 cy.get("body").contains("li", "All logs").click();
565 // Verify non-sorted lines were preserved
566 cy.get("[data-cy=process-logs] span > p").eq(0).should("contain", "3: nodeinfo 1");
567 cy.get("[data-cy=process-logs] span > p").eq(1).should("contain", "2: nodeinfo 2");
568 cy.get("[data-cy=process-logs] span > p").eq(2).should("contain", "1: nodeinfo 3");
569 cy.get("[data-cy=process-logs] span > p").eq(3).should("contain", "2: nodeinfo 4");
570 cy.get("[data-cy=process-logs] span > p").eq(4).should("contain", "3: nodeinfo 5");
571 // Verify sorted logs
572 cy.get("[data-cy=process-logs] span > p").eq(5).should("contain", "2023-07-18T20:14:48.128642814Z first");
573 cy.get("[data-cy=process-logs] span > p").eq(6).should("contain", "2023-07-18T20:14:48.528642814Z second");
574 cy.get("[data-cy=process-logs] span > p").eq(7).should("contain", "2023-07-18T20:14:49.128642814Z third");
579 it("preserves original ordering of lines within the same log type", function () {
580 const crName = "test_container_request";
581 createContainerRequest(activeUser, crName, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (containerRequest) {
582 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", [
584 "2023-07-18T20:14:46.000000000Z A out 1",
585 // Comes fourth in a contiguous block
586 "2023-07-18T20:14:48.128642814Z A out 2",
587 "2023-07-18T20:14:48.128642814Z X out 3",
588 "2023-07-18T20:14:48.128642814Z A out 4",
591 cy.appendLog(adminUser.token, containerRequest.uuid, "stderr.txt", [
593 "2023-07-18T20:14:47.000000000Z Z err 1",
594 // Comes third in a contiguous block
595 "2023-07-18T20:14:48.128642814Z B err 2",
596 "2023-07-18T20:14:48.128642814Z C err 3",
597 "2023-07-18T20:14:48.128642814Z Y err 4",
598 "2023-07-18T20:14:48.128642814Z Z err 5",
599 "2023-07-18T20:14:48.128642814Z A err 6",
602 cy.loginAs(activeUser);
603 cy.goToPath(`/processes/${containerRequest.uuid}`);
604 cy.get("[data-cy=process-details]").should("contain", crName);
605 cy.get("[data-cy=process-logs]").should("contain", "No logs yet");
607 cy.getAll("@stdout", "@stderr").then(() => {
608 // Switch to All logs
609 cy.get("[data-cy=process-logs-filter]").click();
610 cy.get("body").contains("li", "All logs").click();
611 // Verify sorted logs
612 cy.get("[data-cy=process-logs] span > p").eq(0).should("contain", "2023-07-18T20:14:46.000000000Z A out 1");
613 cy.get("[data-cy=process-logs] span > p").eq(1).should("contain", "2023-07-18T20:14:47.000000000Z Z err 1");
614 cy.get("[data-cy=process-logs] span > p").eq(2).should("contain", "2023-07-18T20:14:48.128642814Z B err 2");
615 cy.get("[data-cy=process-logs] span > p").eq(3).should("contain", "2023-07-18T20:14:48.128642814Z C err 3");
616 cy.get("[data-cy=process-logs] span > p").eq(4).should("contain", "2023-07-18T20:14:48.128642814Z Y err 4");
617 cy.get("[data-cy=process-logs] span > p").eq(5).should("contain", "2023-07-18T20:14:48.128642814Z Z err 5");
618 cy.get("[data-cy=process-logs] span > p").eq(6).should("contain", "2023-07-18T20:14:48.128642814Z A err 6");
619 cy.get("[data-cy=process-logs] span > p").eq(7).should("contain", "2023-07-18T20:14:48.128642814Z A out 2");
620 cy.get("[data-cy=process-logs] span > p").eq(8).should("contain", "2023-07-18T20:14:48.128642814Z X out 3");
621 cy.get("[data-cy=process-logs] span > p").eq(9).should("contain", "2023-07-18T20:14:48.128642814Z A out 4");
626 it("correctly generates sniplines", function () {
627 const SNIPLINE = `================ ✀ ================ ✀ ========= Some log(s) were skipped ========= ✀ ================ ✀ ================`;
628 const crName = "test_container_request";
629 createContainerRequest(activeUser, crName, "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (containerRequest) {
630 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", [
631 "X".repeat(63999) + "_" + "O".repeat(100) + "_" + "X".repeat(63999),
634 cy.loginAs(activeUser);
635 cy.goToPath(`/processes/${containerRequest.uuid}`);
636 cy.get("[data-cy=process-details]").should("contain", crName);
637 cy.get("[data-cy=process-logs]").should("contain", "No logs yet");
639 // Switch to stdout since lines are unsortable (no timestamp)
640 cy.get("[data-cy=process-logs-filter]").click();
641 cy.get("body").contains("li", "stdout").click();
643 cy.getAll("@stdout").then(() => {
644 // Verify first 64KB and snipline
645 cy.get("[data-cy=process-logs] span > p", { timeout: 7000 })
647 .should("contain", "X".repeat(63999) + "_\n" + SNIPLINE);
649 cy.get("[data-cy=process-logs] span > p")
651 .should("contain", "_" + "X".repeat(63999));
652 // Verify none of the Os got through
653 cy.get("[data-cy=process-logs] span > p").should("not.contain", "O");
658 it("correctly break long lines when no obvious line separation exists", function () {
659 function randomString(length) {
660 const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
662 for (let i = 0; i < length; i++) {
663 res += chars.charAt(Math.floor(Math.random() * chars.length));
668 const logLinesQty = 10;
670 for (let i = 0; i < logLinesQty; i++) {
671 const length = Math.floor(Math.random() * 500) + 500;
672 logLines.push(randomString(length));
675 createContainerRequest(activeUser, "test_container_request", "arvados/jobs", ["echo", "hello world"], false, "Committed").then(function (
678 cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", logLines).as("stdoutLogs");
680 cy.getAll("@stdoutLogs").then(function () {
681 cy.loginAs(activeUser);
682 cy.goToPath(`/processes/${containerRequest.uuid}`);
683 // Select 'stdout' log filter
684 cy.get("[data-cy=process-logs-filter]").click();
685 cy.get("body").contains("li", "stdout").click();
686 cy.get("[data-cy=process-logs] span > p")
687 .should('have.length', logLinesQty)
689 expect($p.text().length).to.be.greaterThan(499);
691 // This looks like an ugly hack, but I was not able
692 // to get [client|scroll]Width attributes through
693 // the usual Cypress methods.
694 const parentClientWidth = $p[0].parentElement.clientWidth;
695 const parentScrollWidth = $p[0].parentElement.scrollWidth
696 // Scrollbar should not be visible
697 expect(parentClientWidth).to.be.eq(parentScrollWidth);
704 describe("I/O panel", function () {
708 id: "#main/input_file",
709 label: "Label Description",
714 basename: "input1.tar",
716 location: "keep:00000000000000000000000000000000+01/input1.tar",
719 basename: "input1-2.txt",
721 location: "keep:00000000000000000000000000000000+01/input1-2.txt",
724 basename: "input1-3.txt",
726 location: "keep:00000000000000000000000000000000+01/input1-3.txt",
729 basename: "input1-4.txt",
731 location: "keep:00000000000000000000000000000000+01/input1-4.txt",
739 id: "#main/input_dir",
740 doc: "Doc Description",
745 basename: "11111111111111111111111111111111+01",
747 location: "keep:11111111111111111111111111111111+01",
753 id: "#main/input_bool",
754 doc: ["Doc desc 1", "Doc desc 2"],
763 id: "#main/input_int",
772 id: "#main/input_long",
781 id: "#main/input_float",
790 id: "#main/input_double",
799 id: "#main/input_string",
803 input_string: "Hello World",
808 id: "#main/input_file_array",
817 basename: "input2.tar",
819 location: "keep:00000000000000000000000000000000+02/input2.tar",
822 basename: "input3.tar",
824 location: "keep:00000000000000000000000000000000+03/input3.tar",
827 basename: "input3-2.txt",
829 location: "keep:00000000000000000000000000000000+03/input3-2.txt",
834 $import: "import_path",
841 id: "#main/input_dir_array",
850 basename: "11111111111111111111111111111111+02",
852 location: "keep:11111111111111111111111111111111+02",
855 basename: "11111111111111111111111111111111+03",
857 location: "keep:11111111111111111111111111111111+03",
860 $import: "import_path",
867 id: "#main/input_int_array",
879 $import: "import_path",
886 id: "#main/input_long_array",
897 $import: "import_path",
904 id: "#main/input_float_array",
916 $import: "import_path",
923 id: "#main/input_double_array",
930 input_double_array: [
935 $import: "import_path",
942 id: "#main/input_string_array",
949 input_string_array: [
954 $import: "import_path",
961 id: "#main/input_bool_include",
965 input_bool_include: {
966 $include: "include_path",
972 id: "#main/input_int_include",
977 $include: "include_path",
983 id: "#main/input_float_include",
987 input_float_include: {
988 $include: "include_path",
994 id: "#main/input_string_include",
998 input_string_include: {
999 $include: "include_path",
1005 id: "#main/input_file_include",
1009 input_file_include: {
1010 $include: "include_path",
1016 id: "#main/input_directory_include",
1020 input_directory_include: {
1021 $include: "include_path",
1027 id: "#main/input_file_url",
1032 basename: "index.html",
1034 location: "http://example.com/index.html",
1040 const testOutputs = [
1043 id: "#main/output_file",
1044 label: "Label Description",
1049 basename: "cat.png",
1051 location: "cat.png",
1057 id: "#main/output_file_with_secondary",
1058 doc: "Doc Description",
1062 output_file_with_secondary: {
1063 basename: "main.dat",
1065 location: "main.dat",
1068 basename: "secondary.dat",
1070 location: "secondary.dat",
1073 basename: "secondary2.dat",
1075 location: "secondary2.dat",
1083 id: "#main/output_dir",
1084 doc: ["Doc desc 1", "Doc desc 2"],
1089 basename: "outdir1",
1091 location: "outdir1",
1097 id: "#main/output_bool",
1106 id: "#main/output_int",
1115 id: "#main/output_long",
1124 id: "#main/output_float",
1128 output_float: 100.5,
1133 id: "#main/output_double",
1137 output_double: 100.3,
1142 id: "#main/output_string",
1146 output_string: "Hello output",
1151 id: "#main/output_file_array",
1158 output_file_array: [
1160 basename: "output2.tar",
1162 location: "output2.tar",
1165 basename: "output3.tar",
1167 location: "output3.tar",
1174 id: "#main/output_dir_array",
1183 basename: "outdir2",
1185 location: "outdir2",
1188 basename: "outdir3",
1190 location: "outdir3",
1197 id: "#main/output_int_array",
1204 output_int_array: [10, 11, 12],
1209 id: "#main/output_long_array",
1216 output_long_array: [51, 52],
1221 id: "#main/output_float_array",
1228 output_float_array: [100.2, 100.4, 100.6],
1233 id: "#main/output_double_array",
1240 output_double_array: [100.1, 100.2, 100.3],
1245 id: "#main/output_string_array",
1252 output_string_array: ["Hello", "Output", "!"],
1257 const verifyIOParameter = (name, label, doc, val, collection, multipleRows) => {
1261 .within($mainRow => {
1262 cy.get($mainRow).scrollIntoView();
1263 label && cy.contains(label);
1266 cy.get($mainRow).nextUntil('[data-cy="process-io-param"]').as("secondaryRows");
1268 if (Array.isArray(val)) {
1269 val.forEach(v => cy.get("@secondaryRows").contains(v));
1271 cy.get("@secondaryRows").contains(val);
1275 cy.get("@secondaryRows").contains(collection);
1279 if (Array.isArray(val)) {
1280 val.forEach(v => cy.contains(v));
1286 cy.contains(collection);
1292 const verifyIOParameterImage = (name, url) => {
1297 cy.get('[alt="Inline Preview"]')
1298 .should("be.visible")
1300 expect($img[0].naturalWidth).to.be.greaterThan(0);
1301 expect($img[0].src).contains(url);
1306 it("displays IO parameters with keep links and previews", function () {
1307 // Create output collection for real files
1308 cy.createCollection(adminUser.token, {
1309 name: `Test collection ${Math.floor(Math.random() * 999999)}`,
1310 owner_uuid: activeUser.user.uuid,
1311 }).then(testOutputCollection => {
1312 cy.loginAs(activeUser);
1314 cy.goToPath(`/collections/${testOutputCollection.uuid}`);
1316 cy.get("[data-cy=upload-button]").click();
1318 cy.fixture("files/cat.png", "base64").then(content => {
1319 cy.get("[data-cy=drag-and-drop]").upload(content, "cat.png");
1320 cy.get("[data-cy=form-submit-btn]").click();
1321 cy.waitForDom().get("[data-cy=form-submit-btn]").should("not.exist");
1322 // Confirm final collection state.
1323 cy.get("[data-cy=collection-files-panel]").contains("cat.png").should("exist");
1326 cy.getCollection(activeUser.token, testOutputCollection.uuid).as("testOutputCollection");
1329 // Get updated collection pdh
1330 cy.getAll("@testOutputCollection").then(([testOutputCollection]) => {
1331 // Add output uuid and inputs to container request
1332 cy.intercept({ method: "GET", url: "**/arvados/v1/container_requests/*" }, req => {
1333 req.on('response', res => {
1334 if (!res.body.mounts) {
1337 res.body.output_uuid = testOutputCollection.uuid;
1338 res.body.mounts["/var/lib/cwl/cwl.input.json"] = {
1339 content: testInputs.map(param => param.input).reduce((acc, val) => Object.assign(acc, val), {}),
1341 res.body.mounts["/var/lib/cwl/workflow.json"] = {
1346 inputs: testInputs.map(input => input.definition),
1347 outputs: testOutputs.map(output => output.definition),
1355 // Stub fake output collection
1357 { method: "GET", url: `**/arvados/v1/collections/${testOutputCollection.uuid}*` },
1361 uuid: testOutputCollection.uuid,
1362 portable_data_hash: testOutputCollection.portable_data_hash,
1367 // Stub fake output json
1369 { method: "GET", url: "**/c%3Dzzzzz-4zz18-zzzzzzzzzzzzzzz/cwl.output.json" },
1372 body: testOutputs.map(param => param.output).reduce((acc, val) => Object.assign(acc, val), {}),
1376 // Stub webdav response, points to output json
1378 { method: "PROPFIND", url: "*" },
1380 fixture: "webdav-propfind-outputs.xml",
1385 createContainerRequest(activeUser, "test_container_request", "arvados/jobs", ["echo", "hello world"], false, "Committed").as(
1389 cy.getAll("@containerRequest", "@testOutputCollection").then(function ([containerRequest, testOutputCollection]) {
1390 cy.goToPath(`/processes/${containerRequest.uuid}`);
1391 cy.get("[data-cy=process-io-card] h6")
1392 .contains("Input Parameters")
1393 .parents("[data-cy=process-io-card]")
1395 cy.get(ctx).scrollIntoView();
1396 verifyIOParameter("input_file", null, "Label Description", "input1.tar", "00000000000000000000000000000000+01");
1397 verifyIOParameter("input_file", null, "Label Description", "input1-2.txt", undefined, true);
1398 verifyIOParameter("input_file", null, "Label Description", "input1-3.txt", undefined, true);
1399 verifyIOParameter("input_file", null, "Label Description", "input1-4.txt", undefined, true);
1400 verifyIOParameter("input_dir", null, "Doc Description", "/", "11111111111111111111111111111111+01");
1401 verifyIOParameter("input_bool", null, "Doc desc 1, Doc desc 2", "true");
1402 verifyIOParameter("input_int", null, null, "1");
1403 verifyIOParameter("input_long", null, null, "1");
1404 verifyIOParameter("input_float", null, null, "1.5");
1405 verifyIOParameter("input_double", null, null, "1.3");
1406 verifyIOParameter("input_string", null, null, "Hello World");
1407 verifyIOParameter("input_file_array", null, null, "input2.tar", "00000000000000000000000000000000+02");
1408 verifyIOParameter("input_file_array", null, null, "input3.tar", undefined, true);
1409 verifyIOParameter("input_file_array", null, null, "input3-2.txt", undefined, true);
1410 verifyIOParameter("input_file_array", null, null, "Cannot display value", undefined, true);
1411 verifyIOParameter("input_dir_array", null, null, "/", "11111111111111111111111111111111+02");
1412 verifyIOParameter("input_dir_array", null, null, "/", "11111111111111111111111111111111+03", true);
1413 verifyIOParameter("input_dir_array", null, null, "Cannot display value", undefined, true);
1414 verifyIOParameter("input_int_array", null, null, ["1", "3", "5", "Cannot display value"]);
1415 verifyIOParameter("input_long_array", null, null, ["10", "20", "Cannot display value"]);
1416 verifyIOParameter("input_float_array", null, null, ["10.2", "10.4", "10.6", "Cannot display value"]);
1417 verifyIOParameter("input_double_array", null, null, ["20.1", "20.2", "20.3", "Cannot display value"]);
1418 verifyIOParameter("input_string_array", null, null, ["Hello", "World", "!", "Cannot display value"]);
1419 verifyIOParameter("input_bool_include", null, null, "Cannot display value");
1420 verifyIOParameter("input_int_include", null, null, "Cannot display value");
1421 verifyIOParameter("input_float_include", null, null, "Cannot display value");
1422 verifyIOParameter("input_string_include", null, null, "Cannot display value");
1423 verifyIOParameter("input_file_include", null, null, "Cannot display value");
1424 verifyIOParameter("input_directory_include", null, null, "Cannot display value");
1425 verifyIOParameter("input_file_url", null, null, "http://example.com/index.html");
1427 cy.get("[data-cy=process-io-card] h6")
1428 .contains("Output Parameters")
1429 .parents("[data-cy=process-io-card]")
1431 cy.get(ctx).scrollIntoView();
1432 const outPdh = testOutputCollection.portable_data_hash;
1434 verifyIOParameter("output_file", null, "Label Description", "cat.png", `${outPdh}`);
1435 // Disabled until image preview returns
1436 // verifyIOParameterImage("output_file", `/c=${outPdh}/cat.png`);
1437 verifyIOParameter("output_file_with_secondary", null, "Doc Description", "main.dat", `${outPdh}`);
1438 verifyIOParameter("output_file_with_secondary", null, "Doc Description", "secondary.dat", undefined, true);
1439 verifyIOParameter("output_file_with_secondary", null, "Doc Description", "secondary2.dat", undefined, true);
1440 verifyIOParameter("output_dir", null, "Doc desc 1, Doc desc 2", "outdir1", `${outPdh}`);
1441 verifyIOParameter("output_bool", null, null, "true");
1442 verifyIOParameter("output_int", null, null, "1");
1443 verifyIOParameter("output_long", null, null, "1");
1444 verifyIOParameter("output_float", null, null, "100.5");
1445 verifyIOParameter("output_double", null, null, "100.3");
1446 verifyIOParameter("output_string", null, null, "Hello output");
1447 verifyIOParameter("output_file_array", null, null, "output2.tar", `${outPdh}`);
1448 verifyIOParameter("output_file_array", null, null, "output3.tar", undefined, true);
1449 verifyIOParameter("output_dir_array", null, null, "outdir2", `${outPdh}`);
1450 verifyIOParameter("output_dir_array", null, null, "outdir3", undefined, true);
1451 verifyIOParameter("output_int_array", null, null, ["10", "11", "12"]);
1452 verifyIOParameter("output_long_array", null, null, ["51", "52"]);
1453 verifyIOParameter("output_float_array", null, null, ["100.2", "100.4", "100.6"]);
1454 verifyIOParameter("output_double_array", null, null, ["100.1", "100.2", "100.3"]);
1455 verifyIOParameter("output_string_array", null, null, ["Hello", "Output", "!"]);
1460 it("displays IO parameters with no value", function () {
1461 const fakeOutputUUID = "zzzzz-4zz18-abcdefghijklmno";
1462 const fakeOutputPDH = "11111111111111111111111111111111+99/";
1464 cy.loginAs(activeUser);
1466 // Add output uuid and inputs to container request
1467 cy.intercept({ method: "GET", url: "**/arvados/v1/container_requests/*" }, req => {
1468 req.on('response', res => {
1469 if (!res.body.mounts) {
1472 res.body.output_uuid = fakeOutputUUID;
1473 res.body.mounts["/var/lib/cwl/cwl.input.json"] = {
1476 res.body.mounts["/var/lib/cwl/workflow.json"] = {
1481 inputs: testInputs.map(input => input.definition),
1482 outputs: testOutputs.map(output => output.definition),
1490 // Stub fake output collection
1492 { method: "GET", url: `**/arvados/v1/collections/${fakeOutputUUID}*` },
1496 uuid: fakeOutputUUID,
1497 portable_data_hash: fakeOutputPDH,
1502 // Stub fake output json
1504 { method: "GET", url: `**/c%3D${fakeOutputUUID}/cwl.output.json` },
1511 cy.readFile("cypress/fixtures/webdav-propfind-outputs.xml").then(data => {
1512 // Stub webdav response, points to output json
1514 { method: "PROPFIND", url: "*" },
1517 body: data.replace(/zzzzz-4zz18-zzzzzzzzzzzzzzz/g, fakeOutputUUID),
1522 createContainerRequest(activeUser, "test_container_request", "arvados/jobs", ["echo", "hello world"], false, "Committed").as(
1526 cy.getAll("@containerRequest").then(function ([containerRequest]) {
1527 cy.goToPath(`/processes/${containerRequest.uuid}`);
1530 cy.get("[data-cy=process-io-card] h6")
1531 .contains("Input Parameters")
1532 .parents("[data-cy=process-io-card]")
1534 cy.get(ctx).scrollIntoView();
1538 testInputs.map((input) => {
1539 verifyIOParameter(input.definition.id.split('/').slice(-1)[0], null, null, "No value");
1542 cy.get("[data-cy=process-io-card] h6")
1543 .contains("Output Parameters")
1544 .parents("[data-cy=process-io-card]")
1546 cy.get(ctx).scrollIntoView();
1548 testOutputs.map((output) => {
1549 verifyIOParameter(output.definition.id.split('/').slice(-1)[0], null, null, "No value");