Merge pull request #38720 from bk201/wip-48717

mgr/dashboard: fix Reads/Writes ratio of Clients IOPS donut chart

Reviewed-by: Avan Thakkar <athakkar@redhat.com>
Reviewed-by: Laura Paduano <lpaduano@suse.com>
Reviewed-by: Nizamudeen A <nia@redhat.com>
Reviewed-by: Volker Theile <vtheile@suse.com>
This commit is contained in:
Ernesto Puerta 2021-01-08 21:09:46 +01:00 committed by GitHub
commit ad5f10edba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -218,15 +218,16 @@ describe('HealthComponent', () => {
});
it('event binding "prepareReadWriteRatio" is called', () => {
const prepareReadWriteRatio = spyOn(component, 'prepareReadWriteRatio');
const prepareReadWriteRatio = spyOn(component, 'prepareReadWriteRatio').and.callThrough();
const payload = _.cloneDeep(healthPayload);
payload.client_perf['read_op_per_sec'] = 1;
payload.client_perf['write_op_per_sec'] = 1;
payload.client_perf['write_op_per_sec'] = 3;
getHealthSpy.and.returnValue(of(payload));
fixture.detectChanges();
expect(prepareReadWriteRatio).toHaveBeenCalled();
expect(prepareReadWriteRatio.calls.mostRecent().args[0].dataset[0].data).toEqual([25, 75]);
});
it('event binding "prepareRawUsage" is called', () => {

View File

@ -92,7 +92,7 @@ export class HealthComponent implements OnInit, OnDestroy {
this.healthData.client_perf.read_op_per_sec
)} ${$localize`/s`}`
);
ratioData.push(this.healthData.client_perf.read_op_per_sec);
ratioData.push(this.calcPercentage(this.healthData.client_perf.read_op_per_sec, total));
ratioLabels.push(
`${$localize`Writes`}: ${this.dimless.transform(
this.healthData.client_perf.write_op_per_sec