-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Soigned-off-by: gshanmug <gshanmug@redhat.com>
- Loading branch information
1 parent
6069717
commit e869e42
Showing
6 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
frontend/packages/ceph-storage-plugin/integration-tests-cypress/tests/multiple-pool.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,44 @@ | ||
import { checkErrors } from '../../../integration-tests-cypress/support'; | ||
import { storagePool } from '../views/multiple-pool'; | ||
|
||
// Pool var | ||
const poolName: string = 'example.pool'; | ||
const replicaCount: string = '2'; | ||
|
||
describe('Test Ceph pool creation', () => { | ||
before(() => { | ||
cy.login(); | ||
cy.visit('/'); | ||
cy.install(); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.visit('/'); | ||
cy.clickNavLink(['Storage', 'StorageClasses']); | ||
cy.byTestID('item-create').click(); | ||
}); | ||
|
||
after(() => { | ||
cy.logout(); | ||
}); | ||
|
||
afterEach(() => { | ||
checkErrors(); | ||
}); | ||
|
||
it('Check for a new pool creation', () => { | ||
cy.log('Test creation of a new pool'); | ||
storagePool.prepareStorageClassForm(); | ||
storagePool.create(poolName, replicaCount, 'POOL_CREATED'); | ||
|
||
cy.log('Verify a newly created pool'); | ||
storagePool.verify(poolName, replicaCount); | ||
|
||
cy.log('Try to create a new pool with already existing name'); | ||
storagePool.prepareStorageClassForm(); | ||
storagePool.create(poolName, replicaCount, 'POOL_DUPLICATED'); | ||
|
||
cy.log('Deleting a pool'); | ||
storagePool.delete(poolName); | ||
}); | ||
}); |
2 changes: 2 additions & 0 deletions
2
frontend/packages/ceph-storage-plugin/integration-tests-cypress/utils/consts.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,2 @@ | ||
// OCS namespace | ||
export const NS = 'openshift-storage'; |
72 changes: 72 additions & 0 deletions
72
frontend/packages/ceph-storage-plugin/integration-tests-cypress/views/multiple-pool.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,72 @@ | ||
import { NS } from '../utils/consts'; | ||
import { modal } from '../../../integration-tests-cypress/views/modal'; | ||
|
||
// Create storage class from | ||
export const storagePoolDropdown: string = 'pool-dropdown-toggle'; | ||
|
||
// Create new pool form | ||
export const poolNameTextBox: string = 'new-pool-name-textbox'; | ||
export const replicaDropdown: string = 'replica-dropdown'; | ||
export const confirmAction: string = 'confirm-action'; | ||
|
||
// Pool status | ||
export const emptyStateBody: string = 'empty-state-body'; | ||
|
||
export const poolMessage = { | ||
PROGRESS: | ||
'The creation of an OCS storage cluster is still in progress or have failed please try again after the storage cluster is ready to use.', | ||
POOL_START: (poolName) => `Pool ${poolName} creation in progress`, | ||
POOL_DUPLICATED: (poolName) => `Pool "${poolName}" already exists`, | ||
POOL_CREATED: (poolName) => `Pool ${poolName} was successfully created`, | ||
}; | ||
|
||
export const storagePool = { | ||
prepareStorageClassForm: () => { | ||
// Select provisioner | ||
cy.byTestID('storage-class-provisioner-dropdown').click(); | ||
cy.byLegacyTestID('dropdown-text-filter').type('openshift-storage.rbd.csi.ceph.com'); | ||
cy.byTestID('dropdown-menu-item-link').should('contain', 'openshift-storage.rbd.csi.ceph.com'); | ||
cy.byTestID('dropdown-menu-item-link').click(); | ||
// Open a storage pool creation form | ||
cy.byTestID(storagePoolDropdown).click(); | ||
cy.byTestID('create-new-pool-button').click(); | ||
}, | ||
create: (poolName: string, replicaCount: string, poolCreationJobStatus: string) => { | ||
// Make sure the storage pool creation form is open | ||
modal.modalTitleShouldContain('Create New Storage Pool'); | ||
modal.submitShouldBeDisabled(); | ||
modal.shouldBeOpened(); | ||
|
||
cy.byTestID(poolNameTextBox) | ||
.clear() | ||
.type(poolName); | ||
cy.byTestID(replicaDropdown) | ||
.click() | ||
.byLegacyTestID(replicaCount) | ||
.click(); | ||
|
||
// Create new pool | ||
cy.byTestID(confirmAction) | ||
.last() | ||
.click(); | ||
|
||
// Validations | ||
storagePool.validate(emptyStateBody, poolMessage.POOL_START(poolName)); | ||
storagePool.validate(emptyStateBody, poolMessage[poolCreationJobStatus](poolName)); | ||
|
||
// Close a pool creation form | ||
cy.byTestID(confirmAction) | ||
.last() | ||
.click(); | ||
}, | ||
delete: (poolName: string) => cy.exec(`oc delete CephBlockPool ${poolName} -n ${NS}`), | ||
verify: (poolName: string, replicaCount: string) => { | ||
cy.byTestID(storagePoolDropdown).click(); | ||
const poolDropdownItem = [poolName, `Replica ${replicaCount} no compression`]; | ||
const regex = new RegExp(`${poolDropdownItem.join('|')}`, 'g'); | ||
storagePool.validate(poolName, regex); | ||
cy.byTestID(storagePoolDropdown).click(); | ||
}, | ||
validate: (elementId: string, expectedValue: any) => | ||
cy.byTestID(elementId).contains(expectedValue), | ||
}; |
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