Skip to content

Commit 4689c3d

Browse files
committed
mgr/dashboard: fs snapshots e2e
Fixes: https://tracker.ceph.com/issues/63237 Signed-off-by: Nizamudeen A <[email protected]>
1 parent b35be54 commit 4689c3d

File tree

7 files changed

+107
-31
lines changed

7 files changed

+107
-31
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ Then('I should not see a row with {string}', (row: string) => {
5454
);
5555
});
5656

57+
Then('I should see a table in the expanded row', () => {
58+
cy.get('.datatable-row-detail').within(() => {
59+
cy.get('cd-table').should('exist');
60+
cy.get('datatable-scroller, .empty-row');
61+
});
62+
});
63+
5764
Then('I should not see a row with {string} in the expanded row', (row: string) => {
5865
cy.get('.datatable-row-detail').within(() => {
5966
cy.get('cd-table .search input').first().clear().type(row);
@@ -133,3 +140,9 @@ And('I should see row {string} have {string} on this tab', (row: string, options
133140
});
134141
}
135142
});
143+
144+
Then('I should see an alert {string} in the expanded row', (alert: string) => {
145+
cy.get('.datatable-row-detail').within(() => {
146+
cy.get('.alert-panel-text').contains(alert);
147+
});
148+
});
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Feature: CephFS Snapshot Management
2+
3+
Goal: To test out the CephFS snapshot management features
4+
5+
Background: Login
6+
Given I am logged in
7+
8+
Scenario: Create a CephFS Volume
9+
Given I am on the "cephfs" page
10+
And I click on "Create" button
11+
And enter "name" "test_cephfs"
12+
And I click on "Create File System" button
13+
Then I should see a row with "test_cephfs"
14+
15+
Scenario: Snapshots tab without a subvolume
16+
Given I am on the "cephfs" page
17+
When I expand the row "test_cephfs"
18+
And I go to the "Snapshots" tab
19+
Then I should see an alert "No subvolumes are present" in the expanded row
20+
21+
Scenario: Create a CephFS Subvolume
22+
Given I am on the "cephfs" page
23+
When I expand the row "test_cephfs"
24+
And I go to the "Subvolumes" tab
25+
And I click on "Create" button from the expanded row
26+
And enter "subvolumeName" "test_subvolume" in the modal
27+
And I click on "Create Subvolume" button
28+
Then I should see a row with "test_subvolume" in the expanded row
29+
30+
Scenario: Show the CephFS Snapshots view
31+
Given I am on the "cephfs" page
32+
When I expand the row "test_cephfs"
33+
And I go to the "Snapshots" tab
34+
Then I should see a table in the expanded row
35+
36+
Scenario: Remove a CephFS Subvolume
37+
Given I am on the "cephfs" page
38+
When I expand the row "test_cephfs"
39+
And I go to the "Subvolumes" tab
40+
When I select a row "test_subvolume" in the expanded row
41+
And I click on "Remove" button from the table actions in the expanded row
42+
And I check the tick box in modal
43+
And I click on "Remove Subvolume" button
44+
Then I should not see a row with "test_subvolume" in the expanded row
45+
46+
Scenario: Remove CephFS Volume
47+
Given I am on the "cephfs" page
48+
And I select a row "test_cephfs"
49+
And I click on "Remove" button from the table actions
50+
Then I should see the modal
51+
And I check the tick box in modal
52+
And I click on "Remove File System" button
53+
Then I should not see a row with "test_cephfs"

src/pybind/mgr/dashboard/frontend/cypress/e2e/filesystems/subvolume-groups.e2e-spec.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Feature: CephFS Subvolume Group management
2121
And I click on "Create Subvolume group" button
2222
Then I should see a row with "test_subvolume_group" in the expanded row
2323

24-
Scenario: Edit a CephFS Subvolume
24+
Scenario: Edit a CephFS Subvolume Group
2525
Given I am on the "cephfs" page
2626
When I expand the row "test_cephfs"
2727
And I go to the "Subvolume groups" tab
@@ -31,7 +31,7 @@ Feature: CephFS Subvolume Group management
3131
And I click on "Edit Subvolume group" button
3232
Then I should see row "test_subvolume_group" of the expanded row to have a usage bar
3333

34-
Scenario: Remove a CephFS Subvolume
34+
Scenario: Remove a CephFS Subvolume Group
3535
Given I am on the "cephfs" page
3636
When I expand the row "test_cephfs"
3737
And I go to the "Subvolume groups" tab

src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-subvolume-group/cephfs-subvolume-group.component.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core';
2-
import { Observable, ReplaySubject, of } from 'rxjs';
1+
import { Component, Input, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core';
2+
import { BehaviorSubject, Observable, of } from 'rxjs';
33
import { catchError, shareReplay, switchMap } from 'rxjs/operators';
44

55
import { CephfsSubvolumeGroupService } from '~/app/shared/api/cephfs-subvolume-group.service';
@@ -52,7 +52,7 @@ export class CephfsSubvolumeGroupComponent implements OnInit, OnChanges {
5252
permissions: Permissions;
5353

5454
subvolumeGroup$: Observable<CephfsSubvolumeGroup[]>;
55-
subject = new ReplaySubject<CephfsSubvolumeGroup[]>();
55+
subject = new BehaviorSubject<CephfsSubvolumeGroup[]>([]);
5656

5757
constructor(
5858
private cephfsSubvolumeGroup: CephfsSubvolumeGroupService,
@@ -138,11 +138,13 @@ export class CephfsSubvolumeGroupComponent implements OnInit, OnChanges {
138138
}
139139

140140
fetchData() {
141-
this.subject.next();
141+
this.subject.next([]);
142142
}
143143

144-
ngOnChanges() {
145-
this.subject.next();
144+
ngOnChanges(changes: SimpleChanges) {
145+
if (changes.fsName) {
146+
this.subject.next([]);
147+
}
146148
}
147149

148150
updateSelection(selection: CdTableSelection) {

src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-subvolume-list/cephfs-subvolume-list.component.ts

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
2-
import { Observable, ReplaySubject, of } from 'rxjs';
3-
import { catchError, shareReplay, switchMap, tap } from 'rxjs/operators';
1+
import {
2+
Component,
3+
Input,
4+
OnChanges,
5+
OnInit,
6+
SimpleChanges,
7+
TemplateRef,
8+
ViewChild
9+
} from '@angular/core';
10+
import { BehaviorSubject, Observable, of } from 'rxjs';
11+
import { catchError, switchMap, tap } from 'rxjs/operators';
412
import { CephfsSubvolumeService } from '~/app/shared/api/cephfs-subvolume.service';
513
import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
614
import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
@@ -64,10 +72,11 @@ export class CephfsSubvolumeListComponent extends CdForm implements OnInit, OnCh
6472

6573
subVolumes$: Observable<CephfsSubvolume[]>;
6674
subVolumeGroups$: Observable<CephfsSubvolumeGroup[]>;
67-
subject = new ReplaySubject<CephfsSubvolume[]>();
68-
groupsSubject = new ReplaySubject<CephfsSubvolume[]>();
75+
subject = new BehaviorSubject<CephfsSubvolume[]>([]);
76+
groupsSubject = new BehaviorSubject<CephfsSubvolume[]>([]);
6977

7078
subvolumeGroupList: string[] = [];
79+
subVolumesList: CephfsSubvolume[] = [];
7180

7281
activeGroupName: string = '';
7382

@@ -148,8 +157,6 @@ export class CephfsSubvolumeListComponent extends CdForm implements OnInit, OnCh
148157
}
149158
];
150159

151-
this.getSubVolumes();
152-
153160
this.subVolumeGroups$ = this.groupsSubject.pipe(
154161
switchMap(() =>
155162
this.cephfsSubvolumeGroupService.get(this.fsName, false).pipe(
@@ -167,12 +174,14 @@ export class CephfsSubvolumeListComponent extends CdForm implements OnInit, OnCh
167174
}
168175

169176
fetchData() {
170-
this.subject.next();
177+
this.subject.next([]);
171178
}
172179

173-
ngOnChanges() {
174-
this.subject.next();
175-
this.groupsSubject.next();
180+
ngOnChanges(changes: SimpleChanges) {
181+
if (changes.fsName) {
182+
this.subject.next([]);
183+
this.groupsSubject.next([]);
184+
}
176185
}
177186

178187
updateSelection(selection: CdTableSelection) {
@@ -228,20 +237,19 @@ export class CephfsSubvolumeListComponent extends CdForm implements OnInit, OnCh
228237

229238
selectSubVolumeGroup(subVolumeGroupName: string) {
230239
this.activeGroupName = subVolumeGroupName;
231-
this.getSubVolumes(subVolumeGroupName);
240+
this.getSubVolumes();
232241
}
233242

234-
getSubVolumes(subVolumeGroupName = '') {
243+
getSubVolumes() {
235244
this.subVolumes$ = this.subject.pipe(
236245
switchMap(() =>
237-
this.cephfsSubVolumeService.get(this.fsName, subVolumeGroupName).pipe(
246+
this.cephfsSubVolumeService.get(this.fsName, this.activeGroupName).pipe(
238247
catchError(() => {
239248
this.context.error();
240249
return of(null);
241250
})
242251
)
243-
),
244-
shareReplay(1)
252+
)
245253
);
246254
}
247255
}

src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-subvolume-snapshots-list/cephfs-subvolume-snapshots-list.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2-
import { Observable, ReplaySubject, forkJoin, of } from 'rxjs';
2+
import { BehaviorSubject, Observable, forkJoin, of } from 'rxjs';
33
import { catchError, shareReplay, switchMap, tap } from 'rxjs/operators';
44
import { CephfsSubvolumeGroupService } from '~/app/shared/api/cephfs-subvolume-group.service';
55
import { CephfsSubvolumeService } from '~/app/shared/api/cephfs-subvolume.service';
@@ -21,8 +21,8 @@ export class CephfsSubvolumeSnapshotsListComponent implements OnInit, OnChanges
2121

2222
subVolumes$: Observable<CephfsSubvolume[]>;
2323
snapshots$: Observable<any[]>;
24-
snapshotSubject = new ReplaySubject<SubvolumeSnapshot[]>();
25-
subVolumeSubject = new ReplaySubject<CephfsSubvolume[]>();
24+
snapshotSubject = new BehaviorSubject<SubvolumeSnapshot[]>([]);
25+
subVolumeSubject = new BehaviorSubject<CephfsSubvolume[]>([]);
2626

2727
subvolumeGroupList: string[] = [];
2828
subVolumesList: string[];
@@ -71,7 +71,7 @@ export class CephfsSubvolumeSnapshotsListComponent implements OnInit, OnChanges
7171
.get(this.fsName)
7272
.pipe(
7373
switchMap((groups) => {
74-
// manually adding the group 'default' to the list.
74+
// manually adding the group '_nogroup' to the list.
7575
groups.unshift({ name: '' });
7676

7777
const observables = groups.map((group) =>
@@ -98,7 +98,7 @@ export class CephfsSubvolumeSnapshotsListComponent implements OnInit, OnChanges
9898

9999
ngOnChanges(changes: SimpleChanges): void {
100100
if (changes.fsName) {
101-
this.subVolumeSubject.next();
101+
this.subVolumeSubject.next([]);
102102
}
103103
}
104104

@@ -143,6 +143,6 @@ export class CephfsSubvolumeSnapshotsListComponent implements OnInit, OnChanges
143143
}
144144

145145
fetchData() {
146-
this.snapshotSubject.next();
146+
this.snapshotSubject.next([]);
147147
}
148148
}

src/pybind/mgr/dashboard/frontend/src/app/shared/components/vertical-navigation/vertical-navigation.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<a class="nav-link"
1414
[class.active]="!activeItem"
1515
(click)="selectItem()"
16-
*ngIf="item === ''">Default</a>
16+
*ngIf="item === ''">_nogroup</a>
1717
<a class="nav-link text-decoration-none text-break"
1818
[class.active]="item === activeItem"
1919
(click)="selectItem(item)"

0 commit comments

Comments
 (0)