]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix test_error force maintenance dashboard check 41300/head
authorNizamudeen A <nia@redhat.com>
Wed, 12 May 2021 10:07:40 +0000 (15:37 +0530)
committerNizamudeen A <nia@redhat.com>
Wed, 14 Jul 2021 11:42:44 +0000 (17:12 +0530)
Fixes: https://tracker.ceph.com/issues/50771
Signed-off-by: Nizamudeen A <nia@redhat.com>
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/01-hosts-force-maintenance.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts

index ac00e2f2903e71f55ca991e17cc49ec8e85eab40..9a176e6e8ee986acd86425b50031c1f3522d5b04 100644 (file)
@@ -17,6 +17,10 @@ describe('Hosts page', () => {
 
     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) {
@@ -25,8 +29,14 @@ describe('Hosts page', () => {
       });
 
       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 === 'mgr' || service === 'alertmanager') {
+        if (service !== 'rgw' && (service === 'mgr' || service === 'alertmanager')) {
           enterMaintenance = false;
         }
       });
index c92188ed054114173bd6733ec855d6cdea4fce55..f4d400f3230c8cf8424c5a040c21d432aa468737 100644 (file)
@@ -31,7 +31,7 @@ class MockShowForceMaintenanceModal {
       msg.includes('WARNING') &&
       !msg.includes('It is NOT safe to stop') &&
       !msg.includes('ALERT') &&
-      !msg.includes('unable to stop')
+      !msg.includes('unsafe to stop')
     ) {
       this.showModal = true;
     }
@@ -143,8 +143,8 @@ describe('HostsComponent', () => {
     expect(showForceMaintenanceModal.showModal).toBeFalsy();
   });
 
-  it('should not show force maintenance modal when it is unable to stop host', () => {
-    const errorMsg = 'unable to stop osd.0 because of some unknown reason';
+  it('should not show force maintenance modal when it is unsafe to stop host', () => {
+    const errorMsg = 'unsafe to stop osd.0 because of some unknown reason';
     showForceMaintenanceModal.showModalDialog(errorMsg);
     expect(showForceMaintenanceModal.showModal).toBeFalsy();
   });
index e4f042699eb39d396b45d6dbbbc3c8e2766b09f3..8c559a748b05dff82aa9069d1a9871e27f2609be 100644 (file)
@@ -247,9 +247,9 @@ export class HostsComponent extends ListWithDetails implements OnInit {
             error.error['detail'].includes('WARNING') &&
             !error.error['detail'].includes('It is NOT safe to stop') &&
             !error.error['detail'].includes('ALERT') &&
-            !error.error['detail'].includes('unable to stop')
+            !error.error['detail'].includes('unsafe to stop')
           ) {
-            const modalVarialbes = {
+            const modalVariables = {
               titleText: $localize`Warning`,
               buttonText: $localize`Continue`,
               warning: true,
@@ -264,7 +264,7 @@ export class HostsComponent extends ListWithDetails implements OnInit {
                 );
               }
             };
-            this.modalRef = this.modalService.show(ConfirmationModalComponent, modalVarialbes);
+            this.modalRef = this.modalService.show(ConfirmationModalComponent, modalVariables);
           } else {
             this.notificationService.show(
               NotificationType.error,