Skip to content

Commit

Permalink
Bug 1896302: Fix 4.6 test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
gouyang committed Nov 27, 2020
1 parent 18adcab commit a4c9a60
Show file tree
Hide file tree
Showing 29 changed files with 184 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
withResources,
} from '@console/shared/src/test-utils/utils';
import { errorMessage } from '@console/internal-integration-tests/views/crud.view';
import { warnMessage } from '../views/pvc.view';
import {
CLONE_VM_TIMEOUT_SECS,
CDI_UPLOAD_TIMEOUT_SECS,
Expand Down Expand Up @@ -84,7 +85,7 @@ describe('KubeVirt Auto Clone', () => {
4 * CDI_UPLOAD_TIMEOUT_SECS,
);

it('ID(CNV-4891) It shows an error when image format is not supported', async () => {
it('ID(CNV-4891) It shows a warning message when image format is not supported', async () => {
const pvc: PVCData = {
image: invalidImage,
pvcName: `upload-pvc-${testName}-invalid`,
Expand All @@ -93,9 +94,10 @@ describe('KubeVirt Auto Clone', () => {
storageClass: STORAGE_CLASS,
};

await uploadForm.upload(pvc);
await browser.wait(until.presenceOf(errorMessage));
expect(errorMessage.getText()).toContain('not supported');
await uploadForm.openForm();
await uploadForm.fillAll(pvc);
await browser.wait(until.presenceOf(warnMessage));
expect(warnMessage.getText()).toContain('not supported');
});

it(
Expand Down Expand Up @@ -188,7 +190,7 @@ describe('KubeVirt Auto Clone', () => {
},
);
},
VM_BOOTUP_TIMEOUT_SECS + CLONE_VM_TIMEOUT_SECS,
(VM_BOOTUP_TIMEOUT_SECS + CLONE_VM_TIMEOUT_SECS) * 2,
);

it(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
DISK_INTERFACE,
DISK_SOURCE,
DISK_DRIVE,
diskAccessMode,
} from '../utils/constants/vm';
import { ProvisionSource } from '../utils/constants/enums/provisionSource';

Expand Down Expand Up @@ -147,6 +148,18 @@ export const rootDisk: Disk = {
};
deepFreeze(rootDisk);

export const rwxRootDisk = {
name: 'rootdisk',
size: '1',
drive: DISK_DRIVE.Disk,
interface: DISK_INTERFACE.VirtIO,
storageClass: `${STORAGE_CLASS}`,
advanced: {
accessMode: diskAccessMode.ReadWriteMany.value,
},
};
deepFreeze(rootDisk);

export const containerRootDisk: Disk = {
name: 'rootdisk',
drive: DISK_DRIVE.Disk,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const vmPresets: { [k: string]: VirtualMachine } = {
.setProvisionSource(ProvisionSource.PXE)
.setDisks([rootDisk])
.setNetworks([multusNetworkInterface])
.setStartOnCreation(true)
.setStartOnCreation(false)
.build(),
[ProvisionSource.DISK.getValue()]: new VMBuilder(getBasicVMBuilder())
.setProvisionSource(ProvisionSource.DISK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { clickNavLink } from '@console/internal-integration-tests/views/sidenav.
import { PAGE_LOAD_TIMEOUT_SECS } from '../utils/constants/common';
import { Disk, Network, VirtualMachineTemplateModel } from '../types/types';
import * as kubevirtDetailView from '../../views/kubevirtUIResource.view';
import * as disksView from '../../views/vm.disks.view';
import {
vmDetailFlavorEditButton,
vmDetailBootOrderEditButton,
Expand Down Expand Up @@ -122,6 +123,7 @@ export class KubevirtUIResource<T extends BaseVMBuilderData> extends UIResource
async navigateToDisks() {
await this.navigateToTab(TAB.Disks);
await isLoaded();
await browser.wait(until.presenceOf(disksView.diskRows));
}

async navigateToNICs() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { selectOptionByText, setCheckboxState } from '../utils/utils';
import { InstanceConfig, rhvConfig, VMImportConfig } from '../types/types';
import {
IMPORT_WIZARD_CONN_TO_NEW_INSTANCE,
RHV_WIZARD_CREATE_SUCCESS,
PAGE_LOAD_TIMEOUT_SECS,
IMPORT_WIZARD_CONN_NAME_PREFIX,
WIZARD_STARTED_IMPORT,
} from '../utils/constants/common';
import * as view from '../../views/importWizard.view';
import * as rhvView from '../../views/rhvImportWizard.view';
Expand Down Expand Up @@ -72,7 +72,7 @@ export class RhvImportWizard extends ImportWizard {

async waitForCreation() {
await browser.wait(
until.textToBePresentInElement(wizardView.creationSuccessResult, RHV_WIZARD_CREATE_SUCCESS),
until.textToBePresentInElement(wizardView.creationSuccessResult, WIZARD_STARTED_IMPORT),
PAGE_LOAD_TIMEOUT_SECS,
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
/* eslint-disable no-await-in-loop, no-console */
import { browser, ExpectedConditions as until } from 'protractor';
import { cloneDeepWithEnum } from '@console/shared/src/constants/object-enum';
import {
waitForStringNotInElement,
click,
waitForStringInElement,
} from '@console/shared/src/test-utils/utils';
import { click, waitForStringNotInElement } from '@console/shared/src/test-utils/utils';
import { detailViewAction, listViewAction } from '@console/shared/src/test-utils/actions.view';
import { VirtualMachineModel } from '@console/kubevirt-plugin/src/models';
import { annotationDialogOverlay } from '@console/internal-integration-tests/views/modal-annotations.view';
Expand Down Expand Up @@ -182,10 +178,7 @@ export class VirtualMachine extends BaseVirtualMachine {
);
}
if (this.data.startOnCreation) {
await browser.wait(
waitForStringInElement(vmView.vmDetailStatus(this.namespace, this.name), VM_STATUS.Running),
VM_BOOTUP_TIMEOUT_SECS,
);
await this.waitForStatus(VM_STATUS.Running, VM_BOOTUP_TIMEOUT_SECS);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { selectOptionByText, setCheckboxState } from '../utils/utils';
import {
IMPORT_WIZARD_CONN_TO_NEW_INSTANCE,
IMPORT_WIZARD_CONN_NAME_PREFIX,
WIZARD_CREATE_SUCCESS,
WIZARD_STARTED_IMPORT,
PAGE_LOAD_TIMEOUT_SECS,
} from '../utils/constants/common';
import * as view from '../../views/importWizard.view';
Expand Down Expand Up @@ -63,7 +63,7 @@ export class VmwareImportWizard extends ImportWizard {

async waitForCreation() {
await browser.wait(
until.textToBePresentInElement(wizardView.creationSuccessResult, WIZARD_CREATE_SUCCESS),
until.textToBePresentInElement(wizardView.creationSuccessResult, WIZARD_STARTED_IMPORT),
PAGE_LOAD_TIMEOUT_SECS,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import {
SEC,
// CHARACTERS_NOT_ALLOWED,
} from '../utils/constants/common';
import * as view from '../../views/wizard.view';
import { NetworkInterfaceDialog } from '../dialogs/networkInterfaceDialog';
import { DiskDialog } from '../dialogs/diskDialog';
import { Flavor } from '../utils/constants/wizard';
import { resourceHorizontalTab } from '../../views/uiResource.view';
import * as view from '../../views/wizard.view';
import { resourceHorizontalTab, dropDownItem, dropDownItemMain } from '../../views/uiResource.view';
import { confirmActionButton } from '../../views/importWizard.view';
import { virtualizationTitle } from '../../views/vms.list.view';
import { VMBuilderData } from '../types/vm';
Expand Down Expand Up @@ -96,11 +96,11 @@ export class Wizard {
}

async selectOperatingSystem(operatingSystem: string) {
await selectItemFromDropdown(view.operatingSystemSelect, view.dropDownItem(operatingSystem));
await selectItemFromDropdown(view.operatingSystemSelect, dropDownItem(operatingSystem));
}

async selectFlavor(flavor: FlavorConfig) {
await selectItemFromDropdown(view.flavorSelect, view.dropDownItemMain(flavor.flavor));
await selectItemFromDropdown(view.flavorSelect, dropDownItemMain(flavor.flavor));
if (flavor.flavor === Flavor.CUSTOM && (!flavor.memory || !flavor.cpu)) {
throw Error('Custom Flavor requires memory and cpu values.');
}
Expand All @@ -113,10 +113,7 @@ export class Wizard {
}

async selectWorkloadProfile(workloadProfile: string) {
await selectItemFromDropdown(
view.workloadProfileSelect,
view.dropDownItemMain(workloadProfile),
);
await selectItemFromDropdown(view.workloadProfileSelect, dropDownItemMain(workloadProfile));
}

async disableGoldenImageCloneCheckbox() {
Expand All @@ -136,7 +133,7 @@ export class Wizard {
async selectProvisionSource(provisionSource: ProvisionSource) {
await selectItemFromDropdown(
view.provisionSourceSelect,
view.dropDownItemMain(provisionSource.getDescription()),
dropDownItemMain(provisionSource.getDescription()),
);
if (provisionSource.getSource()) {
await fillInput(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const TEMPLATE_ACTIONS_TIMEOUT_SECS = 90 * SEC;
export const VM_ACTIONS_TIMEOUT_SECS = 250 * SEC;
export const VM_BOOTUP_TIMEOUT_SECS = 230 * SEC;
export const VM_MIGRATION_TIMEOUT_SECS = 260 * SEC;
export const VM_STOP_TIMEOUT_SECS = 60 * SEC;
export const VM_STOP_TIMEOUT_SECS = 220 * SEC;
export const VM_DELETE_TIMEOUT_SECS = 30 * SEC;
export const VM_IP_ASSIGNMENT_TIMEOUT_SECS = 180 * SEC;
export const VM_IMPORT_TIMEOUT_SECS = 160 * SEC;
Expand Down Expand Up @@ -63,9 +63,8 @@ export const RHV_PROVIDER = 'Red Hat Virtualization (RHV)';
export const VMWARE_PROVIDER = 'VMware';

// Web-UI Exceptions
export const RHV_WIZARD_CREATE_SUCCESS = 'Started import of virtual machine';
export const WIZARD_CREATE_SUCCESS = 'Started import of virtual machine';
// export const WIZARD_CREATE_SUCCESS = 'Successfully created virtual machine';
export const WIZARD_STARTED_IMPORT = 'Started import of virtual machine';
export const WIZARD_CREATE_SUCCESS = 'Successfully created virtual machine';

// Framework Exception
export const UNEXPECTED_ACTION_ERROR = 'Received unexpected action.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class ProvisionSource extends ObjectEnum<string> {
static readonly CONTAINER = new ProvisionSource(
'Container',
'Container',
'kubevirt/fedora-cloud-container-disk-demo',
'kubevirt/fedora-cloud-container-disk-demo:latest',
);

static readonly PXE = new ProvisionSource('PXE', 'PXE (network boot - adds network interface)');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# usage ./expect-login.sh <vm name> <vm namespace>
set vm_name [lindex $argv 0]
set vm_namespace [lindex $argv 1]
set login_prompt "*login: "
set login_prompt " login: "

spawn virtctl console $vm_name -n $vm_namespace --timeout 7

Expand All @@ -12,6 +12,9 @@ send "\n"

set timeout 300

expect $login_prompt
expect {
-re $login_prompt {}
timeout { puts "timeout!"; exit 1 }
}

send \003]
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ spec:
terminationGracePeriodSeconds: 0
volumes:
- containerDisk:
image: 'kubevirt/fedora-cloud-registry-disk-demo:latest'
image: 'kubevirt/fedora-cloud-container-disk-demo:latest'
name: rootdisk
- containerDisk:
image: kubevirt/virtio-container-disk
Expand All @@ -106,9 +106,9 @@ spec:
password: fedora
chpasswd: { expire: False }
runcmd:
- ifconfig eth1 ${vmIP} netmask 255.255.255.0 up
- dnf install -y qemu-guest-agent
- systemctl start qemu-guest-agent
- ifconfig eth1 ${vmIP} netmask 255.255.255.0 up
name: cloudinitdisk
status: {}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
createYAMLLink,
resourceTitle,
} from '@console/internal-integration-tests/views/crud.view';
import { clickNavLink } from '@console/internal-integration-tests/views/sidenav.view';
import { click } from '@console/shared/src/test-utils/utils';
import {
isLoaded as yamlPageIsLoaded,
Expand Down Expand Up @@ -57,8 +58,9 @@ export async function createProject(name: string) {

export async function createExampleVMViaYAML(getVMObj?: boolean) {
let vm = null;
await browser.get(`${appHost}/k8s/ns/${testName}/virtualization`);
await clickNavLink(['Workloads', 'Virtualization']);
await isLoaded();

await click(createItemButton);
await click(createYAMLLink);
await yamlPageIsLoaded();
Expand Down Expand Up @@ -111,6 +113,17 @@ export async function getSelectOptions(selector: any): Promise<string[]> {
return options;
}

export async function getListTexts(selector: any): Promise<string[]> {
const texts = [];
await selector.each((elem) => {
elem
.getText()
.then((text) => texts.push(text))
.catch((err) => Promise.reject(err));
});
return texts;
}

export function getRandStr(length: number) {
return Math.random()
.toString(36)
Expand Down

0 comments on commit a4c9a60

Please sign in to comment.