From 45b386e1334e92ca3bfdef0a772ce0109928f2ae Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 20 Jun 2024 15:28:52 -0400 Subject: [PATCH] 15814: Fix request intercepts that assume certain field in response During teardown, the intercept is still active but requests may return 404 from upstream, causing the intercept that modifies the reponse to fail. Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- services/workbench2/cypress/e2e/process.cy.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/workbench2/cypress/e2e/process.cy.js b/services/workbench2/cypress/e2e/process.cy.js index 8ec099b52b..89e6e2a494 100644 --- a/services/workbench2/cypress/e2e/process.cy.js +++ b/services/workbench2/cypress/e2e/process.cy.js @@ -118,6 +118,9 @@ describe("Process tests", function () { // object. cy.intercept({ method: "GET", url: "**/arvados/v1/groups/*/contents?*" }, req => { req.on('response', res => { + if (!res.body.items) { + return; + } res.body.items.forEach(item => { item.modified_by_user_uuid = "zzzzz-tpzed-000000000000000"; }); @@ -1329,6 +1332,9 @@ describe("Process tests", function () { // Add output uuid and inputs to container request cy.intercept({ method: "GET", url: "**/arvados/v1/container_requests/*" }, req => { req.on('response', res => { + if (!res.body.mounts) { + return; + } res.body.output_uuid = testOutputCollection.uuid; res.body.mounts["/var/lib/cwl/cwl.input.json"] = { content: testInputs.map(param => param.input).reduce((acc, val) => Object.assign(acc, val), {}), @@ -1461,6 +1467,9 @@ describe("Process tests", function () { // Add output uuid and inputs to container request cy.intercept({ method: "GET", url: "**/arvados/v1/container_requests/*" }, req => { req.on('response', res => { + if (!res.body.mounts) { + return; + } res.body.output_uuid = fakeOutputUUID; res.body.mounts["/var/lib/cwl/cwl.input.json"] = { content: {}, -- 2.30.2