Skip to content

Commit

Permalink
MGMT-12926: Grouping disks by holders (#2269)
Browse files Browse the repository at this point in the history
* Grouping disks by holders

* Tests for grouping disks by holders

* Cleanup selectors and constants

* Extract StoragePage and Alert classes

* Align test classes and structure

---------

Co-authored-by: Montse Ortega <[email protected]>
  • Loading branch information
jgyselov and ammont82 authored Jul 27, 2023
1 parent 9776f7a commit c5be684
Show file tree
Hide file tree
Showing 20 changed files with 501 additions and 195 deletions.
139 changes: 138 additions & 1 deletion libs/ui-lib-tests/cypress/fixtures/storage/host-inventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,141 @@ const createHostInventory = (id: number, memory: number, diskSpace: number) => {
};
};

export default createHostInventory;
const disksWithHolders = [
{
drive_type: 'RAID',
id: '/dev/md0',
installation_eligibility: { eligible: true },
name: 'md0',
path: '/dev/md0',
size_bytes: 21455962112,
},
{
drive_type: 'LVM',
id: '/dev/dm-0',
installation_eligibility: { eligible: true },
name: 'dm-0',
path: '/dev/dm-0',
size_bytes: 15032385536,
},
{
by_id: '/dev/disk/by-id/wwn-0x60000000000000000e00000000010001',
drive_type: 'Multipath',
has_uuid: true,
id: '/dev/disk/by-id/wwn-0x60000000000000000e00000000010001',
installation_eligibility: { eligible: true },
name: 'dm-1',
path: '/dev/dm-1',
size_bytes: 10737418240,
},
{
drive_type: 'LVM',
id: '/dev/dm-2',
installation_eligibility: { eligible: true },
name: 'dm-2',
path: '/dev/dm-2',
size_bytes: 4294967296,
},
{
by_path:
'/dev/disk/by-path/ip-192.168.122.41:3260-iscsi-iqn.2015-06.com.example.test:target1-lun-1',
drive_type: 'iSCSI',
has_uuid: true,
hctl: '8:0:0:1',
holders: 'dm-1',
id: '/dev/disk/by-path/ip-192.168.122.41:3260-iscsi-iqn.2015-06.com.example.test:target1-lun-1',
installation_eligibility: { eligible: true },
model: 'VIRTUAL-DISK',
name: 'sda',
path: '/dev/sda',
serial: '60000000000000000e00000000010001',
size_bytes: 10737418240,
vendor: 'IET',
wwn: '0x60000000000000000e00000000010001',
},
{
by_path: '/dev/disk/by-path/ip-192.168.123.49:3260',
drive_type: 'iSCSI',
has_uuid: true,
hctl: '9:0:0:1',
holders: 'dm-1',
id: '/dev/disk/by-path/ip-192.168.123.49:3260',
installation_eligibility: { eligible: true },
model: 'VIRTUAL-DISK',
name: 'sdb',
path: '/dev/sdb',
serial: '60000000000000000e00000000010001',
size_bytes: 10737418240,
vendor: 'IET',
wwn: '0x60000000000000000e00000000010001',
},
{
bootable: true,
by_path: '/dev/disk/by-path/pci-0000:00:05.0-ata-3',
drive_type: 'ODD',
has_uuid: true,
hctl: '4:0:0:0',
id: '/dev/disk/by-path/pci-0000:00:05.0-ata-3',
installation_eligibility: { eligible: true },
is_installation_media: true,
model: 'QEMU_DVD-ROM',
name: 'sr0',
path: '/dev/sr0',
removable: true,
serial: 'QM00009',
size_bytes: 1135607808,
smart: 'SMART support is: Unavailable - device lacks SMART capability.\n',
vendor: 'QEMU',
},
{
by_path: '/dev/disk/by-path/pci-0000:00:07.0',
drive_type: 'HDD',
holders: 'dm-0,dm-2',
id: '/dev/disk/by-path/pci-0000:00:07.0',
installation_eligibility: { eligible: true },
name: 'vda',
path: '/dev/vda',
size_bytes: 10737418240,
vendor: '0x1af4',
},
{
by_path: '/dev/disk/by-path/pci-0000:00:08.0',
drive_type: 'HDD',
holders: 'dm-0,dm-2',
id: '/dev/disk/by-path/pci-0000:00:08.0',
installation_eligibility: { eligible: true },
name: 'vdb',
path: '/dev/vdb',
size_bytes: 10737418240,
vendor: '0x1af4',
},
{
by_path: '/dev/disk/by-path/pci-0000:00:09.0',
drive_type: 'HDD',
holders: 'md0',
id: '/dev/disk/by-path/pci-0000:00:09.0',
installation_eligibility: { eligible: true },
name: 'vdc',
path: '/dev/vdc',
size_bytes: 10737418240,
vendor: '0x1af4',
},
{
by_path: '/dev/disk/by-path/pci-0000:00:0a.0',
drive_type: 'HDD',
holders: 'md0',
id: '/dev/disk/by-path/pci-0000:00:0a.0',
installation_eligibility: { eligible: true },
name: 'vdd',
path: '/dev/vdd',
size_bytes: 10737418240,
vendor: '0x1af4',
},
];

const createHostInventoryWithDiskHolders = (id: number, memory: number, diskSpace: number) => ({
...createHostInventory(id, memory, diskSpace),
disks: disksWithHolders,
});

export { createHostInventory, createHostInventoryWithDiskHolders };
14 changes: 12 additions & 2 deletions libs/ui-lib-tests/cypress/fixtures/storage/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import storageCluster from './storage-cluster';
import storageHosts from './storage-hosts';
import { createMultinodeFixtureMapping } from '../create-mn';
import { storageHosts, hostsWithDiskHolders } from './storage-hosts';

const createStorageFixtureMapping = {
clusters: {
Expand All @@ -10,4 +11,13 @@ const createStorageFixtureMapping = {
},
};

export { createStorageFixtureMapping };
const createDiskHoldersFixtureMapping = {
clusters: {
default: createMultinodeFixtureMapping.clusters.READY_TO_INSTALL,
},
hosts: {
default: hostsWithDiskHolders,
},
};

export { createStorageFixtureMapping, createDiskHoldersFixtureMapping };
25 changes: 23 additions & 2 deletions libs/ui-lib-tests/cypress/fixtures/storage/storage-hosts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fakeClusterId } from '../cluster/base-cluster';
import createHostInventory from './host-inventory';
import { createHostInventory, createHostInventoryWithDiskHolders } from './host-inventory';

const operatorValidations = [
{
Expand Down Expand Up @@ -118,6 +118,14 @@ const workerMemory = 7179869184; // TODO
const masterDisk = 17797418240; // 17.80 GB
const workerDisk = 10476748240; // 10.48 GB

const installationDiskIds = [
'/dev/disk/by-path/pci-0000:00:08.0', // LVM
'/dev/disk/by-path/pci-0000:00:09.0', // raid
'/dev/disk/by-path/ip-192.168.123.49:3260', //multipath
'/dev/disk/by-path/pci-0000:00:05.0-ata-3', // sr0
'/dev/disk/by-path/pci-0000:00:05.0-ata-3', // sr0
];

const hosts = [
{
checked_in_at: '2022-08-16T15:02:43.543Z',
Expand Down Expand Up @@ -368,4 +376,17 @@ const hosts = [
},
];

export default hosts;
const hostsWithDiskHolders = hosts.map((host, index) => ({
...host,
inventory: JSON.stringify(
createHostInventoryWithDiskHolders(
index,
host['role'] === 'master' ? masterMemory : workerMemory,
host['role'] === 'master' ? masterDisk : workerDisk,
),
),
installation_disk_id: installationDiskIds[index],
skip_formatting_disks: false,
}));

export { hosts as storageHosts, hostsWithDiskHolders };
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { commonActions } from '../../views/common';
import { ValidateDiskHoldersParams, hostsTableSection } from '../../views/hostsTableSection';
import { StorageForm } from '../../views/forms/Storage/StorageForm';

describe(`Assisted Installer Storage Step`, () => {
let storageForm;
const disks = [
{ name: 'vda' },
{ name: 'vdb' },
{ name: 'dm-1' },
{ name: 'sda', indented: true },
{ name: 'sdb', indented: true },
{ name: 'md0' },
{ name: 'vdc', indented: true },
{ name: 'vdd', indented: true },
{ name: 'sr0' },
] as ValidateDiskHoldersParams;

const warningTexts = [
'LVM logical volumes were found on the installation disk vdb selected for host storage-test-odf-master-1 and will be deleted during installation.',
'The installation disk vdc selected for host storage-test-odf-master-2, is part of a software RAID that will be deleted during the installation.',
'The installation disk sdb selected for host storage-test-odf-master-3 is managed by multipath. We strongly recommend using the multipath device dm-1 to improve reliability.',
];

const setTestStartSignal = (activeSignal: string) => {
cy.setTestEnvironment({
activeSignal,
activeScenario: 'AI_DISK_HOLDERS_CLUSTER',
});
};

before(() => {
setTestStartSignal('READY_TO_INSTALL');
});

describe(`Host storage`, () => {
beforeEach(() => {
setTestStartSignal('READY_TO_INSTALL');
commonActions.visitClusterDetailsPage();
commonActions.startAtWizardStep('Storage');

storageForm = new StorageForm();
});

it('Should display the correct alerts', () => {
storageForm.diskLimitationAlert.title.should(
'contain.text',
'Warning alert:Installation disk limitations',
);

storageForm.diskLimitationAlert.description.find('li').then(($res) => {
expect($res).to.have.length(3);
warningTexts.forEach((text, index) => expect($res[index]).to.contain(text));
});

storageForm.diskFormattingAlert.title.should(
'contain.text',
'Warning alert:All bootable disks, except for read-only disks, will be formatted during installation. Make sure to back up any critical data before proceeding.',
);
});

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

hostsTableSection.getHostDisksExpander(0).click();
hostsTableSection.validateGroupingByDiskHolders(disks, warningTexts[0]);
});

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

hostsTableSection.getHostDisksExpander(1).click();
hostsTableSection.validateGroupingByDiskHolders(disks, warningTexts[1]);
});

it('Should display the correct warning for multipath', () => {
disks[6].warning = false;
disks[4].warning = true;

hostsTableSection.getHostDisksExpander(2).click();
hostsTableSection.validateGroupingByDiskHolders(disks, warningTexts[2]);
});

it('Should display no warnings', () => {
disks[6].warning = false;

hostsTableSection.getHostDisksExpander(2).click();
hostsTableSection.validateGroupingByDiskHolders(disks);
});
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { commonActions } from '../../../views/common';
import OperatorsForm from '../../../views/forms/OperatorsForm';
import OperatorsForm from '../../../views/forms/Operators/OperatorsForm';

describe(`Create cluster with mce operator enabled`, () => {
const setTestStartSignal = (activeSignal: string) => {
Expand Down
8 changes: 8 additions & 0 deletions libs/ui-lib-tests/cypress/support/interceptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ const getScenarioFixtureMapping = () => {
case 'AI_STORAGE_CLUSTER':
fixtureMapping = fixtures.createStorageFixtureMapping;
break;
case 'AI_DISK_HOLDERS_CLUSTER':
fixtureMapping = fixtures.createDiskHoldersFixtureMapping;
break;
case 'AI_CREATE_STATIC_IP':
fixtureMapping = fixtures.createStaticIpFixtureMapping;
break;
Expand Down Expand Up @@ -154,6 +157,11 @@ const setScenarioEnvVars = (activeScenario) => {
Cypress.env('NUM_MASTERS', 3);
Cypress.env('NUM_WORKERS', 2);
break;
case 'AI_DISK_HOLDERS_CLUSTER':
Cypress.env('CLUSTER_NAME', 'ai-e2e-disk-holders');
Cypress.env('NUM_MASTERS', 3);
Cypress.env('NUM_WORKERS', 2);
break;
case 'AI_CREATE_STATIC_IP':
Cypress.env('CLUSTER_NAME', 'ai-e2e-static-ip');
break;
Expand Down
2 changes: 0 additions & 2 deletions libs/ui-lib-tests/cypress/support/variables/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import './common';
import './cluster-list';
import './cluster-details';
import './host-discovery';
import './installation';
import './misc';
import './networking';
import './review-create';
import './test-constants';
import './storage-step';
19 changes: 0 additions & 19 deletions libs/ui-lib-tests/cypress/support/variables/installation.ts

This file was deleted.

7 changes: 0 additions & 7 deletions libs/ui-lib-tests/cypress/support/variables/storage-step.ts

This file was deleted.

Loading

0 comments on commit c5be684

Please sign in to comment.