]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: refactor dashboard cephadm e2e tests
authorNizamudeen A <nia@redhat.com>
Mon, 19 Sep 2022 08:45:52 +0000 (14:15 +0530)
committerNizamudeen A <nia@redhat.com>
Mon, 10 Oct 2022 08:39:06 +0000 (14:09 +0530)
Fixes: https://tracker.ceph.com/issues/57511
Signed-off-by: Nizamudeen A <nia@redhat.com>
12 files changed:
src/pybind/mgr/dashboard/ci/cephadm/run-cephadm-e2e-tests.sh
src/pybind/mgr/dashboard/ci/cephadm/start-cluster.sh
src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/common/01-global.feature.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/02-create-cluster-add-host.feature
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/03-create-cluster-create-services.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/04-create-cluster-create-osds.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/06-cluster-check.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/08-hosts.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/09-services.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts

index 063b544f49148290cb80d45b44c86e094d509fcd..4b6ad4dbe88b7c8b993bca30b82b65488c3e0ba7 100755 (executable)
@@ -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"
index e3434d72a4f9d1ce6cc180961609e161b607db63..97c6a301be01073bcd3bdb92ea329b818e74652b 100755 (executable)
@@ -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
index 33fe756ff857781e32b11751262542c06a15cb1c..848f99501ac9f0b1ed4ef3ddfa7f0c85034406a1 100644 (file)
@@ -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);
index 481d6bc9b4d3a66d7a0df5b9c3a3fd25e5e45954..f2c123f874df6290222abf32410bbaa1d1cbfdd7 100644 (file)
@@ -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') {
index 575d4013b9376267427107c7fcad3417ee448310..d5b4645b8e7c6f1d826364519afafeea96bdc212 100644 (file)
@@ -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();
   }
 });
 
index 93c10833d4ee5f619cced846089910f5b6f149bf..be49fcba099359f62a9c58ba62d00e60e7b3dd93 100644 (file)
@@ -14,8 +14,9 @@ Feature: Cluster expansion host addition
         When I click on "Add" button
         And enter "hostname" "<hostname>"
         And select options "<labels>"
-        And I click on submit button
-        Then I should see a row with "<hostname>"
+        And I click on "Add Host" button
+        Then I should not see the modal
+        And I should see a row with "<hostname>"
         And I should see row "<hostname>" have "<labels>"
 
         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 "<hostname>"
         And I click on "Edit" button from the table actions
         And "add" option "<labels>"
-        And I click on submit button
+        And I click on "Edit Host" button
         Then I should see row "<hostname>" have "<labels>"
         When I select a row "<hostname>"
         And I click on "Edit" button from the table actions
         And "remove" option "<labels>"
-        And I click on submit button
+        And I click on "Edit Host" button
         Then I should see row "<hostname>" does not have "<labels>"
 
         Examples:
index 7668cafcf928c23babd75fed2e97c577bacbad87..745a2ec5d18fb95f4ae9df7a077b930e45236f0c 100644 (file)
@@ -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', () => {
index a82be985548569b3445b09fb20211c3942756cf0..24262435da2aaf1cd72949f527ea63be547c6769 100644 (file)
@@ -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);
 
index a58db904174047405d44fc028bce039d3ec35b28..565c5da21e05a0164e07bfe453c8a9dacd5f21de 100644 (file)
@@ -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);
index 374ecdb0cb6ee8d827d92ff037098cbdcef383cd..6e8c63279c2cd684b0b63acd82e1a6cc177bc78f 100644 (file)
@@ -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);
   });
 
index ed9ffb9890a1e83de84872d8f847e2841cd296e8..ba24f7d1c6c022c0722a150fd1a5a18194a5f78f 100644 (file)
@@ -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');
index d1c2f9cc3f11d153fcccce0883d9d2c66990fa68..2c5d72977d06283263678b5aeb5b243f549dddcc 100644 (file)
@@ -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() {