diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.html index 7287beefcf2..ea2bd668fba 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.html @@ -31,7 +31,7 @@ - N/A @@ -41,7 +41,7 @@ - N/A diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts index 89b70071814..02cf636ac89 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts @@ -95,18 +95,20 @@ describe('RbdListComponent', () => { }); describe('handling of provisioned columns', () => { + let rbdServiceListSpy: jasmine.Spy; + const images = [ { name: 'img1', pool_name: 'rbd', - features: ['layering', 'exclusive-lock'], + features_name: ['layering', 'exclusive-lock'], disk_usage: null, total_disk_usage: null }, { name: 'img2', pool_name: 'rbd', - features: ['layering', 'exclusive-lock', 'object-map', 'fast-diff'], + features_name: ['layering', 'exclusive-lock', 'object-map', 'fast-diff'], disk_usage: 1024, total_disk_usage: 1024 } @@ -115,19 +117,30 @@ describe('RbdListComponent', () => { beforeEach(() => { component.images = images; refresh({ executing_tasks: [], finished_tasks: [] }); - spyOn(rbdService, 'list').and.callFake(() => - of([{ pool_name: 'rbd', status: 1, value: images }]) - ); - fixture.detectChanges(); + rbdServiceListSpy = spyOn(rbdService, 'list'); }); it('should display N/A for Provisioned & Total Provisioned columns if disk usage is null', () => { - const spans = fixture.debugElement.nativeElement.querySelectorAll( + rbdServiceListSpy.and.callFake(() => of([{ pool_name: 'rbd', status: 1, value: images }])); + fixture.detectChanges(); + const spanWithoutFastDiff = fixture.debugElement.nativeElement.querySelectorAll( '.datatable-body-cell-label span' ); - // check image with disk usage = null - expect(spans[6].textContent).toBe('N/A'); - expect(spans[7].textContent).toBe('N/A'); + // check image with disk usage = null & fast-diff disabled + expect(spanWithoutFastDiff[6].textContent).toBe('N/A'); + + images[0]['features_name'] = ['layering', 'exclusive-lock', 'object-map', 'fast-diff']; + component.images = images; + refresh({ executing_tasks: [], finished_tasks: [] }); + + rbdServiceListSpy.and.callFake(() => of([{ pool_name: 'rbd', status: 1, value: images }])); + fixture.detectChanges(); + + const spanWithFastDiff = fixture.debugElement.nativeElement.querySelectorAll( + '.datatable-body-cell-label span' + ); + // check image with disk usage = null & fast-diff changed to enabled + expect(spanWithFastDiff[6].textContent).toBe('-'); }); });