From dc4d734c0327bf26daa40e0f40c65053216ee733 Mon Sep 17 00:00:00 2001 From: Ishwar Kanse Date: Wed, 14 May 2025 15:08:28 +0530 Subject: [PATCH] Fix DT_CONSOLE_IMAGE var assertion --- tests/tests/dt-plugin-tests.cy.ts | 50 +++++++++++++++++-------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/tests/tests/dt-plugin-tests.cy.ts b/tests/tests/dt-plugin-tests.cy.ts index c8d0dcb..5048a88 100644 --- a/tests/tests/dt-plugin-tests.cy.ts +++ b/tests/tests/dt-plugin-tests.cy.ts @@ -139,29 +139,33 @@ describe('OpenShift Distributed Tracing UI Plugin tests', () => { throw new Error('No CYPRESS env set for operator installation, check the README for more details.'); } - cy.log('DT_CONSOLE_IMAGE is set. the image will be patched in COO operator CSV'); - cy.exec( - './fixtures/update-plugin-image.sh', - { - env: { - DT_CONSOLE_IMAGE: Cypress.env('DT_CONSOLE_IMAGE'), - KUBECONFIG: Cypress.env('KUBECONFIG_PATH'), - DTP_NAMESPACE: `${DTP.namespace}` - }, - timeout: 120000, - failOnNonZeroExit: false - } - ) .then((result) => { - // The command has completed - // 'result' is an object containing: - // - stdout: The standard output of the command - // - stderr: The standard error of the command - // - code: The exit code of the command (0 for success) - // - signal: The signal that terminated the command, if any - - expect(result.code).to.eq(0); // Assert that the command was successful - cy.log(`COO CSV updated successfully with Distributed Tracing Console Plugin image: ${result.stdout}`); - }); + if (Cypress.env('DT_CONSOLE_IMAGE')) { + cy.log('DT_CONSOLE_IMAGE is set. the image will be patched in COO operator CSV'); + cy.exec( + './fixtures/update-plugin-image.sh', + { + env: { + DT_CONSOLE_IMAGE: Cypress.env('DT_CONSOLE_IMAGE'), + KUBECONFIG: Cypress.env('KUBECONFIG_PATH'), + DTP_NAMESPACE: `${DTP.namespace}` + }, + timeout: 120000, + failOnNonZeroExit: false + } + ) .then((result) => { + // The command has completed + // 'result' is an object containing: + // - stdout: The standard output of the command + // - stderr: The standard error of the command + // - code: The exit code of the command (0 for success) + // - signal: The signal that terminated the command, if any + + expect(result.code).to.eq(0); // Assert that the command was successful + cy.log(`COO CSV updated successfully with Distributed Tracing Console Plugin image: ${result.stdout}`); + }); + } else { + cy.log('DT_CONSOLE_IMAGE is NOT set. Skipping patching the image in COO operator CSV.'); + } cy.log('Create Distributed Tracing UI Plugin instance.'); cy.exec(`oc apply -f ./fixtures/tracing-ui-plugin.yaml --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`);