]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix timeout error in dashboard cephadm e2e job 44364/head
authorNizamudeen A <nia@redhat.com>
Mon, 20 Dec 2021 09:14:29 +0000 (14:44 +0530)
committerNizamudeen A <nia@redhat.com>
Thu, 23 Dec 2021 12:35:58 +0000 (18:05 +0530)
1. Fix the timeout error happening in the dashboard e2e job
2. Take care of the flaky force maintenance check

Most of the time our test is getting timed out while searching for an item
in the table. Its because `.clear().type()` is not clearing the content
in the search field sometimes and that creates a wrong data to be
entered into the search field and it starts searching based on this
wrong name. To avoid this I am explicitly clearing the search area
before typing.

Fixes: https://tracker.ceph.com/issues/53672
Signed-off-by: Nizamudeen A <nia@redhat.com>
src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/configuration.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/osds.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/06-cluster-check.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts

index f309120c60d6c9d87bbe6dea4725c70b39a34a4d..0133dc31f9030eb8b4247e2bbca50e8b9a3d9334 100644 (file)
@@ -23,7 +23,7 @@ export class ConfigurationPageHelper extends PageHelper {
     cy.get('[data-cy=submitBtn]').click();
 
     // Enter config setting name into filter box
-    this.seachTable(name);
+    this.searchTable(name);
 
     // Expand row
     this.getExpandCollapseElement(name).click();
@@ -60,7 +60,7 @@ export class ConfigurationPageHelper extends PageHelper {
     cy.get('[data-cy=submitBtn]').click();
 
     // Enter config setting name into filter box
-    this.seachTable(name);
+    this.searchTable(name);
 
     // Checks for visibility of config in table
     this.getExpandCollapseElement(name).should('be.visible').click();
index bca48766227ddfa4839f85fb615b93baf1876e1a..f2be649ae5fec6c40f5b1a141d0c438902aa15c6 100644 (file)
@@ -69,7 +69,6 @@ export class HostsPageHelper extends PageHelper {
   }
 
   checkExist(hostname: string, exist: boolean) {
-    this.clearTableSearchInput();
     this.getTableCell(this.columnIndex.hostname, hostname).should(($elements) => {
       const hosts = $elements.map((_, el) => el.textContent).get();
       if (exist) {
@@ -127,6 +126,7 @@ export class HostsPageHelper extends PageHelper {
 
   @PageHelper.restrictTo(pages.index.url)
   maintenance(hostname: string, exit = false, force = false) {
+    this.clearTableSearchInput();
     if (force) {
       this.getTableCell(this.columnIndex.hostname, hostname).click();
       this.clickActionButton('enter-maintenance');
index 263dfd89ec1606b724ac1725bce7e526b6d821a0..862c7c6011d4b52fd017824b7cbcce6302f96385 100644 (file)
@@ -36,7 +36,7 @@ export class OSDsPageHelper extends PageHelper {
 
   @PageHelper.restrictTo(pages.index.url)
   checkStatus(id: number, status: string[]) {
-    this.seachTable(`id:${id}`);
+    this.searchTable(`id:${id}`);
     this.expectTableCount('found', 1);
     cy.get(`datatable-body-cell:nth-child(${this.columnIndex.status}) .badge`).should(($ele) => {
       const allStatus = $ele.toArray().map((v) => v.innerText);
@@ -48,7 +48,7 @@ export class OSDsPageHelper extends PageHelper {
 
   @PageHelper.restrictTo(pages.index.url)
   ensureNoOsd(id: number) {
-    this.seachTable(`id:${id}`);
+    this.searchTable(`id:${id}`);
     this.expectTableCount('found', 0);
     this.clearTableSearchInput();
   }
index 50bd6121ce5fac38beea77ef8a677b52c5b31468..0b70e90b6563b436f18ebe03d0c73f767fcae448 100644 (file)
@@ -81,13 +81,15 @@ 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');
-      });
+    cy.get('cd-service-daemon-list').within(() => {
+      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');
+        });
+    });
   }
 
   expectPlacementCount(serviceName: string, expectedCount: string) {
index be09371013cb358610d2d1075aa11d00f0e0edd7..46cd5fa19c9f121d5e43e010a320d24ceb089074 100644 (file)
@@ -62,10 +62,6 @@ describe('when cluster creation is completed', () => {
       });
     });
 
-    it('should force maintenance and exit', { retries: 1 }, () => {
-      hosts.maintenance(hostnames[3], true, true);
-    });
-
     it('should drain, remove and add the host back', () => {
       hosts.drain(hostnames[1]);
       hosts.remove(hostnames[1]);
@@ -73,6 +69,10 @@ describe('when cluster creation is completed', () => {
       hosts.add(hostnames[1]);
       hosts.checkExist(hostnames[1], true);
     });
+
+    it('should force maintenance and exit', { retries: 1 }, () => {
+      hosts.maintenance(hostnames[3], true, true);
+    });
   });
 
   describe('OSDs page', () => {
index 85a536f05a9a1da12add503278a50a81608aecab..72d811065a8cea4a88665348762887b6a9f21f87 100644 (file)
@@ -171,7 +171,7 @@ export abstract class PageHelper {
   getTableRow(content: string) {
     this.waitDataTableToLoad();
 
-    this.seachTable(content);
+    this.searchTable(content);
     return cy.contains('.datatable-body-row', content);
   }
 
@@ -189,7 +189,7 @@ export abstract class PageHelper {
     this.waitDataTableToLoad();
 
     if (content) {
-      this.seachTable(content);
+      this.searchTable(content);
       return cy.contains('.datatable-body-cell-label', content);
     } else {
       return cy.get('.datatable-body-cell-label').first();
@@ -198,7 +198,8 @@ export abstract class PageHelper {
 
   getTableCell(columnIndex: number, exactContent: string) {
     this.waitDataTableToLoad();
-    this.seachTable(exactContent);
+    this.clearTableSearchInput();
+    this.searchTable(exactContent);
     return cy.contains(
       `datatable-body-row datatable-body-cell:nth-child(${columnIndex})`,
       new RegExp(`^${exactContent}$`)
@@ -250,7 +251,7 @@ export abstract class PageHelper {
     cy.get('cd-table .dataTables_paginate input').first().clear({ force: true }).type(size);
   }
 
-  seachTable(text: string) {
+  searchTable(text: string) {
     this.waitDataTableToLoad();
 
     this.setPageSize('10');
@@ -260,7 +261,7 @@ export abstract class PageHelper {
   clearTableSearchInput() {
     this.waitDataTableToLoad();
 
-    return cy.get('cd-table .search button').click();
+    return cy.get('cd-table .search button').first().click();
   }
 
   // Click the action button