From: Nizamudeen A Date: Mon, 19 Sep 2022 08:45:52 +0000 (+0530) Subject: mgr/dashboard: refactor dashboard cephadm e2e tests X-Git-Tag: v18.1.0~1031^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bc20ab493cd7b70f140e507f99576496fb755aac;p=ceph.git mgr/dashboard: refactor dashboard cephadm e2e tests Fixes: https://tracker.ceph.com/issues/57511 Signed-off-by: Nizamudeen A --- diff --git a/src/pybind/mgr/dashboard/ci/cephadm/run-cephadm-e2e-tests.sh b/src/pybind/mgr/dashboard/ci/cephadm/run-cephadm-e2e-tests.sh index 063b544f4914..4b6ad4dbe88b 100755 --- a/src/pybind/mgr/dashboard/ci/cephadm/run-cephadm-e2e-tests.sh +++ b/src/pybind/mgr/dashboard/ci/cephadm/run-cephadm-e2e-tests.sh @@ -46,5 +46,12 @@ while [[ $PROMETHEUS_RUNNING_COUNT -lt 1 ]]; do PROMETHEUS_RUNNING_COUNT=$(kcli ssh -u root ceph-node-00 'cephadm shell "ceph orch ls --service_name=prometheus --format=json"' | jq -r '.[] | .status.running') done +# grafana ip address is set to the fqdn by default. +# kcli is not working with that, so setting the IP manually. +kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-alertmanager-api-host http://192.168.100.100:9093"' +kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-prometheus-api-host http://192.168.100.100:9095"' +kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-grafana-api-url https://192.168.100.100:3000"' +kcli ssh -u root ceph-node-00 'cephadm shell "ceph orch apply node-exporter --placement 'count:2'"' + cypress_run ["orchestrator/workflow/*.feature, orchestrator/workflow/*-spec.ts"] cypress_run "orchestrator/grafana/*.feature" diff --git a/src/pybind/mgr/dashboard/ci/cephadm/start-cluster.sh b/src/pybind/mgr/dashboard/ci/cephadm/start-cluster.sh index e3434d72a4f9..97c6a301be01 100755 --- a/src/pybind/mgr/dashboard/ci/cephadm/start-cluster.sh +++ b/src/pybind/mgr/dashboard/ci/cephadm/start-cluster.sh @@ -8,6 +8,8 @@ cleanup() { echo "Starting cleanup..." kcli delete plan -y ceph || true kcli delete network ceph-dashboard -y + kcli delete pool ceph-dashboard -y + rm -rf ${HOME}/.kcli docker container prune -f echo "Cleanup completed." fi diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts index 33fe756ff857..848f99501ac9 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts @@ -159,10 +159,6 @@ export class HostsPageHelper extends PageHelper { this.clickActionButton('start-drain'); this.checkLabelExists(hostname, ['_no_schedule'], true); - // unselect it to avoid colliding with any other selection - // in different steps - this.getTableCell(this.columnIndex.hostname, hostname).click(); - this.clickTab('cd-host-details', hostname, 'Daemons'); cy.get('cd-host-details').within(() => { cy.wait(20000); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts index 481d6bc9b4d3..f2c123f874df 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts @@ -39,7 +39,7 @@ export class ServicesPageHelper extends PageHelper { addService( serviceType: string, exist?: boolean, - count = '1', + count = 1, snmpVersion?: string, snmpPrivProtocol?: boolean, unmanaged = false @@ -49,7 +49,7 @@ export class ServicesPageHelper extends PageHelper { switch (serviceType) { case 'rgw': cy.get('#service_id').type('foo'); - unmanaged ? cy.get('label[for=unmanaged]').click() : cy.get('#count').type(count); + unmanaged ? cy.get('label[for=unmanaged]').click() : cy.get('#count').type(String(count)); break; case 'ingress': @@ -65,7 +65,7 @@ export class ServicesPageHelper extends PageHelper { case 'nfs': cy.get('#service_id').type('testnfs'); - unmanaged ? cy.get('label[for=unmanaged]').click() : cy.get('#count').type(count); + unmanaged ? cy.get('label[for=unmanaged]').click() : cy.get('#count').type(String(count)); break; case 'snmp-gateway': @@ -89,7 +89,7 @@ export class ServicesPageHelper extends PageHelper { default: cy.get('#service_id').type('test'); - unmanaged ? cy.get('label[for=unmanaged]').click() : cy.get('#count').type(count); + unmanaged ? cy.get('label[for=unmanaged]').click() : cy.get('#count').type(String(count)); break; } if (serviceType === 'snmp-gateway') { diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/common/01-global.feature.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/common/01-global.feature.po.ts index 575d4013b937..d5b4645b8e7c 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/common/01-global.feature.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/common/01-global.feature.po.ts @@ -158,7 +158,7 @@ And('I should see row {string} does not have {string}', (row: string, options: s And('I go to the {string} tab', (names: string) => { for (const name of names.split(', ')) { - cy.contains('.nav.nav-tabs li', name).click(); + cy.contains('.nav.nav-tabs a', name).click(); } }); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/02-create-cluster-add-host.feature b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/02-create-cluster-add-host.feature index 93c10833d4ee..be49fcba0993 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/02-create-cluster-add-host.feature +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/02-create-cluster-add-host.feature @@ -14,8 +14,9 @@ Feature: Cluster expansion host addition When I click on "Add" button And enter "hostname" "" And select options "" - And I click on submit button - Then I should see a row with "" + And I click on "Add Host" button + Then I should not see the modal + And I should see a row with "" And I should see row "" have "" Examples: @@ -43,8 +44,9 @@ Feature: Cluster expansion host addition Given I am on the "Add Hosts" section When I click on "Add" button And enter "hostname" "ceph-node-[01-02]" - And I click on submit button - Then I should see rows with following entries + And I click on "Add Host" button + Then I should not see the modal + And I should see rows with following entries | hostname | | ceph-node-01 | | ceph-node-02 | @@ -61,12 +63,12 @@ Feature: Cluster expansion host addition When I select a row "" And I click on "Edit" button from the table actions And "add" option "" - And I click on submit button + And I click on "Edit Host" button Then I should see row "" have "" When I select a row "" And I click on "Edit" button from the table actions And "remove" option "" - And I click on submit button + And I click on "Edit Host" button Then I should see row "" does not have "" Examples: diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/03-create-cluster-create-services.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/03-create-cluster-create-services.e2e-spec.ts index 7668cafcf928..745a2ec5d18f 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/03-create-cluster-create-services.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/03-create-cluster-create-services.e2e-spec.ts @@ -9,7 +9,7 @@ describe('Create cluster create services page', () => { const createCluster = new CreateClusterWizardHelper(); const createClusterServicePage = new CreateClusterServicePageHelper(); - const createService = (serviceType: string, serviceName: string, count = '1') => { + const createService = (serviceType: string, serviceName: string, count = 1) => { cy.get('[aria-label=Create]').first().click(); createClusterServicePage.addService(serviceType, false, count); createClusterServicePage.checkExist(serviceName, true); @@ -31,7 +31,7 @@ describe('Create cluster create services page', () => { const serviceName = 'mds.test'; it('should create an mds service', () => { - createService('mds', serviceName, '1'); + createService('mds', serviceName); }); it('should edit a service', () => { diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/04-create-cluster-create-osds.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/04-create-cluster-create-osds.e2e-spec.ts index a82be9855485..24262435da2a 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/04-create-cluster-create-osds.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/04-create-cluster-create-osds.e2e-spec.ts @@ -22,7 +22,7 @@ describe('Create cluster create osds page', () => { describe('when Orchestrator is available', () => { it('should create OSDs', () => { - const hostnames = ['ceph-node-00', 'ceph-node-01', 'ceph-node-02']; + const hostnames = ['ceph-node-00', 'ceph-node-01']; for (const hostname of hostnames) { osds.create('hdd', hostname, true); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/06-cluster-check.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/06-cluster-check.e2e-spec.ts index a58db9041740..565c5da21e05 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/06-cluster-check.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/06-cluster-check.e2e-spec.ts @@ -1,5 +1,4 @@ /* tslint:disable*/ -import { Input, ManagerModulesPageHelper } from '../../cluster/mgr-modules.po'; import { CreateClusterWizardHelper } from '../../cluster/create-cluster.po'; import { HostsPageHelper } from '../../cluster/hosts.po'; import { ServicesPageHelper } from '../../cluster/services.po'; @@ -9,7 +8,6 @@ describe('when cluster creation is completed', () => { const createCluster = new CreateClusterWizardHelper(); const services = new ServicesPageHelper(); const hosts = new HostsPageHelper(); - const mgrmodules = new ManagerModulesPageHelper(); const hostnames = ['ceph-node-00', 'ceph-node-01', 'ceph-node-02', 'ceph-node-03']; @@ -32,33 +30,10 @@ describe('when cluster creation is completed', () => { hosts.navigateTo(); }); - // grafana ip address is set to the fqdn by default. - // kcli is not working with that, so setting the IP manually. - it('should change ip address of grafana, prometheus and alertmanager', () => { - const dashboardArr: Input[] = [ - { - id: 'GRAFANA_API_URL', - newValue: 'https://192.168.100.100:3000', - oldValue: '' - }, - { - id: 'PROMETHEUS_API_HOST', - newValue: 'http://192.168.100.100:9095', - oldValue: '' - }, - { - id: 'ALERTMANAGER_API_HOST', - newValue: 'http://192.168.100.100:9093', - oldValue: '' - } - ]; - mgrmodules.editMgrModule('dashboard', dashboardArr); - }); - - // avoid creating node-exporter on the newly added host - // to favour the host draining process - it('should reduce the count for node-exporter', { retries: 2 }, () => { - services.editService('node-exporter', '3'); + it('should add one more host', () => { + hosts.navigateTo('add'); + hosts.add(hostnames[3]); + hosts.checkExist(hostnames[3], true); }); it('should check if monitoring stacks are running on the root host', { retries: 2 }, () => { @@ -71,12 +46,6 @@ describe('when cluster creation is completed', () => { } }); - it('should add one more host', () => { - hosts.navigateTo('add'); - hosts.add(hostnames[3]); - hosts.checkExist(hostnames[3], true); - }); - it('should have removed "_no_schedule" label', () => { for (const hostname of hostnames) { hosts.checkLabelExists(hostname, ['_no_schedule'], false); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/08-hosts.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/08-hosts.e2e-spec.ts index 374ecdb0cb6e..6e8c63279c2c 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/08-hosts.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/08-hosts.e2e-spec.ts @@ -18,7 +18,7 @@ describe('Host Page', () => { // rgw is needed for testing the force maintenance it('should create rgw services', () => { services.navigateTo('create'); - services.addService('rgw', false, '4'); + services.addService('rgw', false, 4); services.checkExist('rgw.foo', true); }); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/09-services.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/09-services.e2e-spec.ts index ed9ffb9890a1..ba24f7d1c6c0 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/09-services.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/09-services.e2e-spec.ts @@ -67,7 +67,7 @@ describe('Services page', () => { it('should create and delete snmp-gateway service with version V2c', () => { services.navigateTo('create'); - services.addService('snmp-gateway', false, '1', 'V2c'); + services.addService('snmp-gateway', false, 1, 'V2c'); services.checkExist('snmp-gateway', true); services.clickServiceTab('snmp-gateway', 'Details'); @@ -80,7 +80,7 @@ describe('Services page', () => { it('should create and delete snmp-gateway service with version V3', () => { services.navigateTo('create'); - services.addService('snmp-gateway', false, '1', 'V3', true); + services.addService('snmp-gateway', false, 1, 'V3', true); services.checkExist('snmp-gateway', true); services.clickServiceTab('snmp-gateway', 'Details'); @@ -93,7 +93,7 @@ describe('Services page', () => { it('should create and delete snmp-gateway service with version V3 and w/o privacy protocol', () => { services.navigateTo('create'); - services.addService('snmp-gateway', false, '1', 'V3', false); + services.addService('snmp-gateway', false, 1, 'V3', false); services.checkExist('snmp-gateway', true); services.clickServiceTab('snmp-gateway', 'Details'); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts index d1c2f9cc3f11..2c5d72977d06 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts @@ -1,5 +1,6 @@ import { AfterViewInit, + ChangeDetectorRef, Component, Input, OnChanges, @@ -97,7 +98,8 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI public actionLabels: ActionLabelsI18n, private authStorageService: AuthStorageService, private daemonService: DaemonService, - private notificationService: NotificationService + private notificationService: NotificationService, + private cdRef: ChangeDetectorRef ) {} ngOnInit() { @@ -214,6 +216,10 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI this.columns = this.columns.filter((col: any) => { return !this.hiddenColumns.includes(col.prop); }); + + setTimeout(() => { + this.cdRef.detectChanges(); + }, 1000); } ngOnChanges() {