From 125e665c9e798686f841b6e3604139831b941317 Mon Sep 17 00:00:00 2001
From: Robb Hamilton
Date: Tue, 18 Apr 2023 13:46:21 -0400
Subject: [PATCH] OCPBUGS-10562: re-enable operator-uninstall.spec.ts and
improve other tests
---
.../tests/catalog-source-details.spec.ts | 4 +-
.../tests/create-namespace.spec.ts | 6 +--
.../tests/descriptors.spec.ts | 33 +++++++--------
.../tests/edit-default-sources.spec.ts | 3 +-
.../tests/operator-hub.spec.ts | 6 +--
.../tests/operator-install-global.spec.ts | 17 ++++----
.../operator-install-single-namespace.spec.ts | 24 ++++++-----
.../tests/operator-uninstall.spec.ts | 24 +++++------
.../views/operator.view.ts | 10 +++--
.../modals/uninstall-operator-modal.tsx | 42 +++++++++----------
10 files changed, 82 insertions(+), 87 deletions(-)
diff --git a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/catalog-source-details.spec.ts b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/catalog-source-details.spec.ts
index 49d8a6491ccf..5ff4afac0924 100644
--- a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/catalog-source-details.spec.ts
+++ b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/catalog-source-details.spec.ts
@@ -15,7 +15,7 @@ describe(`Interacting with CatalogSource page`, () => {
cy.visit('/');
nav.sidenav.switcher.changePerspectiveTo('Administrator');
nav.sidenav.switcher.shouldHaveText('Administrator');
- cy.createProject(testName);
+ cy.exec(`oc new-project ${testName}`);
create(testCatalogSource);
});
@@ -38,7 +38,7 @@ describe(`Interacting with CatalogSource page`, () => {
});
after(() => {
- cy.deleteProject(testName);
+ cy.exec(`oc delete project ${testName}`);
cy.logout();
});
diff --git a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/create-namespace.spec.ts b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/create-namespace.spec.ts
index 29bdd7959740..19ec50fb2fbd 100644
--- a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/create-namespace.spec.ts
+++ b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/create-namespace.spec.ts
@@ -8,7 +8,7 @@ describe('Create namespace from install operators', () => {
cy.visit('/');
nav.sidenav.switcher.changePerspectiveTo('Administrator');
nav.sidenav.switcher.shouldHaveText('Administrator');
- cy.createProject(testName);
+ cy.exec(`oc new-project ${testName}`);
});
afterEach(() => {
@@ -16,7 +16,7 @@ describe('Create namespace from install operators', () => {
});
after(() => {
- cy.deleteProject(testName);
+ cy.exec(`oc delete project ${testName}`);
cy.logout();
});
@@ -58,6 +58,6 @@ describe('Create namespace from install operators', () => {
);
// Verify namespace was created successfully
- cy.deleteProject(nsName);
+ cy.exec(`oc delete project ${nsName}`);
});
});
diff --git a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/descriptors.spec.ts b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/descriptors.spec.ts
index c8c1da7dbbc8..d5eb3e4ea73b 100644
--- a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/descriptors.spec.ts
+++ b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/descriptors.spec.ts
@@ -9,13 +9,12 @@ describe('Using OLM descriptor components', () => {
cy.visit('/');
nav.sidenav.switcher.changePerspectiveTo('Administrator');
nav.sidenav.switcher.shouldHaveText('Administrator');
- cy.createProject(testName);
+ cy.exec(`oc new-project ${testName}`);
create(testCRD);
create(testCSV);
});
afterEach(() => {
- cy.visit('/');
cy.exec(`oc delete ${testCRD.spec.names.kind} ${testCR.metadata.name} -n ${testName}`);
checkErrors();
});
@@ -23,7 +22,7 @@ describe('Using OLM descriptor components', () => {
after(() => {
cy.exec(`oc delete crd ${testCRD.metadata.name}`);
cy.exec(`oc delete -n ${testName} clusterserviceversion ${testCSV.metadata.name}`);
- cy.deleteProject(testName);
+ cy.exec(`oc delete project ${testName}`);
cy.logout();
});
@@ -55,20 +54,18 @@ describe('Using OLM descriptor components', () => {
const getOperandFormFieldLabel = (id) => cy.get(`[for=${id}]`);
const getOperandFormFieldInput = (id) => cy.get(`#${id}`);
+ const {
+ group,
+ names: { kind },
+ } = testCRD.spec;
+ const version = testCRD.spec.versions[0].name;
+ const URL = `/k8s/ns/${testName}/operators.coreos.com~v1alpha1~ClusterServiceVersion/${testCSV.metadata.name}/${group}~${version}~${kind}`;
+
it('displays list and detail views of an operand', () => {
create(testCR);
- cy.visit(
- `/k8s/ns/${testName}/operators.coreos.com~v1alpha1~ClusterServiceVersion/${testCSV.metadata.name}/${testCRD.spec.group}~${testCRD.spec.versions[0].name}~${testCRD.spec.names.kind}`,
- );
+ cy.visit(URL);
cy.byTestOperandLink('olm-descriptors-test').should('exist');
- const {
- group,
- names: { kind },
- } = testCRD.spec;
- const version = testCRD.spec.versions[0].name;
- cy.visit(
- `/k8s/ns/${testName}/operators.coreos.com~v1alpha1~ClusterServiceVersion/${testCSV.metadata.name}/${group}~${version}~${kind}/${testCR.metadata.name}`,
- );
+ cy.visit(`${URL}/${testCR.metadata.name}`);
cy.byLegacyTestID('resource-title').should('have.text', `${testCR.metadata.name}`);
testCSV.spec.customresourcedefinitions.owned[0].specDescriptors.forEach((descriptor) => {
if (descriptor.path === 'hidden') {
@@ -90,9 +87,11 @@ describe('Using OLM descriptor components', () => {
});
it('creates an operand using the form', () => {
- cy.visit(
- `/k8s/ns/${testName}/operators.coreos.com~v1alpha1~ClusterServiceVersion/${testCSV.metadata.name}/${testCRD.spec.group}~${testCRD.spec.versions[0].name}~${testCRD.spec.names.kind}`,
- );
+ // enure the app is loaded before visting the form
+ cy.visit('/');
+ nav.sidenav.switcher.changePerspectiveTo('Administrator');
+ nav.sidenav.switcher.shouldHaveText('Administrator');
+ cy.visit(URL);
// TODO figure out why this element is detaching
cy.byTestID('item-create').click({ force: true });
cy.byLegacyTestID('resource-title').should('have.text', 'Create App');
diff --git a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/edit-default-sources.spec.ts b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/edit-default-sources.spec.ts
index f9525cde8235..f5ae09ab2d94 100644
--- a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/edit-default-sources.spec.ts
+++ b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/edit-default-sources.spec.ts
@@ -1,6 +1,7 @@
import { checkErrors } from '../../../integration-tests-cypress/support';
import { detailsPage } from '../../../integration-tests-cypress/views/details-page';
import { modal } from '../../../integration-tests-cypress/views/modal';
+import { nav } from '../../../integration-tests-cypress/views/nav';
describe('Create namespace from install operators', () => {
before(() => {
@@ -17,7 +18,7 @@ describe('Create namespace from install operators', () => {
it('disables default catalog sources from operatorHub details page', () => {
cy.log('navigate to operatorHub page');
- cy.visit(`/settings/cluster`);
+ nav.sidenav.clickNavLink(['Administration', 'Cluster Settings']);
cy.byLegacyTestID('horizontal-link-Configuration').click();
cy.byLegacyTestID('OperatorHub').click();
diff --git a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-hub.spec.ts b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-hub.spec.ts
index c4ad8d9e1a56..d9d034077a62 100644
--- a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-hub.spec.ts
+++ b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-hub.spec.ts
@@ -1,4 +1,4 @@
-import { checkErrors, testName } from '../../../integration-tests-cypress/support';
+import { checkErrors } from '../../../integration-tests-cypress/support';
import { nav } from '../../../integration-tests-cypress/views/nav';
describe('Interacting with OperatorHub', () => {
@@ -7,7 +7,6 @@ describe('Interacting with OperatorHub', () => {
cy.visit('/');
nav.sidenav.switcher.changePerspectiveTo('Administrator');
nav.sidenav.switcher.shouldHaveText('Administrator');
- cy.createProject(testName);
});
afterEach(() => {
@@ -15,14 +14,13 @@ describe('Interacting with OperatorHub', () => {
});
after(() => {
- cy.deleteProject(testName);
cy.logout();
});
it('displays OperatorHub tile view with expected available Operators', () => {
cy.log('navigate to OperatorHub');
nav.sidenav.clickNavLink(['Operators', 'OperatorHub']);
- cy.url().should('include', `/operatorhub/ns/${testName}`);
+ cy.url().should('include', '/operatorhub/all-namespaces');
cy.log('more than one tile should be present');
cy.get('.catalog-tile-pf').its('length').should('be.gt', 0);
});
diff --git a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-global.spec.ts b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-global.spec.ts
index 013e4d0cd577..af47395a9afb 100644
--- a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-global.spec.ts
+++ b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-global.spec.ts
@@ -3,18 +3,17 @@ import { nav } from '../../../integration-tests-cypress/views/nav';
import { operator, GlobalInstalledNamespace, TestOperandProps } from '../views/operator.view';
const testOperator = {
- name: 'Service Binding Operator',
- operatorHubCardTestID: 'rh-service-binding-operator-redhat-operators-openshift-marketplace',
+ name: 'Data Grid',
+ operatorHubCardTestID: 'datagrid-redhat-operators-openshift-marketplace',
};
const testOperand: TestOperandProps = {
- name: 'ServiceBinding',
- group: 'binding.operators.coreos.com',
- version: 'v1alpha1',
- kind: 'ServiceBinding',
- createActionID:
- 'list-page-create-dropdown-item-binding.operators.coreos.com~v1alpha1~ServiceBinding',
- exampleName: 'example-servicebinding',
+ name: 'Infinispan',
+ group: 'infinispan.org',
+ version: 'v1',
+ kind: 'Infinispan',
+ createActionID: 'list-page-create-dropdown-item-infinispan.org~v1~Infinispan',
+ exampleName: 'example-infinispan',
};
describe(`Globally installing "${testOperator.name}" operator in ${GlobalInstalledNamespace}`, () => {
diff --git a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-single-namespace.spec.ts b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-single-namespace.spec.ts
index f9ca0e5b6494..f26750c3d29f 100644
--- a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-single-namespace.spec.ts
+++ b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-install-single-namespace.spec.ts
@@ -5,17 +5,17 @@ import { nav } from '../../../integration-tests-cypress/views/nav';
import { GlobalInstalledNamespace, operator, TestOperandProps } from '../views/operator.view';
const testOperator = {
- name: 'Red Hat Integration - 3scale',
- operatorHubCardTestID: '3scale-operator-redhat-operators-openshift-marketplace',
+ name: 'Data Grid',
+ operatorHubCardTestID: 'datagrid-redhat-operators-openshift-marketplace',
installedNamespace: testName,
};
const testOperand: TestOperandProps = {
- name: '3scale Backend',
- group: 'capabilities.3scale.net',
- version: 'v1beta1',
- kind: 'Backend',
- exampleName: `backend1-sample`,
+ name: 'Backup',
+ group: 'infinispan.org',
+ version: 'v1',
+ kind: 'Backup',
+ exampleName: 'example-backup',
};
describe(`Installing "${testOperator.name}" operator in test namespace`, () => {
@@ -24,7 +24,7 @@ describe(`Installing "${testOperator.name}" operator in test namespace`, () => {
cy.visit('/');
nav.sidenav.switcher.changePerspectiveTo('Administrator');
nav.sidenav.switcher.shouldHaveText('Administrator');
- cy.createProject(testName);
+ cy.exec(`oc new-project ${testName}`);
});
afterEach(() => {
@@ -32,9 +32,8 @@ describe(`Installing "${testOperator.name}" operator in test namespace`, () => {
});
after(() => {
- operator.uninstall(testOperator.name, testOperator.installedNamespace);
- operator.shouldNotExist(testOperator.name, testOperator.installedNamespace);
- cy.deleteProject(testName);
+ cy.visit('/');
+ cy.exec(`oc delete project ${testName}`);
cy.logout();
});
@@ -77,5 +76,8 @@ describe(`Installing "${testOperator.name}" operator in test namespace`, () => {
operator.deleteOperand(testOperator.name, testOperand, testOperator.installedNamespace);
operator.operandShouldNotExist(testOperator.name, testOperand, testOperator.installedNamespace);
+
+ operator.uninstall(testOperator.name, testOperator.installedNamespace);
+ operator.shouldNotExist(testOperator.name, testOperator.installedNamespace);
});
});
diff --git a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-uninstall.spec.ts b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-uninstall.spec.ts
index 58e8a301898c..70930752a0d9 100644
--- a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-uninstall.spec.ts
+++ b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/tests/operator-uninstall.spec.ts
@@ -4,20 +4,19 @@ import { modal } from '../../../integration-tests-cypress/views/modal';
import { nav } from '../../../integration-tests-cypress/views/nav';
import { operator, TestOperandProps } from '../views/operator.view';
-// TODO Update to valid operator. This is deprecated.
const testOperator = {
- name: 'Business Automation',
- operatorHubCardTestID: 'businessautomation-operator-redhat-operators-openshift-marketplace',
+ name: 'Data Grid',
+ operatorHubCardTestID: 'datagrid-redhat-operators-openshift-marketplace',
installedNamespace: testName,
};
const testOperand: TestOperandProps = {
- name: 'KieApp',
- kind: 'KieApp',
- group: 'KieApp',
+ name: 'Backup',
+ group: 'infinispan.org',
version: 'v1',
- exampleName: `example-kieappk`,
- deleteURL: '/api/kubernetes/apis/app.kiegroup.org/*/namespaces/*/kieapps/*',
+ kind: 'Backup',
+ exampleName: 'example-backup',
+ deleteURL: '/api/kubernetes/apis/infinispan.org/*/namespaces/*/backups/*',
};
const alertExists = (titleText: string) => {
@@ -37,13 +36,13 @@ const uninstallAndVerify = () => {
cy.resourceShouldBeDeleted(testName, testOperand.kind, testOperand.exampleName);
};
-xdescribe(`Testing uninstall of ${testOperator.name} Operator`, () => {
+describe(`Testing uninstall of ${testOperator.name} Operator`, () => {
before(() => {
cy.login();
cy.visit('/');
nav.sidenav.switcher.changePerspectiveTo('Administrator');
nav.sidenav.switcher.shouldHaveText('Administrator');
- cy.createProject(testName);
+ cy.exec(`oc new-project ${testName}`);
operator.install(
testOperator.name,
testOperator.operatorHubCardTestID,
@@ -64,10 +63,7 @@ xdescribe(`Testing uninstall of ${testOperator.name} Operator`, () => {
});
after(() => {
- cy.visit('/');
- nav.sidenav.switcher.changePerspectiveTo('Administrator');
- nav.sidenav.switcher.shouldHaveText('Administrator');
- cy.deleteProject(testName);
+ cy.exec(`oc delete project ${testName}`);
cy.logout();
});
diff --git a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/views/operator.view.ts b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/views/operator.view.ts
index 59dc1dc9702f..6b147761e840 100644
--- a/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/views/operator.view.ts
+++ b/frontend/packages/operator-lifecycle-manager/integration-tests-cypress/views/operator.view.ts
@@ -52,8 +52,10 @@ export const operator = {
} else {
cy.byTestID('All namespaces on the cluster-radio-input').should('be.checked');
}
- if (!useOperatorRecommendedNamespace) {
- cy.log(`verify namespace dropdown shows the "${installToNamespace}" namespace`);
+ if (installToNamespace !== GlobalInstalledNamespace && !useOperatorRecommendedNamespace) {
+ cy.byTestID('dropdown-selectbox').click();
+ cy.byLegacyTestID('dropdown-text-filter').type(installToNamespace);
+ cy.byTestID('dropdown-menu-item-link').click();
cy.byTestID('dropdown-selectbox').should('contain', installToNamespace);
}
// Install
@@ -74,7 +76,7 @@ export const operator = {
nav.sidenav.clickNavLink(['Operators', 'Installed Operators']);
listPage.titleShouldHaveText('Installed Operators');
listPage.filter.byName(operatorName);
- cy.byTestOperatorRow(operatorName, { timeout: 180000 }).should('exist'); // 3 minutes
+ cy.byTestOperatorRow(operatorName, { timeout: 300000 }).should('exist'); // 5 minutes
listPage.rows.countShouldBe(1);
cy.byTestID('status-text', { timeout: 720000 }).should('contain.text', 'Succeeded'); // 12 minutes
},
@@ -144,7 +146,7 @@ export const operator = {
}
cy.byTestID(exampleName).should('exist');
cy.log(`navigate to the operand "Details" tab`);
- cy.byTestID(exampleName).click();
+ cy.byTestID(exampleName).click({ force: true });
cy.url().should('match', new RegExp(`${exampleName}$`)); // url should end with example operand name
},
deleteOperand: (
diff --git a/frontend/packages/operator-lifecycle-manager/src/components/modals/uninstall-operator-modal.tsx b/frontend/packages/operator-lifecycle-manager/src/components/modals/uninstall-operator-modal.tsx
index f1c9eb0d1a10..73221d8f3fbe 100644
--- a/frontend/packages/operator-lifecycle-manager/src/components/modals/uninstall-operator-modal.tsx
+++ b/frontend/packages/operator-lifecycle-manager/src/components/modals/uninstall-operator-modal.tsx
@@ -461,8 +461,8 @@ const OperandsLoadedErrorAlert: React.FC<{ operandsLoadedErrorMessage: string }>
{t(
'olm~There was an error loading operands for this operator. Operands will need to be deleted manually.',
)}
- {operandsLoadedErrorMessage}
+ {operandsLoadedErrorMessage}
);
};
@@ -582,27 +582,25 @@ const OperandsTable: React.FC = ({ operands, loaded, csvName
{operands
.sort((a, b) => a.metadata.name.localeCompare(b.metadata.name))
.map((operand) => (
- <>
-
-
-
- |
-
- {operand.kind}
- |
-
- {operand.metadata.namespace ? (
-
- ) : (
- '-'
- )}
- |
-
- >
+
+
+
+ |
+
+ {operand.kind}
+ |
+
+ {operand.metadata.namespace ? (
+
+ ) : (
+ '-'
+ )}
+ |
+
))}