]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Move force maintenance test to the workflow test suite 42821/head
authorNizamudeen A <nia@redhat.com>
Tue, 17 Aug 2021 16:56:52 +0000 (22:26 +0530)
committerNizamudeen A <nia@redhat.com>
Tue, 28 Sep 2021 08:47:20 +0000 (14:17 +0530)
Fixes: https://tracker.ceph.com/issues/52276
Signed-off-by: Nizamudeen A <nia@redhat.com>
qa/workunits/cephadm/test_dashboard_e2e.sh
src/pybind/mgr/dashboard/ci/cephadm/bootstrap-cluster.sh
src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/01-hosts-force-maintenance.e2e-spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/05-services.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/01-hosts.e2e-spec.ts

index 3d9a79839818798e0c724c3295a282fc5d7253ec..60719aa4ed56f83b7e2a3082950a56bf6665a4f6 100755 (executable)
@@ -87,23 +87,10 @@ find cypress # List all specs
 
 cypress_run "orchestrator/01-hosts.e2e-spec.ts"
 
-ceph orch apply rgw foo --placement=3
-sleep 15
-ceph orch device ls --refresh
-ceph orch ps --refresh
-sleep 10  # the previous call is asynchronous
-ceph orch device ls --format=json | tee cypress/fixtures/orchestrator/inventory.json
-ceph orch ps --format=json | tee cypress/fixtures/orchestrator/services.json
-
-cypress_run "orchestrator/01-hosts-force-maintenance.e2e-spec.ts"
-
 # Hosts are removed and added in the previous step. Do a refresh again.
-ceph orch rm rgw.foo
 ceph orch device ls --refresh
-ceph orch ps --refresh
 sleep 10
 ceph orch device ls --format=json | tee cypress/fixtures/orchestrator/inventory.json
-ceph orch ps --format=json | tee cypress/fixtures/orchestrator/services.json
 
 cypress_run "orchestrator/02-hosts-inventory.e2e-spec.ts"
 cypress_run "orchestrator/03-inventory.e2e-spec.ts"
index 4bad63bc5973c64002e673ddba12a6fc56a06e08..10a060a9bceb6afe29eb667a3c5dd6e06b557fb2 100755 (executable)
@@ -8,7 +8,7 @@ chmod +x /root/bin/cephadm
 mkdir -p /etc/ceph
 mon_ip=$(ifconfig eth0  | grep 'inet ' | awk '{ print $2}')
 
-cephadm bootstrap --mon-ip $mon_ip --initial-dashboard-password {{ admin_password }} --allow-fqdn-hostname --dashboard-password-noupdate --shared_ceph_folder /mnt/{{ ceph_dev_folder }}
+cephadm bootstrap --mon-ip $mon_ip --initial-dashboard-password {{ admin_password }} --allow-fqdn-hostname --skip-monitoring-stack --dashboard-password-noupdate --shared_ceph_folder /mnt/{{ ceph_dev_folder }}
 
 fsid=$(cat /etc/ceph/ceph.conf | grep fsid | awk '{ print $3}')
 
index 55763285e290efadc111765b477a08b1a293a52a..e28a8fbd57c2663cdb4d7d9458a01aadd081533a 100644 (file)
@@ -16,6 +16,12 @@ export class ServicesPageHelper extends PageHelper {
     last_refresh: 6
   };
 
+  serviceDetailColumnIndex = {
+    hostname: 1,
+    daemonType: 2,
+    status: 8
+  };
+
   check_for_service() {
     this.getTableCount('total').should('not.be.eq', 0);
   }
@@ -24,16 +30,24 @@ export class ServicesPageHelper extends PageHelper {
     return this.selectOption('service_type', serviceType);
   }
 
+  @PageHelper.restrictTo(pages.index.url)
+  clickServiceTab(serviceName: string, tabName: string) {
+    this.getExpandCollapseElement(serviceName).click();
+    cy.get('cd-service-details').within(() => {
+      this.getTab(tabName).click();
+    });
+  }
+
   @PageHelper.restrictTo(pages.create.url)
-  addService(serviceType: string, exist?: boolean) {
+  addService(serviceType: string, exist?: boolean, count = '1') {
     cy.get(`${this.pages.create.id}`).within(() => {
       this.selectServiceType(serviceType);
       if (serviceType === 'rgw') {
-        cy.get('#service_id').type('rgw.foo');
-        cy.get('#count').type('1');
+        cy.get('#service_id').type('foo');
+        cy.get('#count').type(count);
       } else if (serviceType === 'ingress') {
-        this.selectOption('backend_service', 'rgw.rgw.foo');
-        cy.get('#service_id').should('have.value', 'rgw.rgw.foo');
+        this.selectOption('backend_service', 'rgw.foo');
+        cy.get('#service_id').should('have.value', 'rgw.foo');
         cy.get('#virtual_ip').type('192.168.20.1/24');
         cy.get('#frontend_port').type('8081');
         cy.get('#monitor_port').type('8082');
@@ -49,6 +63,16 @@ export class ServicesPageHelper extends PageHelper {
     }
   }
 
+  checkServiceStatus(daemon: string) {
+    this.getTableCell(this.serviceDetailColumnIndex.daemonType, daemon)
+      .parent()
+      .find(`datatable-body-cell:nth-child(${this.serviceDetailColumnIndex.status}) .badge`)
+      .should(($ele) => {
+        const status = $ele.toArray().map((v) => v.innerText);
+        expect(status).to.include('running');
+      });
+  }
+
   @PageHelper.restrictTo(pages.index.url)
   checkExist(serviceName: string, exist: boolean) {
     this.getTableCell(this.columnIndex.service_name, serviceName).should(($elements) => {
@@ -62,7 +86,7 @@ export class ServicesPageHelper extends PageHelper {
   }
 
   @PageHelper.restrictTo(pages.index.url)
-  deleteService(serviceName: string, wait: number) {
+  deleteService(serviceName: string) {
     const getRow = this.getTableCell.bind(this, this.columnIndex.service_name);
     getRow(serviceName).click();
 
@@ -75,10 +99,6 @@ export class ServicesPageHelper extends PageHelper {
 
     // Wait for modal to close
     cy.get('cd-modal').should('not.exist');
-
-    // wait for delete operation to complete: tearing down the service daemons
-    cy.wait(wait);
-
     this.checkExist(serviceName, false);
   }
 }
diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/01-hosts-force-maintenance.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/01-hosts-force-maintenance.e2e-spec.ts
deleted file mode 100644 (file)
index 9a176e6..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-import { HostsPageHelper } from '../cluster/hosts.po';
-
-describe('Hosts page', () => {
-  const hosts = new HostsPageHelper();
-
-  beforeEach(() => {
-    cy.login();
-    Cypress.Cookies.preserveOnce('token');
-    hosts.navigateTo();
-  });
-
-  describe('when Orchestrator is available', () => {
-    beforeEach(function () {
-      cy.fixture('orchestrator/inventory.json').as('hosts');
-      cy.fixture('orchestrator/services.json').as('services');
-    });
-
-    it('should force enter host into maintenance', function () {
-      const hostname = Cypress._.sample(this.hosts).name;
-      const hostnameList = new Array();
-      this.hosts.array.forEach((host: any) => {
-        hostnameList.push(host.hostname);
-      });
-      const serviceList = new Array();
-      this.services.forEach((service: any) => {
-        if (hostname === service.hostname) {
-          serviceList.push(service.daemon_type);
-        }
-      });
-
-      let enterMaintenance = true;
-
-      // Force maintenance might throw out error if host are less than 3.
-      if (hostnameList.length < 3) {
-        enterMaintenance = false;
-      }
-
-      serviceList.forEach((service: string) => {
-        if (service !== 'rgw' && (service === 'mgr' || service === 'alertmanager')) {
-          enterMaintenance = false;
-        }
-      });
-
-      if (enterMaintenance) {
-        hosts.maintenance(hostname, true, true);
-      }
-    });
-  });
-});
index dec84d73562d8a423094b66979de97607c86a29b..d36ffc17eed162ef1cb7d6f7491b937f53b1efaa 100644 (file)
@@ -23,7 +23,7 @@ describe('Services page', () => {
 
       services.checkExist('ingress.rgw.rgw.foo', true);
 
-      services.deleteService('ingress.rgw.rgw.foo', 5000);
+      services.deleteService('ingress.rgw.rgw.foo');
     });
   });
 });
index b1c8ad0bbc0150d3297be3c5a2b3f121d6f9cd2b..7dd0c1104334c72ecfd5364c3a5042984e011cbf 100644 (file)
@@ -1,8 +1,16 @@
 import { HostsPageHelper } from 'cypress/integration/cluster/hosts.po';
+import { ServicesPageHelper } from 'cypress/integration/cluster/services.po';
 
 describe('Hosts page', () => {
   const hosts = new HostsPageHelper();
-  const hostnames = ['ceph-node-00.cephlab.com', 'ceph-node-01.cephlab.com'];
+  const services = new ServicesPageHelper();
+
+  const serviceName = 'rgw.foo';
+  const hostnames = [
+    'ceph-node-00.cephlab.com',
+    'ceph-node-01.cephlab.com',
+    'ceph-node-02.cephlab.com'
+  ];
   const addHost = (hostname: string, exist?: boolean, maintenance?: boolean) => {
     hosts.navigateTo('create');
     hosts.add(hostname, exist, maintenance);
@@ -16,6 +24,10 @@ describe('Hosts page', () => {
   });
 
   describe('when Orchestrator is available', () => {
+    it('should add a host', () => {
+      addHost(hostnames[2], false, false);
+    });
+
     it('should display inventory', function () {
       hosts.clickHostTab(hostnames[0], 'Physical Disks');
       cy.get('cd-host-details').within(() => {
@@ -53,5 +65,27 @@ describe('Hosts page', () => {
     it('should exit host from maintenance', function () {
       hosts.maintenance(hostnames[1], true);
     });
+
+    it('should check if mon service is running', () => {
+      hosts.clickHostTab(hostnames[1], 'Daemons');
+      cy.get('cd-host-details').within(() => {
+        services.checkServiceStatus('mon');
+      });
+    });
+
+    it('should create rgw services', () => {
+      services.navigateTo('create');
+      services.addService('rgw', false, '3');
+      services.checkExist(serviceName, true);
+      hosts.navigateTo();
+      hosts.clickHostTab(hostnames[1], 'Daemons');
+      cy.get('cd-host-details').within(() => {
+        services.checkServiceStatus('rgw');
+      });
+    });
+
+    it('should force maintenance', () => {
+      hosts.maintenance(hostnames[1], true, true);
+    });
   });
 });