Skip to content

Commit

Permalink
Bug 1998394: add tests for RHEL9 template
Browse files Browse the repository at this point in the history
  • Loading branch information
gouyang committed Aug 31, 2021
1 parent bcdeaf0 commit f0c0be0
Show file tree
Hide file tree
Showing 19 changed files with 215 additions and 122 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { testName } from '../../support';
import { Disk, Network, VirtualMachineData } from '../../types/vm';
import { TEMPLATE_NAME, VM_ACTION, VM_ACTION_TIMEOUT, VM_STATUS } from '../../utils/const/index';
import { TEMPLATE, VM_ACTION, VM_ACTION_TIMEOUT, VM_STATUS } from '../../utils/const/index';
import { ProvisionSource } from '../../utils/const/provisionSource';
import { selectActionFromDropdown } from '../../views/actions';
import * as cloneView from '../../views/clone';
Expand All @@ -13,11 +13,11 @@ import { vm, waitForStatus } from '../../views/vm';
const vmData: VirtualMachineData = {
name: `test-vm-clone-${testName}`,
namespace: testName,
template: TEMPLATE_NAME,
template: TEMPLATE.RHEL6.name,
provisionSource: ProvisionSource.URL,
pvcSize: '1',
sshEnable: false,
startOnCreation: false,
startOnCreation: true,
};

const nic1: Network = {
Expand All @@ -39,7 +39,6 @@ describe('Test VM Clone', () => {
cy.cdiCloner(testName, 'default');
cy.createNAD(testName);
virtualization.vms.visit();
waitForStatus(VM_STATUS.Stopped, vmData, VM_ACTION_TIMEOUT.VM_IMPORT);
});

after(() => {
Expand Down Expand Up @@ -80,19 +79,22 @@ describe('Test VM Clone', () => {
});

it('ID(CNV-1730) Displays warning in clone wizard when cloned VM is running', () => {
vm.start(vmData);
selectActionFromDropdown(VM_ACTION.Clone, actionButtons.kebabButton);
cy.get('.pf-c-alert__title')
.contains(`The VM ${vmData.name} is still running. It will be powered off while cloning.`)
.should('exist');
cy.get(cloneView.cancel).click();
});

it('ID(CNV-1863) Prefills correct data in the clone VM dialog', () => {
selectActionFromDropdown(VM_ACTION.Clone, actionButtons.kebabButton);
cy.get(cloneView.vmName).should('have.value', `${vmData.name}-clone`);
cy.get(cloneView.nameSpace).should('have.value', testName);
cy.get(cloneView.cancel).click();
});

it('ID(CNV-3058) Clones VM to a different namespace', () => {
selectActionFromDropdown(VM_ACTION.Clone, actionButtons.kebabButton);
cy.get(cloneView.vmName).should('have.value', `${vmData.name}-clone`);
cy.get(cloneView.nameSpace)
.select('default')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { testName } from '../../support';
import { VirtualMachineData } from '../../types/vm';
import { TEMPLATE_NAME, VM_ACTION, VM_ACTION_TIMEOUT, VM_STATUS } from '../../utils/const/index';
import { TEMPLATE, VM_ACTION, VM_ACTION_TIMEOUT, VM_STATUS } from '../../utils/const/index';
import { ProvisionSource } from '../../utils/const/provisionSource';
import { actionButtons, detailsTab, errorAlert } from '../../views/selector';
import { tab } from '../../views/tab';
Expand All @@ -10,7 +10,7 @@ import { action, vm, waitForStatus } from '../../views/vm';
const vmData: VirtualMachineData = {
name: `test-vm-migration-${testName}`,
namespace: testName,
template: TEMPLATE_NAME,
template: TEMPLATE.RHEL8.name,
provisionSource: ProvisionSource.URL,
pvcSize: '1',
sshEnable: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { VirtualMachineData } from '../../types/vm';
import {
DEFAULTS_VALUES,
OS_IMAGES_NS,
TEMPLATE_BASE_IMAGE,
TEMPLATE_NAME,
TEMPLATE,
VM_ACTION,
VM_ACTION_TIMEOUT,
VM_STATUS,
Expand All @@ -25,6 +24,8 @@ import {
import { detailsTab } from '../../views/selector';
import { waitForStatus } from '../../views/vm';

const template = TEMPLATE.RHEL6;

const vm: VirtualMachineData = {
name: `smoke-test-vm-${testName}`,
namespace: testName,
Expand All @@ -37,14 +38,14 @@ describe('test dev console', () => {
cy.visit('/');
cy.createProject(testName);
cy.cdiCloner(testName, OS_IMAGES_NS);
cy.createDataVolume(TEMPLATE_BASE_IMAGE, OS_IMAGES_NS);
cy.createDataVolume(template.dvName, OS_IMAGES_NS);
});

after(() => {
cy.deleteResource({
kind: 'DataVolume',
metadata: {
name: TEMPLATE_BASE_IMAGE,
name: template.dvName,
namespace: OS_IMAGES_NS,
},
});
Expand Down Expand Up @@ -83,7 +84,7 @@ describe('test dev console', () => {
it('ID(CNV-5699) create virtual machine', () => {
cy.byLegacyTestID(addHeader).click();
cy.get('[data-test="item dev-catalog-virtualization"]').click();
cy.contains(TEMPLATE_NAME)
cy.contains(template.name)
.should('be.visible')
.click();
cy.contains('Create from template').click({ force: true });
Expand Down Expand Up @@ -113,7 +114,7 @@ describe('test dev console', () => {
cy.get(detailsTab.vmPod).should('not.contain', DEFAULTS_VALUES.NOT_AVAILABLE);
cy.get(detailsTab.vmIP).should('not.contain', DEFAULTS_VALUES.NOT_AVAILABLE);
cy.get(detailsTab.vmNode).should('not.contain', DEFAULTS_VALUES.NOT_AVAILABLE);
cy.get(detailsTab.vmTemplate).should('contain', TEMPLATE_BASE_IMAGE);
cy.get(detailsTab.vmTemplate).should('contain', template.dvName);
});

it('ID(CNV-5701) review resources tab', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { testName } from '../../support';
import { Disk, VirtualMachineData } from '../../types/vm';
import { TEMPLATE_NAME } from '../../utils/const/index';
import { TEMPLATE } from '../../utils/const/index';
import { ProvisionSource } from '../../utils/const/provisionSource';
import { addDisk } from '../../views/dialog';
import { tab } from '../../views/tab';
Expand All @@ -16,7 +16,7 @@ const disk1: Disk = {
const vmData: VirtualMachineData = {
name: `validate-disk-preallocation-${testName}`,
namespace: testName,
template: TEMPLATE_NAME,
template: TEMPLATE.RHEL8.name,
provisionSource: ProvisionSource.REGISTRY,
pvcSize: '1',
sshEnable: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { listPage } from '@console/cypress-integration-tests/views/list-page';
import { testName } from '../../support';
import { VirtualMachineData } from '../../types/vm';
import { TEMPLATE_NAME } from '../../utils/const/index';
import { TEMPLATE } from '../../utils/const/index';
import { ProvisionSource } from '../../utils/const/provisionSource';
import { virtualization } from '../../views/virtualization';
import { vm } from '../../views/vm';

const vmData: VirtualMachineData = {
name: `validate-storage-profile-${testName}`,
namespace: testName,
template: TEMPLATE_NAME,
template: TEMPLATE.RHEL8.name,
provisionSource: ProvisionSource.REGISTRY,
pvcSize: '1',
sshEnable: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { testName } from '../../support';
import { VirtualMachineData } from '../../types/vm';
import { OS_IMAGES_NS, TEMPLATE_BASE_IMAGE, TEMPLATE_NAME } from '../../utils/const/index';
import { OS_IMAGES_NS, TEMPLATE } from '../../utils/const/index';
import { ProvisionSource } from '../../utils/const/provisionSource';
import { pvc } from '../../views/pvc';
import { virtualization } from '../../views/virtualization';
Expand All @@ -9,10 +9,11 @@ import { vm } from '../../views/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 template = TEMPLATE.RHEL6;
const vmData: VirtualMachineData = {
name: `pvc-test-vm-${testName}`,
namespace: testName,
template: TEMPLATE_NAME,
template: template.name,
sshEnable: false,
startOnCreation: true,
sourceAvailable: true,
Expand All @@ -29,7 +30,7 @@ describe('kubevirt PVC upload', () => {
cy.deleteResource({
kind: 'DataVolume',
metadata: {
name: TEMPLATE_BASE_IMAGE,
name: template.dvName,
namespace: OS_IMAGES_NS,
},
});
Expand Down Expand Up @@ -69,7 +70,7 @@ describe('kubevirt PVC upload', () => {
});

it('ID(CNV-5176) It shows an error when uploading data to golden OS again', () => {
cy.createDataVolume(TEMPLATE_BASE_IMAGE, OS_IMAGES_NS);
cy.createDataVolume(template.dvName, OS_IMAGES_NS);
pvc.form.open();
pvc.form.selectOS(os);
cy.get('.pf-c-alert__title')
Expand All @@ -85,7 +86,7 @@ describe('kubevirt PVC upload', () => {
cy.deleteResource({
kind: 'DataVolume',
metadata: {
name: TEMPLATE_BASE_IMAGE,
name: template.dvName,
namespace: OS_IMAGES_NS,
},
});
Expand All @@ -104,10 +105,10 @@ describe('kubevirt PVC upload', () => {
{ timeout: 600000 },
);

cy.uploadFromCLI(TEMPLATE_BASE_IMAGE, OS_IMAGES_NS, Cypress.env('UPLOAD_IMG'), '1');
cy.uploadFromCLI(template.dvName, OS_IMAGES_NS, Cypress.env('UPLOAD_IMG'), '1');

virtualization.templates.visit();
virtualization.templates.testSource(TEMPLATE_NAME, 'Unknown');
virtualization.templates.testSource(template.name, 'Unknown');
});

it('ID(CNV-5597) Verify create VM from the template whose source is uploaded via CLI', () => {
Expand All @@ -120,12 +121,12 @@ describe('kubevirt PVC upload', () => {
cy.deleteResource({
kind: 'DataVolume',
metadata: {
name: TEMPLATE_BASE_IMAGE,
name: template.dvName,
namespace: OS_IMAGES_NS,
},
});
virtualization.templates.visit();
virtualization.templates.testSource(TEMPLATE_NAME, 'Add source');
virtualization.templates.testSource(template.name, 'Add source');
});
});
});
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import vmiFixture from '../../fixtures/vmi-ephemeral';
import { testName } from '../../support';
import { VirtualMachineData } from '../../types/vm';
import { TEMPLATE_NAME, VM_STATUS } from '../../utils/const/index';
import { TEMPLATE, VM_STATUS } from '../../utils/const/index';
import { ProvisionSource } from '../../utils/const/provisionSource';
import { virtualization } from '../../views/virtualization';
import { vm, waitForStatus } from '../../views/vm';

const vmData: VirtualMachineData = {
name: `smoke-test-vm-actions-${testName}`,
namespace: testName,
template: TEMPLATE_NAME,
template: TEMPLATE.RHEL6.name,
provisionSource: ProvisionSource.REGISTRY,
pvcSize: '1',
sshEnable: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { testName } from '../../support';
import { VirtualMachineData } from '../../types/vm';
import { TEMPLATE } from '../../utils/const/index';
import { ProvisionSource } from '../../utils/const/provisionSource';
import { virtualization } from '../../views/virtualization';
import { vm } from '../../views/vm';
Expand All @@ -8,7 +9,7 @@ const rhelData: VirtualMachineData = {
name: `smoke-test-vm-rhel-${testName}`,
description: 'rhel8 vm',
namespace: testName,
template: 'Red Hat Enterprise Linux 8.0+ VM',
template: TEMPLATE.RHEL8.name,
provisionSource: ProvisionSource.REGISTRY,
pvcSize: '1',
sshEnable: false,
Expand All @@ -19,7 +20,7 @@ const fedoraData: VirtualMachineData = {
name: `smoke-test-vm-fedora-${testName}`,
description: 'fedora vm',
namespace: testName,
template: 'Fedora 32+ VM',
template: TEMPLATE.FEDORA.name,
provisionSource: ProvisionSource.URL,
pvcSize: '1',
sshEnable: false,
Expand All @@ -30,7 +31,7 @@ const winData: VirtualMachineData = {
name: `smoke-test-vm-windows-${testName}`,
description: 'windows vm',
namespace: testName,
template: 'Microsoft Windows Server 2019 VM',
template: TEMPLATE.WIN10.name,
provisionSource: ProvisionSource.URL,
pvcSize: '1',
sshEnable: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { testName } from '../../support';
import { VirtualMachineData } from '../../types/vm';
import { TEMPLATE_NAME, VM_ACTION_TIMEOUT, VM_STATUS } from '../../utils/const/index';
import { TEMPLATE, VM_ACTION_TIMEOUT, VM_STATUS } from '../../utils/const/index';
import { ProvisionSource } from '../../utils/const/provisionSource';
import { virtualization } from '../../views/virtualization';
import { vm, waitForStatus } from '../../views/vm';

const vmData: VirtualMachineData = {
name: `smoke-test-vm-${testName}`,
namespace: testName,
template: TEMPLATE_NAME,
template: TEMPLATE.RHEL8.name,
provisionSource: ProvisionSource.REGISTRY,
pvcSize: '1',
sshEnable: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { testName } from '../../support';
import { VirtualMachineData } from '../../types/vm';
import { YAML_VM_NAME, STATUS_READY, TEMPLATE_NAME } from '../../utils/const/index';
import { YAML_VM_NAME, STATUS_READY, TEMPLATE } from '../../utils/const/index';
import { ProvisionSource } from '../../utils/const/provisionSource';
import * as snapshotView from '../../views/snapshot';
import { tab } from '../../views/tab';
Expand All @@ -11,7 +11,7 @@ const vmData: VirtualMachineData = {
name: `test-vm-snapshot-${testName}`,
description: 'rhel8 vm for snapshot',
namespace: testName,
template: TEMPLATE_NAME,
template: TEMPLATE.RHEL8.name,
provisionSource: ProvisionSource.REGISTRY,
pvcSize: '1',
sshEnable: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { testName } from '../../support';
import { Network, VirtualMachineData } from '../../types/vm';
import { OS } from '../../utils/const/index';
import { TEMPLATE } from '../../utils/const/index';
import { ProvisionSource } from '../../utils/const/provisionSource';
import { virtualization } from '../../views/virtualization';
import { vm } from '../../views/vm';
Expand All @@ -16,8 +16,8 @@ const urlTemplate: VirtualMachineData = {
namespace: testName,
templateProvider: 'foo',
templateSupport: true,
os: OS.rhel8,
template: 'Red Hat Enterprise Linux 8.0+ VM',
os: TEMPLATE.RHEL8.os,
template: TEMPLATE.RHEL8.name,
provisionSource: ProvisionSource.URL,
pvcSize: '1',
};
Expand All @@ -28,8 +28,8 @@ const registryTemplate: VirtualMachineData = {
namespace: testName,
templateProvider: 'foo',
templateSupport: true,
os: OS.win2k12,
template: 'Microsoft Windows Server 2012 R2 VM',
os: TEMPLATE.WIN2K12R2.os,
template: TEMPLATE.WIN2K12R2.name,
provisionSource: ProvisionSource.REGISTRY,
pvcSize: '1',
};
Expand All @@ -40,8 +40,8 @@ const pvcTemplate: VirtualMachineData = {
namespace: testName,
templateProvider: 'foo',
templateSupport: true,
template: 'Fedora 32+ VM',
os: OS.fedora,
template: TEMPLATE.FEDORA.name,
os: TEMPLATE.FEDORA.os,
provisionSource: ProvisionSource.CLONE_PVC,
pvcName: 'clone-pvc-fedora',
pvcNS: testName,
Expand All @@ -53,8 +53,8 @@ const pxeTemplate: VirtualMachineData = {
namespace: testName,
templateProvider: 'foo',
templateSupport: true,
os: OS.fedora,
template: 'Fedora 32+ VM',
os: TEMPLATE.FEDORA.os,
template: TEMPLATE.FEDORA.name,
provisionSource: ProvisionSource.PXE,
networkInterfaces: [nic0],
};
Expand Down

0 comments on commit f0c0be0

Please sign in to comment.