Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release(hpc): vcd and veeam bugfixes #14317

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IamCheckResponse } from '@ovh-ux/manager-react-components';
import { datacentreList } from '../vcd-organization/vcd-datacentre.mock';
import { organizationList } from '../vcd-organization/vcd-organization.mock';
import { iamActions } from '@/utils/iam.constants';

Expand All @@ -19,4 +20,11 @@ export const resourceList: IamCheckResponse[] = [
],
unauthorizedActions: [],
},
{
urn: datacentreList[0].iam.urn,
authorizedActions: [
iamActions.vmwareCloudDirectorApiovhOrganizationVirtualDataCenterEdit,
],
unauthorizedActions: [],
},
];
2 changes: 2 additions & 0 deletions packages/manager/apps/hpc-vmware-managed-vcd/mocks/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export * from './iam/iam.handler';
export * from './vcd-organization/vcd-organization.handler';
export * from './vcd-organization/vcd-datacentre.handler';
export * from './vcd-organization/vcd-datacentre-order.handler';
export * from './veeam-backup/veeam-backup.handler';
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
import { TVcdCatalog } from '../../src/types/vcd-catalog.interface';

export const catalogProductList: TVcdCatalog = [
{
productName: 'pack-3264',
mandatory: false,
exclusive: false,
family: 'host_order',
productType: 'cloud_service',
planCode: 'pack-3264',
prices: [
{
priceInUcents: 0,
pricingType: 'rental',
maximumRepeat: 1,
price: { currencyCode: 'EUR', text: '0.00 €', value: 0 },
minimumRepeat: 1,
capacities: ['installation'],
duration: 'P0D',
maximumQuantity: null,
interval: 0,
description: 'Installation pricing',
pricingMode: 'default',
minimumQuantity: 1,
},
{
pricingMode: 'default',
minimumQuantity: 1,
description: 'Installation pricing',
interval: 1,
maximumQuantity: null,
duration: 'P1M',
capacities: ['renew'],
minimumRepeat: 1,
price: { value: 80, text: '80.00 €', currencyCode: 'EUR' },
maximumRepeat: null,
pricingType: 'rental',
priceInUcents: 8_000_000_000,
},
],
},
{
productName: 'pack-1664',
mandatory: false,
exclusive: false,
family: 'host_order',
productType: 'cloud_service',
planCode: 'pack-1664',
prices: [
{
capacities: ['installation'],
minimumRepeat: 1,
duration: 'P0D',
pricingType: 'rental',
priceInUcents: 0,
price: { text: '0.00 €', currencyCode: 'EUR', value: 0 },
maximumRepeat: 1,
description: 'Installation pricing',
minimumQuantity: 1,
pricingMode: 'default',
maximumQuantity: null,
interval: 0,
},
{
pricingMode: 'default',
minimumQuantity: 1,
description: 'Installation pricing',
maximumQuantity: null,
interval: 1,
duration: 'P1M',
capacities: ['renew'],
minimumRepeat: 1,
pricingType: 'rental',
priceInUcents: 8_000_000_000,
price: { text: '80.00 €', currencyCode: 'EUR', value: 80 },
maximumRepeat: null,
},
],
},
{
productType: 'cloud_service',
planCode: 'pack-16128',
prices: [
{
maximumQuantity: null,
interval: 0,
minimumQuantity: 1,
pricingMode: 'default',
description: 'Installation pricing',
priceInUcents: 0,
pricingType: 'rental',
maximumRepeat: 1,
price: { value: 0, text: '0.00 €', currencyCode: 'EUR' },
duration: 'P0D',
minimumRepeat: 1,
capacities: ['installation'],
},
{
minimumQuantity: 1,
pricingMode: 'default',
description: 'Installation pricing',
interval: 1,
maximumQuantity: null,
duration: 'P1M',
minimumRepeat: 1,
capacities: ['renew'],
maximumRepeat: null,
price: { value: 80, currencyCode: 'EUR', text: '80.00 €' },
priceInUcents: 8_000_000_000,
pricingType: 'rental',
},
],
productName: 'pack-16128',
mandatory: false,
family: 'host_order',
exclusive: false,
},
{
prices: [
{
maximumQuantity: null,
interval: 0,
description: 'Installation pricing',
minimumQuantity: 1,
pricingMode: 'default',
pricingType: 'rental',
priceInUcents: 0,
price: { value: 0, currencyCode: 'EUR', text: '0.00 €' },
maximumRepeat: 1,
capacities: ['installation'],
minimumRepeat: 1,
duration: 'P0D',
},
{
minimumRepeat: 1,
capacities: ['renew'],
duration: 'P1M',
priceInUcents: 8_000_000_000,
pricingType: 'rental',
maximumRepeat: null,
price: { value: 80, currencyCode: 'EUR', text: '80.00 €' },
description: 'Installation pricing',
pricingMode: 'default',
minimumQuantity: 1,
maximumQuantity: null,
interval: 1,
},
],
planCode: 'vcd-datastore-1000',
productType: 'cloud_service',
family: 'storage_order',
exclusive: false,
mandatory: false,
productName: 'vcd-datastore-1000',
},
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { IVdcOrderableResourceData } from '@/types/vcd-vdc-orderable-resource.interface';
import { Handler } from '../../../../../../playwright-helpers';
import { catalogProductList } from './vcd-catalog.mock';
import { orderableResourceData } from './vdc-orderable-resource.mock';

export type GetDatacentreOrderMocksParams = {
isCatalogKO?: boolean;
nbCatalogProduct?: number;
isOrderableResourceKO?: boolean;
nbOrderableResource?: number;
};

export const getDatacentreOrderMocks = ({
isCatalogKO,
nbCatalogProduct = Number.POSITIVE_INFINITY,
isOrderableResourceKO,
nbOrderableResource = Number.POSITIVE_INFINITY,
}: GetDatacentreOrderMocksParams): Handler[] => {
const selectedOrderableResource: IVdcOrderableResourceData = {
compute: orderableResourceData.compute.slice(0, nbOrderableResource),
storage: orderableResourceData.storage.slice(0, nbOrderableResource),
};

return [
{
url:
'/vmwareCloudDirector/organization/:id/virtualDataCenter/:id/orderableResource',
response: isOrderableResourceKO
? { message: 'OrderableResource error' }
: selectedOrderableResource,
api: 'v2',
status: isOrderableResourceKO ? 500 : 200,
},
{
url: '/order/cartServiceOption/vmwareCloudDirector/:id',
response: isCatalogKO
? { message: 'Catalog error' }
: catalogProductList.slice(0, nbCatalogProduct),
api: 'v6',
status: isCatalogKO ? 500 : 200,
},
];
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { PathParams } from 'msw';
import { Handler } from '../../../../../../playwright-helpers';
import { datacentreList } from './vcd-datacentre.mock';
import { computeList } from './vdc-compute.mock';
import { storageList } from './vdc-storage.mock';

export type GetDatacentresMocksParams = {
isDatacentresKo?: boolean;
isDatacentreUpdateKo?: boolean;
nbDatacentres?: number;
isComputeKO?: boolean;
nbCompute?: number;
isStorageKO?: boolean;
nbStorage?: number;
};

const findDatacentreById = (params: PathParams) =>
datacentreList.find(({ id }) => id === params.id);

export const getDatacentresMocks = ({
isDatacentresKo,
isDatacentreUpdateKo,
nbDatacentres = Number.POSITIVE_INFINITY,
isComputeKO,
nbCompute = Number.POSITIVE_INFINITY,
isStorageKO,
nbStorage = Number.POSITIVE_INFINITY,
}: GetDatacentresMocksParams): Handler[] => [
{
url: '/vmwareCloudDirector/organization/:id/virtualDataCenter/:id/storage',
response: isStorageKO
? { message: 'Storage error' }
: storageList.slice(0, nbStorage),
api: 'v2',
status: isStorageKO ? 500 : 200,
},
{
url: '/vmwareCloudDirector/organization/:id/virtualDataCenter/:id/compute',
response: isComputeKO
? { message: 'Compute error' }
: computeList.slice(0, nbCompute),
api: 'v2',
status: isComputeKO ? 500 : 200,
},
{
url: '/vmwareCloudDirector/organization/:id/virtualDataCenter',
response: isDatacentresKo
? { message: 'Datacentres error' }
: datacentreList.slice(0, nbDatacentres),
api: 'v2',
status: isDatacentresKo ? 500 : 200,
},
{
url: '/vmwareCloudDirector/organization/:id/virtualDataCenter/:id',
response: (_: unknown, params: PathParams) =>
isDatacentresKo
? { message: 'Datacentre error' }
: findDatacentreById(params),
api: 'v2',
status: isDatacentresKo ? 500 : 200,
},
{
url: '/vmwareCloudDirector/organization/:id/virtualDataCenter/:id',
response: isDatacentreUpdateKo
? { message: 'Datacentre update error' }
: {},
method: 'put',
api: 'v2',
status: isDatacentreUpdateKo ? 500 : 200,
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ export const datacentreList: IVcdDatacentre[] = [
resourceStatus: 'READY',
currentState: {
commercialRange: 'STANDARD',
description:
'Pour vous proposer une description adaptée, pourriez-vous me donner plus de détails sur votre service ? Cela me permettra de créer une description précise et impactante qui tient dans la limite des 255 caractères.',
description: 'VDC Description',
ipQuota: 10,
memoryQuota: 64,
name: 'vdc-eu-central-waw-adc311b5-0c0b-4071-b48f-b20813868bcf',
Expand All @@ -18,8 +17,7 @@ export const datacentreList: IVcdDatacentre[] = [
},
currentTasks: [],
targetSpec: {
description:
'Pour vous proposer une description adaptée, pourriez-vous me donner plus de détails sur votre service ? Cela me permettra de créer une description précise et impactante qui tient dans la limite des 255 caractères.',
description: 'VDC Description targetSpec',
vCPUSpeed: 3,
},
updatedAt: '2024-09-23T13:53:49Z',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { PathParams } from 'msw';
import { Handler } from '../../../../../../playwright-helpers';
import { organizationList } from './vcd-organization.mock';
import { datacentreList } from './vcd-datacentre.mock';

export type GetOrganizationMocksParams = {
isOrganizationKo?: boolean;
isOrganizationUpdateKo?: boolean;
isOrganizationResetPasswordKo?: boolean;
nbOrganization?: number;
allOrgsBackedUp?: boolean;
isDatacentresKo?: boolean;
nbDatacentres?: number;
};

const findOrganizationById = (params: PathParams) =>
Expand All @@ -18,51 +16,43 @@ const findOrganizationById = (params: PathParams) =>
export const getOrganizationMocks = ({
isOrganizationKo,
isOrganizationUpdateKo,
isOrganizationResetPasswordKo,
nbOrganization = Number.POSITIVE_INFINITY,
allOrgsBackedUp,
isDatacentresKo,
nbDatacentres = Number.POSITIVE_INFINITY,
}: GetOrganizationMocksParams): Handler[] => {
const nb = allOrgsBackedUp ? 1 : nbOrganization;
return [
{
url: '/vmwareCloudDirector/organization/:id/virtualDataCenter',
response: isDatacentresKo
? {
message: 'Datacentres error',
}
: datacentreList.slice(0, nbDatacentres),
api: 'v2',
status: isDatacentresKo ? 500 : 200,
},
{
url: '/vmwareCloudDirector/organization/:id',
response: isOrganizationUpdateKo
? {
message: 'Organization update error',
}
? { message: 'Organization update error' }
: {},
method: 'put',
api: 'v2',
status: isOrganizationUpdateKo ? 500 : 200,
},
{
url: '/vmwareCloudDirector/organization/:id/password',
response: isOrganizationResetPasswordKo
? { message: 'Organization reset password error' }
: {},
method: 'post',
api: 'v2',
status: isOrganizationResetPasswordKo ? 500 : 200,
},
{
url: '/vmwareCloudDirector/organization/:id',
response: (_: unknown, params: PathParams) =>
isOrganizationKo
? {
message: 'Organization error',
}
? { message: 'Organization error' }
: findOrganizationById(params),
api: 'v2',
status: isOrganizationKo ? 500 : 200,
},
{
url: '/vmwareCloudDirector/organization',
response: isOrganizationKo
? {
message: 'Organization error',
}
? { message: 'Organization error' }
: organizationList.slice(0, nb),
status: isOrganizationKo ? 500 : 200,
api: 'v2',
Expand Down
Loading
Loading