-
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.
- Loading branch information
Showing
4 changed files
with
186 additions
and
1 deletion.
There are no files selected for viewing
140 changes: 140 additions & 0 deletions
140
frontend/packages/kubevirt-plugin/integration-tests-cypress/tests/pvc-upload/pvc-upload.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,140 @@ | ||
import { testName } from '../../support'; | ||
import { TEMPLATE_BASE_IMAGE, TEMPLATE_NAME, OS_IMAGES_NS } from '../../const/index'; | ||
import { ProvisionSource } from '../../enums/provisionSource'; | ||
import { VirtualMachineData } from '../../types/vm'; | ||
import { virtualization } from '../../view/virtualization'; | ||
import { pvc } from '../../view/pvc'; | ||
import { vm } from '../../view/vm'; | ||
|
||
const imageFormats = ['/tmp/cirros.iso', '/tmp/cirros.gz', '/tmp/cirros.xz']; | ||
const invalidImage = '/tmp/cirros.txt'; | ||
const os = 'Red Hat Enterprise Linux 6.0 or higher - Default data image already exists'; | ||
const vmData: VirtualMachineData = { | ||
name: `pvc-test-vm-${testName}`, | ||
namespace: testName, | ||
template: TEMPLATE_NAME, | ||
sshEnable: false, | ||
startOnCreation: true, | ||
sourceAvailable: true, | ||
}; | ||
|
||
describe('kubevirt PVC upload', () => { | ||
before(() => { | ||
cy.viewport(1536, 960); | ||
cy.Login(); | ||
cy.visit('/'); | ||
cy.createProject(testName); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteResource({ | ||
kind: 'DataVolume', | ||
metadata: { | ||
name: TEMPLATE_BASE_IMAGE, | ||
namespace: OS_IMAGES_NS, | ||
}, | ||
}); | ||
cy.deleteResource({ | ||
kind: 'VirtualMachine', | ||
metadata: { | ||
name: vmData.name, | ||
namespace: vmData.namespace, | ||
}, | ||
}); | ||
cy.exec('rm -fr /tmp/cirror*'); | ||
}); | ||
|
||
describe('test pvc upload via form', () => { | ||
it('ID(CNV-4778) No warning message shows when image format is supported', () => { | ||
pvc.form.open(); | ||
for (const img of imageFormats) { | ||
cy.exec(`touch ${img} || true`); | ||
cy.dropFile(img, img.split('/').pop(), '.pf-c-file-upload'); | ||
cy.get('.pf-c-alert__title') | ||
.contains('File type extension') | ||
.should('not.exist'); | ||
} | ||
}); | ||
|
||
it('ID(CNV-4891) It shows a warning message when image format is not supported', () => { | ||
pvc.form.open(); | ||
cy.exec(`touch ${invalidImage} || true`); | ||
cy.dropFile(invalidImage, invalidImage.split('/').pop(), '.pf-c-file-upload'); | ||
cy.get('.pf-c-alert__title') | ||
.contains('File type extension') | ||
.should('exist'); | ||
}); | ||
|
||
it('ID(CNV-5176) It shows an error when uploading data to golden OS again', () => { | ||
cy.createDataVolume(TEMPLATE_BASE_IMAGE, OS_IMAGES_NS); | ||
pvc.form.open(); | ||
pvc.form.selectOS(os); | ||
cy.get('.pf-c-alert__title') | ||
.contains('Operating system source already defined') | ||
.should('exist'); | ||
}); | ||
|
||
it('ID(CNV-5041) VM can be up after deleting the uploaded PVC', () => { | ||
vm.create(vmData); | ||
vm.stop(vmData); | ||
// only delete template pvc for ocs, hpp does not support this | ||
if (Cypress.env('STORAGE_CLASS') === 'ocs-storagecluster-ceph-rbd') { | ||
cy.deleteResource({ | ||
kind: 'DataVolume', | ||
metadata: { | ||
name: TEMPLATE_BASE_IMAGE, | ||
namespace: OS_IMAGES_NS, | ||
}, | ||
}); | ||
} | ||
vm.start(vmData); | ||
vm.delete(); | ||
}); | ||
}); | ||
|
||
describe('test pvc upload via cli', () => { | ||
it('ID(CNV-5044) Verify boot source is available for template after upload via cli', () => { | ||
cy.exec( | ||
`test -f ${Cypress.env( | ||
'UPLOAD_IMG', | ||
)} || curl --fail -L ${ProvisionSource.URL.getSource()} -o ${Cypress.env('UPLOAD_IMG')}`, | ||
{ timeout: 600000 }, | ||
); | ||
if (Cypress.env('STORAGE_CLASS') === 'ocs-storagecluster-ceph-rbd') { | ||
cy.exec( | ||
`virtctl image-upload dv ${TEMPLATE_BASE_IMAGE} --image-path=${Cypress.env( | ||
'UPLOAD_IMG', | ||
)} --size=1Gi --storage-class=ocs-storagecluster-ceph-rbd --access-mode=ReadWriteMany --block-volume -n ${OS_IMAGES_NS} --insecure || true`, | ||
); | ||
} | ||
if (Cypress.env('STORAGE_CLASS') === 'hostpath-provisioner') { | ||
cy.exec( | ||
`virtctl image-upload dv ${TEMPLATE_BASE_IMAGE} --image-path=${Cypress.env( | ||
'UPLOAD_IMG', | ||
)} --size=1Gi --storage-class=hostpath-provisioner --access-mode=ReadWriteOnce -n ${OS_IMAGES_NS} --insecure || true`, | ||
); | ||
} | ||
|
||
virtualization.templates.visit(); | ||
virtualization.templates.testSource(TEMPLATE_NAME, 'Unknown'); | ||
}); | ||
|
||
it('ID(CNV-5597) Verify create VM from the template which source is uploaded via CLI', () => { | ||
vm.create(vmData); | ||
vm.stop(vmData); | ||
vm.delete(); | ||
}); | ||
|
||
it('ID(CNV-5598) Delete DV/PVC from CLI', () => { | ||
cy.deleteResource({ | ||
kind: 'DataVolume', | ||
metadata: { | ||
name: TEMPLATE_BASE_IMAGE, | ||
namespace: OS_IMAGES_NS, | ||
}, | ||
}); | ||
virtualization.templates.visit(); | ||
virtualization.templates.testSource(TEMPLATE_NAME, 'Add source'); | ||
}); | ||
}); | ||
}); |
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
39 changes: 39 additions & 0 deletions
39
frontend/packages/kubevirt-plugin/integration-tests-cypress/view/pvc.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,39 @@ | ||
export const pvc = { | ||
form: { | ||
open: () => { | ||
cy.clickNavLink(['Storage', 'PersistentVolumeClaims']); | ||
cy.byTestID('item-create').click(); | ||
cy.byLegacyTestID('dropdown-menu') | ||
.contains('With Data upload form') | ||
.click(); | ||
}, | ||
fillImageName: (name: string) => { | ||
cy.get('#file-upload-filename') | ||
.type(name, { force: true }) | ||
.should('have.value', name); | ||
}, | ||
selectOS: (name: string) => { | ||
cy.get('#golden-os-switch').click(); | ||
cy.get('#golden-os-select').select(name); | ||
}, | ||
fillPVCName: (name: string) => { | ||
cy.get('#pvc-name') | ||
.clear() | ||
.type(name); | ||
}, | ||
fillPVCSize: (size: string) => { | ||
cy.get('#request-size-input') | ||
.clear() | ||
.type(size); | ||
}, | ||
selectSC: (name: string) => { | ||
cy.get('#upload-form-ds-sc-select').click(); | ||
cy.get('.pf-c-select__menu-item') | ||
.contains(name) | ||
.click(); | ||
}, | ||
create: () => { | ||
cy.get('#save-changes').click(); | ||
}, | ||
}, | ||
}; |
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