-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Internal Mode Installation Test to Cypress
- Loading branch information
Showing
7 changed files
with
119 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
frontend/packages/ceph-storage-plugin/integration-tests-cypress/support/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import * as _ from 'lodash'; | ||
import '../../../integration-tests-cypress/support/index.ts'; | ||
|
||
declare global { | ||
namespace Cypress { | ||
interface Chainable<Subject> { | ||
install(mode?: 'Internal' | 'Attached', encrypted?: boolean): Chainable<Element>; | ||
uninstall(): Chainable<Element>; | ||
} | ||
} | ||
} | ||
|
||
Cypress.Commands.add('install', (mode: 'Internal' | 'Attached' = 'Internal', encrypted = false) => { | ||
cy.log('Search in Operator Hub'); | ||
cy.clickNavLink(['Operators', 'OperatorHub']); | ||
cy.byTestID('search-operatorhub').type('Openshift Container Storage'); | ||
cy.byTestID('ocs-operator-redhat-operators-openshift-marketplace').click(); | ||
|
||
cy.log('Subscribe to OCS Operator'); | ||
cy.byLegacyTestID('operator-install-btn').click({ force: true }); | ||
cy.byTestID('Operator recommended namespace:-radio-input').should('be.checked'); | ||
cy.byTestID('enable-monitoring').click(); | ||
cy.byTestID('install-operator').click(); | ||
cy.byTestID('success-icon', { timeout: 180000 }).should('be.visible'); | ||
cy.exec('oc get project openshift-storage -o json').then((res) => { | ||
const obj = JSON.parse(res.stdout); | ||
expect(obj.metadata.labels?.['openshift.io/cluster-monitoring']).toEqual('true'); | ||
}); | ||
// Rook, Noobaa and OCS pod should come up after installation. | ||
cy.exec('oc get po -n openshift-storage -o json').then((res) => { | ||
const { items } = JSON.parse(res.stdout); | ||
expect(items.find((item) => _.startsWith(item.metadata.name, 'noobaa-operator'))).toBeDefined(); | ||
expect(items.find((item) => _.startsWith(item.metadata.name, 'ocs-operator'))).toBeDefined(); | ||
expect( | ||
items.find((item) => _.startsWith(item.metadata.name, 'rook-ceph-operator')), | ||
).toBeDefined(); | ||
}); | ||
|
||
// Make changes to this once we add annotation | ||
cy.log(`Install OCS in ${mode} Mode`); | ||
cy.clickNavLink(['Installed Operators']); | ||
cy.byLegacyTestID('item-filter').type('ocs-operator'); | ||
cy.byTestOperatorRow('OpenShift Container Storage').click(); | ||
cy.byLegacyTestID('horizontal-link-Storage Cluster').click(); | ||
cy.byTestID('yaml-create').click(); | ||
|
||
cy.log(`Select ${mode}`); | ||
cy.byTestID('Internal-radio-input').should('be.checked'); | ||
|
||
// Step 1 | ||
// Select all worker Nodes | ||
cy.get('input[name=check-all]').click(); | ||
// Two dropdowns in the same page. | ||
// (Todo: )make dropdown data-test-id be something that can be passed as a prop | ||
cy.byLegacyTestID('dropdown-button') | ||
.first() | ||
.click(); | ||
cy.byTestDropDownMenu('512Gi').click(); | ||
cy.get('.pf-c-button.pf-m-primary') | ||
.contains('Next') | ||
.click(); | ||
|
||
// Step 2 | ||
if (encrypted) { | ||
cy.log('Enabling Encryption'); | ||
cy.byTestID('encryption-checkbox').click(); | ||
} | ||
cy.get('.pf-c-button.pf-m-primary') | ||
.contains('Next') | ||
.click(); | ||
|
||
// Final Step | ||
cy.get('.pf-c-button.pf-m-primary') | ||
.contains('Create') | ||
.click(); | ||
|
||
// Check worker nodes for labels | ||
cy.exec('oc get nodes -o json').then((res) => { | ||
const { items } = JSON.parse(res.stdout); | ||
items | ||
.map((item) => item.metadata.labels) | ||
.filter((item) => item.hasOwnProperty('node-role.kubernetes.io/worker')) | ||
.forEach((item) => | ||
expect(item.hasOwnProperty('cluster.ocs.openshift.io/openshift-storage')).toBeTruthy(), | ||
); | ||
}); | ||
|
||
// Wait for the storage cluster to reach Ready | ||
// Storage Cluster CR flickers so wait for 10 seconds | ||
// Disablng until ocs-operator fixes above issue | ||
// eslint-disable-next-line cypress/no-unnecessary-waiting | ||
cy.wait(10000); | ||
|
||
cy.byTestID('resource-status').contains('Ready', { timeout: 900000 }); | ||
}); |
20 changes: 20 additions & 0 deletions
20
frontend/packages/ceph-storage-plugin/integration-tests-cypress/tests/ocs-converged.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { checkErrors } from '../../../integration-tests-cypress/support'; | ||
|
||
describe('OCS Operator Basic Tests', () => { | ||
before(() => { | ||
cy.login(); | ||
cy.visit('/'); | ||
|
||
cy.install(); | ||
}); | ||
|
||
afterEach(() => { | ||
checkErrors(); | ||
}); | ||
|
||
after(() => { | ||
cy.logout(); | ||
}); | ||
|
||
it('Add capacity to Storage Cluster', () => {}); | ||
}); |
44 changes: 0 additions & 44 deletions
44
...end/packages/ceph-storage-plugin/integration-tests-cypress/tests/subscribe-to-ocs.spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters