diff --git a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-global.cy.ts b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-global.cy.ts index d4bb2a5fa25..2a584e362cf 100644 --- a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-global.cy.ts +++ b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-global.cy.ts @@ -16,9 +16,27 @@ const testOperand: TestOperandProps = { exampleName: 'example-infinispan', }; +const operatorPackageName = 'datagrid'; + +const cleanupOperatorResources = () => { + cy.exec( + `oc delete subscription -l operators.coreos.com/${operatorPackageName}.${GlobalInstalledNamespace} -n ${GlobalInstalledNamespace} --ignore-not-found --wait=false`, + { failOnNonZeroExit: false, timeout: 60000 }, + ); + cy.exec( + `oc delete csv -l operators.coreos.com/${operatorPackageName}.${GlobalInstalledNamespace} -n ${GlobalInstalledNamespace} --ignore-not-found --wait=false`, + { failOnNonZeroExit: false, timeout: 60000 }, + ); + cy.exec( + `oc delete installplan -l operators.coreos.com/${operatorPackageName}.${GlobalInstalledNamespace} -n ${GlobalInstalledNamespace} --ignore-not-found --wait=false`, + { failOnNonZeroExit: false, timeout: 60000 }, + ); +}; + describe(`Globally installing "${testOperator.name}" operator in ${GlobalInstalledNamespace}`, () => { before(() => { cy.login(); + cleanupOperatorResources(); operator.install(testOperator.name, testOperator.operatorCardTestID); }); @@ -26,6 +44,10 @@ describe(`Globally installing "${testOperator.name}" operator in ${GlobalInstall checkErrors(); }); + after(() => { + cleanupOperatorResources(); + }); + it(`Globally installs ${testOperator.name} operator in ${GlobalInstalledNamespace} and creates ${testOperand.name} operand`, () => { operator.installedSucceeded(testOperator.name); operator.navToDetailsPage(testOperator.name); diff --git a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-single-namespace.cy.ts b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-single-namespace.cy.ts index 976945c29e4..01e50380b3b 100644 --- a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-single-namespace.cy.ts +++ b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-single-namespace.cy.ts @@ -18,10 +18,28 @@ const testOperand: TestOperandProps = { exampleName: 'example-backup', }; +const operatorPackageName = 'datagrid'; + +const cleanupOperatorResources = (namespace: string) => { + cy.exec( + `oc delete subscription -l operators.coreos.com/${operatorPackageName}.${namespace} -n ${namespace} --ignore-not-found --wait=false`, + { failOnNonZeroExit: false, timeout: 60000 }, + ); + cy.exec( + `oc delete csv -l operators.coreos.com/${operatorPackageName}.${namespace} -n ${namespace} --ignore-not-found --wait=false`, + { failOnNonZeroExit: false, timeout: 60000 }, + ); + cy.exec( + `oc delete installplan -l operators.coreos.com/${operatorPackageName}.${namespace} -n ${namespace} --ignore-not-found --wait=false`, + { failOnNonZeroExit: false, timeout: 60000 }, + ); +}; + describe(`Installing "${testOperator.name}" operator in test namespace`, () => { before(() => { cy.login(); cy.createProjectWithCLI(testName); + cleanupOperatorResources(testName); }); afterEach(() => { @@ -29,6 +47,7 @@ describe(`Installing "${testOperator.name}" operator in test namespace`, () => { }); after(() => { + cleanupOperatorResources(testName); cy.deleteProjectWithCLI(testName); });