Skip to content

Commit cd6fab2

Browse files
committed
mgr/dashboard: fix cephadm e2e failure
- fix add host failure because of cds-tag migration - fix draining issue where start/stop toggle was not working properly - supress an undefined class error in cypress which is raised in different place from table component Signed-off-by: Nizamudeen A <[email protected]>
1 parent 2af1d1c commit cd6fab2

File tree

9 files changed

+25
-26
lines changed

9 files changed

+25
-26
lines changed

src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/hosts.po.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class HostsPageHelper extends PageHelper {
9595
this.getTableCell(this.columnIndex.hostname, hostname, true).as('row').click();
9696
cy.get('@row')
9797
.parent()
98-
.find(`[cdstabledata]:nth-child(${this.columnIndex.labels}) .tag`)
98+
.find(`[cdstabledata]:nth-child(${this.columnIndex.labels}) cds-tag span`)
9999
.should(($ele) => {
100100
const newLabels = $ele.toArray().map((v) => v.innerText);
101101
for (const label of labels) {

src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/services.po.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ export class ServicesPageHelper extends PageHelper {
155155
}
156156

157157
cy.get('cd-service-daemon-list').within(() => {
158+
cy.wait(1000); // wait for the status to be updated
158159
this.getTableCell(daemonNameIndex, daemon, true)
159160
.parent()
160161
.find(`[cdstabledata]:nth-child(${statusIndex}) cds-tag`)

src/pybind/mgr/dashboard/frontend/cypress/e2e/common/grafana.feature.po.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ When('I view the grafana panel {string}', (panels: string) => {
2626
cy.get('.grafana-app')
2727
.wait(WAIT_TO_LOAD)
2828
.within(() => {
29-
cy.get(`[data-testid="data-testid Panel header ${panel}"]`).click();
30-
cy.get(`[aria-label="Menu for panel with title ${panel}"]`).click();
29+
cy.contains('[data-testid="data-testid header-container"] h2', panel)
30+
.closest('[data-testid="data-testid header-container"]')
31+
.click();
32+
cy.get(`[data-testid="data-testid Panel menu ${panel}"]`).click();
3133
});
3234

3335
cy.get('[data-testid="data-testid Panel menu item View"]').click();

src/pybind/mgr/dashboard/frontend/cypress/e2e/common/table-helper.feature.po.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ And('I should see row {string} have {string}', (row: string, options: string) =>
7979
if (options) {
8080
cy.get('.cds--search-input').first().clear().type(row);
8181
for (const option of options.split(',')) {
82-
cy.contains(`[cdstablerow] [cdstabledata] .tag`, option).should('exist');
82+
cy.contains(`[cdstablerow] [cdstabledata] cds-tag span`, option).should('exist');
8383
}
8484
}
8585
});

src/pybind/mgr/dashboard/frontend/cypress/e2e/orchestrator/grafana/grafana.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ Feature: Grafana panels
3737
| Total Requests/sec by RGW Instance | foo.ceph-node-00, foo.ceph-node-01, foo.ceph-node-02 |
3838
| GET Latencies by RGW Instance | foo.ceph-node-00, foo.ceph-node-01, foo.ceph-node-02 |
3939
| Bandwidth by RGW Instance | foo.ceph-node-00, foo.ceph-node-01, foo.ceph-node-02 |
40-
| PUT Latencies by RGW Instance | foo.ceph-node-00, foo.ceph-node-01, foo.ceph-node-02 |
4140
| Average GET/PUT Latencies by RGW Instance | GET, PUT |
4241
| Bandwidth Consumed by Type | GETs, PUTs |
4342

src/pybind/mgr/dashboard/frontend/cypress/e2e/page-helper.po.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export abstract class PageHelper {
316316
.find('[cdstabledata] [data-testid="table-action-btn"]')
317317
.click({ force: true });
318318
cy.wait(waitTime);
319-
cy.get(`button.${action}`).click({ force: true });
319+
cy.get(`button.${action}`).should('not.be.disabled').click({ force: true });
320320
}
321321

322322
/**

src/pybind/mgr/dashboard/frontend/cypress/support/e2e.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ afterEach(() => {
88
});
99

1010
Cypress.on('uncaught:exception', (err: Error) => {
11-
if (
12-
err.message.includes('ResizeObserver loop limit exceeded') ||
13-
err.message.includes('api/prometheus/rules') ||
14-
err.message.includes('NG0100: ExpressionChangedAfterItHasBeenCheckedError')
15-
) {
11+
const ignoredErrors = [
12+
'ResizeObserver loop limit exceeded',
13+
'api/prometheus/rules',
14+
'NG0100: ExpressionChangedAfterItHasBeenCheckedError',
15+
'NgClass can only toggle CSS classes'
16+
];
17+
if (ignoredErrors.some((error) => err.message.includes(error))) {
1618
return false;
1719
}
1820
return true;

src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272

7373
<ng-template #hostNameTpl
7474
let-row="data.row">
75-
<span [ngClass]="row">
75+
<span>
7676
{{ row.hostname }}
7777
</span><br>
7878
<span class="text-muted fst-italic"

src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class HostsComponent extends ListWithDetails implements OnDestroy, OnInit
9797
isExecuting = false;
9898
errorMessage: string;
9999
enableMaintenanceBtn: boolean;
100-
enableDrainBtn: boolean;
100+
draining: boolean = false;
101101
bsModalRef: NgbModalRef;
102102

103103
icons = Icons;
@@ -133,6 +133,9 @@ export class HostsComponent extends ListWithDetails implements OnDestroy, OnInit
133133
) {
134134
super();
135135
this.permissions = this.authStorageService.getPermissions();
136+
}
137+
138+
ngOnInit() {
136139
this.expandClusterActions = [
137140
{
138141
name: this.actionLabels.EXPAND_CLUSTER,
@@ -169,18 +172,14 @@ export class HostsComponent extends ListWithDetails implements OnDestroy, OnInit
169172
permission: 'update',
170173
icon: Icons.exit,
171174
click: () => this.hostDrain(),
172-
disable: (selection: CdTableSelection) =>
173-
this.getDisable('drain', selection) || !this.enableDrainBtn,
174-
visible: () => !this.showGeneralActionsOnly && this.enableDrainBtn
175+
visible: () => !this.showGeneralActionsOnly && !this.draining
175176
},
176177
{
177178
name: this.actionLabels.STOP_DRAIN,
178179
permission: 'update',
179180
icon: Icons.exit,
180181
click: () => this.hostDrain(true),
181-
disable: (selection: CdTableSelection) =>
182-
this.getDisable('drain', selection) || this.enableDrainBtn,
183-
visible: () => !this.showGeneralActionsOnly && !this.enableDrainBtn
182+
visible: () => !this.showGeneralActionsOnly && this.draining
184183
},
185184
{
186185
name: this.actionLabels.REMOVE,
@@ -212,9 +211,6 @@ export class HostsComponent extends ListWithDetails implements OnDestroy, OnInit
212211
visible: () => !this.showGeneralActionsOnly && this.enableMaintenanceBtn
213212
}
214213
];
215-
}
216-
217-
ngOnInit() {
218214
this.columns = [
219215
{
220216
name: $localize`Hostname`,
@@ -305,15 +301,14 @@ export class HostsComponent extends ListWithDetails implements OnDestroy, OnInit
305301
updateSelection(selection: CdTableSelection) {
306302
this.selection = selection;
307303
this.enableMaintenanceBtn = false;
308-
this.enableDrainBtn = false;
309304
if (this.selection.hasSelection) {
310305
if (this.selection.first().status === 'maintenance') {
311306
this.enableMaintenanceBtn = true;
312307
}
313308

314-
if (!this.selection.first().labels.includes('_no_schedule')) {
315-
this.enableDrainBtn = true;
316-
}
309+
this.selection.first().labels.includes('_no_schedule')
310+
? (this.draining = true)
311+
: (this.draining = false);
317312
}
318313
}
319314

0 commit comments

Comments
 (0)