Skip to content

Commit

Permalink
mgr/dashboard: Cluster Creation Create OSDs Section
Browse files Browse the repository at this point in the history
Create OSDs section in cluster creation wizard

Fixes: https://tracker.ceph.com/issues/51991
Signed-off-by: Aashish Sharma <aasharma@redhat.com>
  • Loading branch information
Aashish Sharma committed Aug 9, 2021
1 parent b53698b commit 9e4add7
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 2 deletions.
Expand Up @@ -5,7 +5,13 @@ const pages = {
index: { url: '#/expand-cluster', id: 'cd-create-cluster' }
};

const osd_pages = {
index: { url: '#/osd', id: 'cd-osd-list' },
create: { url: '#/osd/(modal:create)', id: 'cd-osd-form' }
};

export class CreateClusterWizardHelper extends PageHelper {
osd_pages = osd_pages;
pages = pages;
columnIndex = {
hostname: 1,
Expand Down Expand Up @@ -110,4 +116,27 @@ export class CreateClusterWizardHelper extends PageHelper {
}
});
}

create(deviceType: 'hdd' | 'ssd') {
cy.get('.btn.btn-accent').first().click();

cy.get('cd-modal').should('exist');
// Click Primary devices Add button
cy.get('cd-osd-devices-selection-groups[name="Primary"]').as('primaryGroups');
cy.get('@primaryGroups').find('button').click();

// Select all devices with `deviceType`
cy.get('cd-osd-devices-selection-modal').within(() => {
cy.get('.modal-footer .tc_submitButton').as('addButton').should('be.disabled');
this.filterTable('Type', deviceType);
cy.get('@addButton').click();
});

cy.get('@primaryGroups').within(() => {
this.getTableCount('total').as('newOSDCount');
});

cy.get(`${this.osd_pages.create.id} .modal-footer .tc_submitButton`).click();
cy.get(`cd-osd-creation-preview-modal .modal-footer .tc_submitButton`).click();
}
}
@@ -0,0 +1,60 @@
import { CreateClusterWizardHelper } from 'cypress/integration/cluster/create-cluster.po';

describe('Create cluster create osds page', () => {
const createCluster = new CreateClusterWizardHelper();

beforeEach(() => {
cy.login();
Cypress.Cookies.preserveOnce('token');
createCluster.navigateTo();
createCluster.createCluster();
cy.get('button[aria-label="Next"]').click();
});

it('should check if nav-link and title contains Create OSDs', () => {
cy.get('.nav-link').should('contain.text', 'Create OSDs');

cy.get('.title').should('contain.text', 'Create OSDs');
});

describe('when Orchestrator is available', () => {
it('should create OSDs', () => {
createCluster.getTableCount('total').as('initOSDCount');

createCluster.create('hdd');

cy.get('@newOSDCount').then((newCount) => {
cy.get('@initOSDCount').then((oldCount) => {
const expectedCount = Number(oldCount) + Number(newCount);

// check total rows
createCluster.expectTableCount('total', expectedCount);

cy.wait(30000);
expect(Number(newCount)).to.be.gte(1);
});
});
});
});

describe('by selecting one row in OSDs List', () => {
beforeEach(() => {
createCluster.getExpandCollapseElement().click();
});

it('should show the correct text for the tab labels', () => {
cy.get('#tabset-osd-details > li > a').then(($tabs) => {
const tabHeadings = $tabs.map((_i, e) => e.textContent).get();

expect(tabHeadings).to.eql([
'Devices',
'Attributes (OSD map)',
'Metadata',
'Device health',
'Performance counter',
'Performance Details'
]);
});
});
});
});
Expand Up @@ -10,13 +10,12 @@ describe('Create Cluster Review page', () => {
createCluster.createCluster();

cy.get('button[aria-label="Next"]').click();
cy.get('button[aria-label="Next"]').click();
});

describe('navigation link and title test', () => {
it('should check if nav-link and title contains Review', () => {
cy.get('.nav-link').should('contain.text', 'Review');

cy.get('.title').should('contain.text', 'Review');
});
});

Expand Down
@@ -1,5 +1,6 @@
import { CreateClusterWizardHelper } from 'cypress/integration/cluster/create-cluster.po';
import { HostsPageHelper } from 'cypress/integration/cluster/hosts.po';
import { OSDsPageHelper } from 'cypress/integration/cluster/osds.po';

describe('when cluster creation is completed', () => {
const createCluster = new CreateClusterWizardHelper();
Expand All @@ -13,12 +14,27 @@ describe('when cluster creation is completed', () => {
createCluster.navigateTo();
createCluster.createCluster();

cy.get('button[aria-label="Next"]').click();
cy.get('button[aria-label="Next"]').click();
cy.get('button[aria-label="Next"]').click();

cy.get('cd-dashboard').should('exist');
});

describe('OSDs page', () => {
const osds = new OSDsPageHelper();

beforeEach(() => {
osds.navigateTo();
});

it('should display osds', () => {
cy.get('cd-osd-list').within(() => {
osds.getTableCount('total').should('be.gte', 0);
});
});
});

describe('Hosts page', () => {
const hosts = new HostsPageHelper();
const hostnames = ['ceph-node-00.cephlab.com', 'ceph-node-02.cephlab.com'];
Expand Down

0 comments on commit 9e4add7

Please sign in to comment.