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 27, 2021
1 parent 9301d75 commit 7f97648
Show file tree
Hide file tree
Showing 19 changed files with 202 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ export const KUBEVIRT_STORAGE_CLASS_DEFAULTS = 'kubevirt-storage-class-defaults'
export const KUBEVIRT_PROJECT_NAME = 'openshift-cnv';
export const EXPECT_LOGIN_SCRIPT_PATH = './utils/expect-login.sh';

export const TEMPLATE_NAME = 'Red Hat Enterprise Linux 6.0+ VM';
export const TEMPLATE_BASE_IMAGE = 'rhel6';
export const TEMPLATE_METADATA_NAME = 'rhel6-server-small';

export const TEST_PROVIDER = 'test-provider';
export const IMPORTING = 'Importing';
export const ADD_SOURCE = 'Add source';
Expand Down Expand Up @@ -94,9 +90,61 @@ export enum DISK_DRIVE {
CDROM = 'CD-ROM',
}

export enum OS {
fedora = 'Fedora 32 or higher',
win10 = 'Microsoft Windows 10',
win2k12 = 'Microsoft Windows Server 2012 R2',
rhel8 = 'Red Hat Enterprise Linux 8.0 or higher',
}
export const TEMPLATE = {
RHEL6: {
name: 'Red Hat Enterprise Linux 6.0+ VM',
dvName: 'rhel6',
metadataName: 'rhel6-server-small',
os: 'Red Hat Enterprise Linux 6.0 or higher',
supportLevel: 'Full',
},
RHEL7: {
name: 'Red Hat Enterprise Linux 7.0+ VM',
dvName: 'rhel7',
metadataName: 'rhel7-server-small',
os: 'Red Hat Enterprise Linux 7.0 or higher',
supportLevel: 'Full',
},
RHEL8: {
name: 'Red Hat Enterprise Linux 8.0+ VM',
dvName: 'rhel8',
metadataName: 'rhel8-server-small',
os: 'Red Hat Enterprise Linux 8.0 or higher',
supportLevel: 'Full',
},
RHEL9: {
name: 'Red Hat Enterprise Linux 9.0 Alpha VM',
dvName: 'rhel9',
metadataName: 'rhel9-server-small',
os: 'Red Hat Enterprise Linux 9.0 or higher',
supportLevel: 'Community',
},
FEDORA: {
name: 'Fedora 32+ VM',
dvName: 'fedora',
metadataName: 'fedora-server-small',
os: 'Fedora 32 or higher',
supportLevel: 'Community',
},
CENTOS7: {
name: 'CentOS 7.0+ VM',
dvName: 'centos7',
metadataName: 'centos7-server-small',
os: 'CentOS 7 or higher',
supportLevel: 'Community',
},
WIN10: {
name: 'Microsoft Windows 10 VM',
dvName: 'win10',
metadataName: 'windows10-desktop-medium',
os: 'Microsoft Windows 10',
supportLevel: 'Full',
},
WIN2K12R2: {
name: 'Microsoft Windows Server 2012 R2 VM',
dvName: 'win2k12r2',
metadataName: 'windows2k12r2-server-medium',
os: 'Microsoft Windows Server 2012 R2',
supportLevel: 'Full',
},
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TEMPLATE_NAME, VM_ACTION, VM_ACTION_TIMEOUT, VM_STATUS } from '../../const/index';
import { TEMPLATE, VM_ACTION, VM_ACTION_TIMEOUT, VM_STATUS } from '../../const/index';
import { ProvisionSource } from '../../enums/provisionSource';
import { testName } from '../../support';
import { Disk, Network, VirtualMachineData } from '../../types/vm';
Expand All @@ -13,7 +13,7 @@ import { vm, waitForStatus } from '../../view/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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TEMPLATE_NAME, VM_ACTION, VM_ACTION_TIMEOUT, VM_STATUS } from '../../const/index';
import { TEMPLATE, VM_ACTION, VM_ACTION_TIMEOUT, VM_STATUS } from '../../const/index';
import { ProvisionSource } from '../../enums/provisionSource';
import { testName } from '../../support';
import { VirtualMachineData } from '../../types/vm';
Expand All @@ -10,7 +10,7 @@ import { action, vm, waitForStatus } from '../../view/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
@@ -1,8 +1,7 @@
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 '../../view/selector';
import { waitForStatus } from '../../view/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,4 +1,4 @@
import { TEMPLATE_NAME } from '../../const/index';
import { TEMPLATE } from '../../const/index';
import { ProvisionSource } from '../../enums/provisionSource';
import { testName } from '../../support';
import { Disk, VirtualMachineData } from '../../types/vm';
Expand All @@ -16,7 +16,7 @@ const disk1: Disk = {
const vmData: VirtualMachineData = {
name: `validate-disk-preallocation-${testName}`,
namespace: testName,
template: TEMPLATE_NAME,
template: TEMPLATE.RHEL9.name,
provisionSource: ProvisionSource.REGISTRY,
pvcSize: '1',
sshEnable: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { listPage } from '@console/cypress-integration-tests/views/list-page';
import { TEMPLATE_NAME } from '../../const/index';
import { TEMPLATE } from '../../const/index';
import { ProvisionSource } from '../../enums/provisionSource';
import { testName } from '../../support';
import { VirtualMachineData } from '../../types/vm';
Expand All @@ -9,7 +9,7 @@ import { vm } from '../../view/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,4 +1,4 @@
import { OS_IMAGES_NS, TEMPLATE_BASE_IMAGE, TEMPLATE_NAME } from '../../const/index';
import { OS_IMAGES_NS, TEMPLATE } from '../../const/index';
import { ProvisionSource } from '../../enums/provisionSource';
import { testName } from '../../support';
import { VirtualMachineData } from '../../types/vm';
Expand All @@ -9,10 +9,11 @@ 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 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,4 +1,4 @@
import { TEMPLATE_NAME, VM_STATUS } from '../../const/index';
import { TEMPLATE, VM_STATUS } from '../../const/index';
import { ProvisionSource } from '../../enums/provisionSource';
import vmiFixture from '../../fixtures/vmi-ephemeral';
import { testName } from '../../support';
Expand All @@ -9,7 +9,7 @@ import { vm, waitForStatus } from '../../view/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,3 +1,4 @@
import { TEMPLATE } from '../../const/index';
import { ProvisionSource } from '../../enums/provisionSource';
import { testName } from '../../support';
import { VirtualMachineData } from '../../types/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,4 +1,4 @@
import { TEMPLATE_NAME, VM_ACTION_TIMEOUT, VM_STATUS } from '../../const/index';
import { TEMPLATE, VM_ACTION_TIMEOUT, VM_STATUS } from '../../const/index';
import { ProvisionSource } from '../../enums/provisionSource';
import { testName } from '../../support';
import { VirtualMachineData } from '../../types/vm';
Expand All @@ -8,7 +8,7 @@ import { vm, waitForStatus } from '../../view/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,4 +1,4 @@
import { YAML_VM_NAME, STATUS_READY, TEMPLATE_NAME } from '../../const/index';
import { YAML_VM_NAME, STATUS_READY, TEMPLATE } from '../../const/index';
import { ProvisionSource } from '../../enums/provisionSource';
import { testName } from '../../support';
import { VirtualMachineData } from '../../types/vm';
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,4 +1,4 @@
import { OS } from '../../const/index';
import { TEMPLATE } from '../../const/index';
import { ProvisionSource } from '../../enums/provisionSource';
import { testName } from '../../support';
import { Network, VirtualMachineData } from '../../types/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 7f97648

Please sign in to comment.