From fba0097a8cb3ce97ac530e0136eab685b88b5223 Mon Sep 17 00:00:00 2001 From: Tiago Melo Date: Fri, 19 Oct 2018 16:56:21 +0100 Subject: [PATCH] mgr/dashboard: Fix HttpClient Module imports in unit tests Some of the tests were importing the wrong HttpClient Module and that was causing random errors. Fixes: https://tracker.ceph.com/issues/36528 Signed-off-by: Tiago Melo --- .../osd/osd-details/osd-details.component.spec.ts | 9 +++++++-- .../ceph/cluster/osd/osd-list/osd-list.component.spec.ts | 4 ++-- .../rgw-daemon-list/rgw-daemon-list.component.spec.ts | 4 ++-- .../rgw-user-details/rgw-user-details.component.spec.ts | 3 +-- .../shared/components/grafana/grafana.component.spec.ts | 5 ++--- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts index bbab68c0925..ecd5b5fd181 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts @@ -1,4 +1,4 @@ -import { HttpClientModule } from '@angular/common/http'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { DebugElement } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; @@ -22,7 +22,12 @@ describe('OsdDetailsComponent', () => { let getDetailsSpy; configureTestBed({ - imports: [HttpClientModule, TabsModule.forRoot(), PerformanceCounterModule, SharedModule], + imports: [ + HttpClientTestingModule, + TabsModule.forRoot(), + PerformanceCounterModule, + SharedModule + ], declarations: [OsdDetailsComponent, OsdPerformanceHistogramComponent] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts index f38575b0e9e..a8c293b97a9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts @@ -1,4 +1,4 @@ -import { HttpClientModule } from '@angular/common/http'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; @@ -27,7 +27,7 @@ describe('OsdListComponent', () => { configureTestBed({ imports: [ - HttpClientModule, + HttpClientTestingModule, PerformanceCounterModule, TabsModule.forRoot(), SharedModule, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts index 5f4422c6749..cc1b43c39d8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts @@ -1,4 +1,4 @@ -import { HttpClientModule } from '@angular/common/http'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; @@ -17,7 +17,7 @@ describe('RgwDaemonListComponent', () => { configureTestBed({ declarations: [RgwDaemonListComponent, RgwDaemonDetailsComponent], imports: [ - HttpClientModule, + HttpClientTestingModule, TabsModule.forRoot(), PerformanceCounterModule, SharedModule, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts index b2de9733fad..825b6920363 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts @@ -1,4 +1,3 @@ -import { HttpClientModule } from '@angular/common/http'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; @@ -16,7 +15,7 @@ describe('RgwUserDetailsComponent', () => { configureTestBed({ declarations: [RgwUserDetailsComponent], - imports: [HttpClientTestingModule, HttpClientModule, SharedModule, TabsModule.forRoot()], + imports: [HttpClientTestingModule, SharedModule, TabsModule.forRoot()], providers: [BsModalService] }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts index 6202d5425bf..1b000f238e8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts @@ -1,5 +1,4 @@ -import { HttpClientModule } from '@angular/common/http'; - +import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; @@ -19,7 +18,7 @@ describe('GrafanaComponent', () => { configureTestBed({ declarations: [GrafanaComponent, InfoPanelComponent, LoadingPanelComponent], - imports: [AlertModule.forRoot(), HttpClientModule, RouterTestingModule], + imports: [AlertModule.forRoot(), HttpClientTestingModule, RouterTestingModule], providers: [CephReleaseNamePipe, SettingsService, SummaryService] }); -- 2.39.5