Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MGMT-15054: FCP devices (multipath) do not show correct size #2286

Merged
merged 8 commits into from
Aug 24, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ import * as utils from '../../support/utils';
const validateHostTableDetails = () => {
Cypress.env('masterCPU', '8');
Cypress.env('masterMemory', '33.20 GiB');
Cypress.env('masterDiskTotalSize', '12.88 GB');

hostsTableSection.validateHostCpuCores(3, 0);
hostsTableSection.validateHostDiskSize(3, 0);
hostsTableSection.validateHostMemory(3, 0);
hostsTableSection.validateHostRoles(3, 0);
hostsTableSection.validateHostCpuCores();
hostsTableSection.validateHostDiskSize(12.88, 0);
hostsTableSection.validateHostMemory();
hostsTableSection.validateHostRoles();
};

describe(`Assisted Installer Multinode Host discovery`, () => {
Expand Down Expand Up @@ -75,7 +74,7 @@ describe(`Assisted Installer Multinode Host discovery`, () => {
cy.wait(['@rename-host-1', '@rename-host-2', '@rename-host-3']).then(() => {
utils.setLastWizardSignal('HOST_RENAMED_3');
hostsTableSection.waitForHardwareStatus('Ready');
hostsTableSection.validateHostNames(3, 0, [
hostsTableSection.validateHostNames([
`${hostPrefix}-1`,
`${hostPrefix}-2`,
`${hostPrefix}-3`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ describe(`Assisted Installer Storage Step`, () => {
);
});

it('Should calculate the total storage size correctly', () => {
hostsTableSection.validateHostDiskSize(51.52, 51.52);
});

it('Should display the correct warning for LVM', () => {
disks[1].warning = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ describe(`Assisted Installer Storage Step`, () => {
});

it('Should display the existing hosts storage details', () => {
Cypress.env('masterDiskTotalSize', '35.59 GB');
Cypress.env('workerDiskTotalSize', '20.95 GB');
hostsTableSection.waitForHardwareStatus('Ready');
hostsTableSection.validateHostRoles();
hostsTableSection.validateHostDiskSize();
hostsTableSection.validateHostDiskSize(35.59, 20.95);
storagePage.validateNumberOfDisks();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ Cypress.env('START_INSTALLATION_TIMEOUT', 2.5 * 60 * 1000);
Cypress.env('GENERATE_ISO_TIMEOUT', 2 * 60 * 1000);
Cypress.env('HOST_STATUS_INSUFFICIENT_TIMEOUT', 300000);
Cypress.env('DNS_RESOLUTION_ALERT_MESSAGE_TIMEOUT', 900000);
// Deployment
Cypress.env('NUM_MASTERS', parseInt(Cypress.env('NUM_MASTERS')));
Cypress.env('NUM_WORKERS', parseInt(Cypress.env('NUM_WORKERS')));
65 changes: 25 additions & 40 deletions libs/ui-lib-tests/cypress/views/hostsTableSection.ts
Original file line number Diff line number Diff line change
@@ -1,86 +1,71 @@
export type ValidateDiskHoldersParams = { name: string; indented?: boolean; warning?: boolean }[];

const numMasters = (): number => Cypress.env('NUM_MASTERS');
const numWorkers = (): number => Cypress.env('NUM_WORKERS');

export const hostsTableSection = {
validateHostNames: (
numMasters: number = Cypress.env('NUM_MASTERS'),
numWorkers: number = Cypress.env('NUM_WORKERS'),
hostNames = Cypress.env('requestedHostnames'),
) => {
validateHostNames: (hostNames = Cypress.env('requestedHostnames')) => {
cy.get('[data-testid=host-name]')
.should('have.length', numMasters + numWorkers)
.should('have.length', numMasters() + numWorkers())
.each((hostName, idx) => {
expect(hostName).to.contain(hostNames[idx]);
});
},
validateHostRoles: (
numMasters: number = Cypress.env('NUM_MASTERS'),
numWorkers: number = Cypress.env('NUM_WORKERS'),
) => {
validateHostRoles: () => {
cy.get('td[data-testid="host-role"]')
.should('have.length', numMasters + numWorkers)
.should('have.length', numMasters() + numWorkers())
.each((hostRole, idx) => {
const isMaster = idx <= numMasters - 1;
const isMaster = idx <= numMasters() - 1;
if (isMaster) {
expect(hostRole).to.contain('Control plane node');
} else {
expect(hostRole).to.contain('Worker');
}
});
},
validateHostCpuCores: (
numMasters: number = Cypress.env('NUM_MASTERS'),
numWorkers: number = Cypress.env('NUM_WORKERS'),
) => {
validateHostCpuCores: () => {
cy.get('td[data-label="CPU Cores"]')
.should('have.length', numMasters + numWorkers)
.should('have.length', numMasters() + numWorkers())
.each((hostCpuCores, idx) => {
const isMaster = idx <= numMasters - 1;
const isMaster = idx <= numMasters() - 1;
if (isMaster) {
expect(hostCpuCores).to.contain(Cypress.env('masterCPU'));
} else {
expect(hostCpuCores).to.contain(Cypress.env('workerCPU'));
}
});
},
validateHostMemory: (
numMasters: number = Cypress.env('NUM_MASTERS'),
numWorkers: number = Cypress.env('NUM_WORKERS'),
) => {
validateHostMemory: () => {
cy.get('td[data-label="Memory"]')
.should('have.length', numMasters + numWorkers)
.should('have.length', numMasters() + numWorkers())
.each((hostMemory, idx) => {
const isMaster = idx <= numMasters - 1;
const isMaster = idx <= numMasters() - 1;
if (isMaster) {
expect(hostMemory).to.contain(Cypress.env('masterMemory'));
} else {
expect(hostMemory).to.contain(Cypress.env('workerMemory'));
}
});
},
validateHostDiskSize: (
numMasters: number = Cypress.env('NUM_MASTERS'),
numWorkers: number = Cypress.env('NUM_WORKERS'),
) => {
validateHostDiskSize: (masterDiskTotalSize: number, workerDiskTotalSize: number) => {
cy.get('td[data-label="Total storage"]')
.should('have.length', numMasters + numWorkers)
.should('have.length', numMasters() + numWorkers())
.each((hostDisk, idx) => {
const isMaster = idx <= numMasters - 1;
const isMaster = idx <= numMasters() - 1;
if (isMaster) {
expect(hostDisk).to.contain(Cypress.env('masterDiskTotalSize'));
expect(hostDisk).to.contain(`${masterDiskTotalSize} GB`);
} else {
expect(hostDisk).to.contain(Cypress.env('workerDiskTotalSize'));
expect(hostDisk).to.contain(`${workerDiskTotalSize} GB`);
}
});
},
waitForHardwareStatus: (
status,
numMasters: number = Cypress.env('NUM_MASTERS'),
numWorkers: number = Cypress.env('NUM_WORKERS'),
timeout = Cypress.env('HOST_READY_TIMEOUT'),
) => {
waitForHardwareStatus: (status: string) => {
// Start at index 2 here because of selector
for (let i = 2; i <= numMasters + numWorkers + 1; i++) {
cy.hostDetailSelector(i, 'Status', timeout).should('contain.text', status);
for (let i = 2; i <= numMasters() + numWorkers() + 1; i++) {
cy.hostDetailSelector(i, 'Status', Cypress.env('HOST_READY_TIMEOUT')).should(
'contain.text',
status,
);
}
},
getHostDisksExpander: (hostIndex: number) => {
Expand Down
3 changes: 2 additions & 1 deletion libs/ui-lib/lib/common/components/hosts/hardwareInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ export type SimpleHardwareInfo = {

export const getMemoryCapacity = (inventory: Inventory): number =>
inventory.memory?.physicalBytes || 0;

export const getDiskCapacity = (inventory: Inventory): number =>
inventory.disks
?.filter((disk) => disk.driveType !== OpticalDiskDriveType)
?.filter((disk) => disk.driveType !== OpticalDiskDriveType && !disk.holders)
.reduce((diskSize: number, disk: Disk) => diskSize + (disk.sizeBytes || 0), 0) || 0;

export const getHumanizedCpuClockSpeed = (inventory: Inventory) =>
Expand Down