Skip to content

Commit 400921a

Browse files
committed
test(observability): update tests to manage new type tenant state
fixes: #MAOBS-120 Signed-off-by: David Arsène <david.arsene.ext@ovhcloud.com>
1 parent d683a29 commit 400921a

File tree

7 files changed

+23
-27
lines changed

7 files changed

+23
-27
lines changed

packages/manager/apps/observability/src/__mocks__/infrastructures/infrastructures.mock.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const infrastructures: Infrastructure[] = [
88
location: 'eu-west-sbg',
99
type: 'SHARED',
1010
usage: 'METRICS',
11+
entryPoint: 'eee.metrics.ovh.com',
1112
},
1213
},
1314
{
@@ -16,6 +17,7 @@ const infrastructures: Infrastructure[] = [
1617
location: 'eu-west-gra',
1718
type: 'SHARED',
1819
usage: 'METRICS',
20+
entryPoint: 'aaa.metrics.ovh.com',
1921
},
2022
},
2123
{
@@ -24,6 +26,7 @@ const infrastructures: Infrastructure[] = [
2426
location: 'ca-east-bhs',
2527
type: 'SHARED',
2628
usage: 'METRICS',
29+
entryPoint: 'bbb.metrics.ovh.com',
2730
},
2831
},
2932
{
@@ -32,6 +35,7 @@ const infrastructures: Infrastructure[] = [
3235
location: 'us-east-vin',
3336
type: 'SHARED',
3437
usage: 'METRICS',
38+
entryPoint: 'ccc.metrics.ovh.com',
3539
},
3640
},
3741
{
@@ -40,6 +44,7 @@ const infrastructures: Infrastructure[] = [
4044
location: 'ap-southeast-sgp',
4145
type: 'SHARED',
4246
usage: 'METRICS',
47+
entryPoint: 'ddd.metrics.ovh.com',
4348
},
4449
},
4550
];

packages/manager/apps/observability/src/__mocks__/tenants/tenant.mock.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,24 +110,5 @@ export const createTenant = async function ({
110110
}: CreateTenantsPayload): Promise<Tenant> {
111111
console.info(`[MOCK-ADAPTER][createTenant] mock creation of tenant for ${resourceName}`);
112112
console.info(`[MOCK-ADAPTER][createTenant] targetSpec -> `, targetSpec);
113-
return Promise.resolve({
114-
id: '1',
115-
currentState: {
116-
title: 'Tenant 1',
117-
},
118-
targetSpec: {
119-
...targetSpec,
120-
limits: {
121-
...targetSpec.limits,
122-
numberOfSeries: {
123-
...targetSpec.limits.numberOfSeries,
124-
current: targetSpec.limits.numberOfSeries.maximum,
125-
},
126-
retention: {
127-
...targetSpec.limits.retention,
128-
duration: '30d', // Add required duration property
129-
},
130-
},
131-
},
132-
});
113+
return Promise.resolve(tenantsDataset[0]!);
133114
};

packages/manager/apps/observability/src/__tests__/components/infrastructures/region-selector/RegionSelector.component.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ const createMockInfrastructure = (
197197
type: 'LOCAL-ZONE' | 'REGION-1-AZ' | 'REGION-3-AZ' = 'LOCAL-ZONE',
198198
): Infrastructure => ({
199199
id,
200-
currentState: { location, type: 'SHARED', usage: 'METRICS' },
200+
currentState: { location, type: 'SHARED', usage: 'METRICS', entryPoint: `xxx.metrics.ovh.com` },
201201
locationDetails: {
202202
location,
203203
geographyCode,

packages/manager/apps/observability/src/__tests__/data/hooks/infrastructures/useInfrastructures.hook.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const mockInfrastructures: Infrastructure[] = [
5757
location: 'eu-west-sbg',
5858
type: 'SHARED',
5959
usage: 'METRICS',
60+
entryPoint: 'eee.metrics.ovh.com',
6061
},
6162
},
6263
{
@@ -65,6 +66,7 @@ const mockInfrastructures: Infrastructure[] = [
6566
location: 'eu-west-gra',
6667
type: 'DEDICATED',
6768
usage: 'LOGS',
69+
entryPoint: 'aaa.metrics.ovh.com',
6870
},
6971
},
7072
];

packages/manager/apps/observability/src/__tests__/data/hooks/tenants/useCreateTenants.hook.spec.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ describe('useCreateTenants', () => {
7878
duration: '30d',
7979
},
8080
},
81-
infrastructure: {
82-
id: 'infra-1',
83-
},
8481
},
8582
};
8683

packages/manager/apps/observability/src/__tests__/utils/infrastructures.utils.spec.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,23 @@ const createMockInfrastructure = (
2525
type: RegionType,
2626
): Infrastructure => ({
2727
id,
28-
currentState: { location, type: 'SHARED', usage: 'METRICS' },
28+
currentState: {
29+
location,
30+
type: 'SHARED',
31+
usage: 'METRICS',
32+
entryPoint: `xxx.metrics.ovh.com`,
33+
},
2934
locationDetails: createMockLocationDetails(geographyCode, location, name, type),
3035
});
3136

3237
const createMockInfrastructureWithoutLocation = (id: string, location: string): Infrastructure => ({
3338
id,
34-
currentState: { location, type: 'SHARED', usage: 'METRICS' },
39+
currentState: {
40+
location,
41+
type: 'SHARED',
42+
usage: 'METRICS',
43+
entryPoint: `yyy.metrics.ovh.com`,
44+
},
3545
});
3646

3747
describe('groupByGeographicZone', () => {

packages/manager/apps/observability/src/data/api/tenants.props.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import { TenantState } from '@/types/tenants.type';
33

44
import { ObservabilityServiceParams } from './observability.props';
55

6-
export type TTargetSpecPayload = Omit<TenantState, 'limits'> & {
6+
export type TTargetSpecPayload = Omit<TenantState, 'limits' | 'infrastructure'> & {
77
limits: {
88
numberOfSeries: {
99
maximum: number;
1010
};
1111
retention: TIdentifier;
1212
};
13+
infrastructure?: TIdentifier;
1314
};
1415

1516
export type CreateTenantsPayload = {

0 commit comments

Comments
 (0)