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

Improvement/artesca 13354 office 365 v8 support #771

Merged
Merged
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
3 changes: 2 additions & 1 deletion src/react/databrowser/buckets/details/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ function Overview({ bucket, ingestionStates }: Props) {
tags.status === 'success' && tags.value?.[BUCKET_TAG_VEEAM_APPLICATION];
const isVeeamBucket =
(veeamTagApplication === VeeamApplicationType.VEEAM_BACKUP_REPLICATION ||
veeamTagApplication === VeeamApplicationType.VEEAM_OFFICE_365) &&
veeamTagApplication === VeeamApplicationType.VEEAM_OFFICE_365 ||
veeamTagApplication === VeeamApplicationType.VEEAM_OFFICE_365_V8) &&
Comment on lines +242 to +243
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could be simplified [VeeamApplicationType.VEEAM_BACKUP_REPLICATION, VeeamApplicationType.VEEAM_OFFICE_365, VeeamApplicationType.VEEAM_OFFICE_365_V8].includes(veeamTagApplication). not necessary to do it now, just a dumb suggestion

VEEAM_FEATURE_FLAG_ENABLED;
useEffect(() => {
dispatch(getBucketInfo(bucket.name));
Expand Down
33 changes: 29 additions & 4 deletions src/react/ui-elements/Veeam/VeeamConfiguration.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ describe('Veeam Configuration UI', () => {
veeamApplicationSelect: () => screen.getByLabelText(/Veeam application/i),
veeamVBO: () =>
screen.getByRole('option', {
name: /Veeam Backup for Microsoft 365/i,
name: /Veeam Backup for Microsoft 365 \(pre-v8\)/i,
}),
veeamVBOV8: () =>
screen.getByRole('option', {
name: /Veeam Backup for Microsoft 365 \(v8\)/i,
}),
};

Expand Down Expand Up @@ -101,7 +105,7 @@ describe('Veeam Configuration UI', () => {
});
});

it('should hide immutable backup and Max Veeam Repository Capacity when Veeam Backup for Microsoft 365 is selected', async () => {
it('should hide immutable backup and Max Veeam Repository Capacity when Veeam Backup for Microsoft 365 pre-v8 is selected', async () => {
//Setup
mockUseAccountsImplementation();
renderVeeamConfigurationForm();
Expand Down Expand Up @@ -131,7 +135,7 @@ describe('Veeam Configuration UI', () => {
expect(screen.getByText(/Cancel/i)).toBeInTheDocument();
});

it('should disable immutable backup when Veeam Backup for Microsoft 365 is selected', async () => {
it('should disable immutable backup when Veeam Backup for Microsoft 365 pre-v8 is selected', async () => {
const SUT = jest.fn();
mockUseStepper.mockReturnValue({ next: SUT });
mockUseAccountsImplementation();
Expand All @@ -145,13 +149,34 @@ describe('Veeam Configuration UI', () => {

expect(SUT).toHaveBeenCalledWith({
accountName: 'Veeam',
application: 'Veeam Backup for Microsoft 365',
application: 'Veeam Backup for Microsoft 365 (pre-v8)',
bucketName: 'veeam-bucket',
capacityBytes: '4294967296',
enableImmutableBackup: false,
});
});

it('should show immutable backup but hide Max Veeam Repository Capacity when Veeam Backup for Microsoft 365 v8 is selected', async () => {
const SUT = jest.fn();
mockUseStepper.mockReturnValue({ next: SUT });
mockUseAccountsImplementation();
renderVeeamConfigurationForm();

await selectClick(selectors.veeamApplicationSelect());
await userEvent.click(selectors.veeamVBOV8());
await userEvent.type(selectors.accountNameInput(), 'Veeam');
await userEvent.type(selectors.repositoryInput(), 'veeam-bucket');
await userEvent.click(selectors.continueButton());

expect(SUT).toHaveBeenCalledWith({
accountName: 'Veeam',
application: 'Veeam Backup for Microsoft 365 (v8)',
bucketName: 'veeam-bucket',
capacityBytes: '4294967296',
enableImmutableBackup: true,
});
});

it('should display error in case of account name already exists', async () => {
//S
mockUseAccountsImplementation();
Expand Down
13 changes: 11 additions & 2 deletions src/react/ui-elements/Veeam/VeeamConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
VEEAM_BACKUP_REPLICATION_XML_VALUE,
VEEAM_DEFAULT_ACCOUNT_NAME,
VEEAM_OFFICE_365,
VEEAM_OFFICE_365_V8,
unitChoices,
} from './VeeamConstants';
import { VeeamSkipModal } from './VeeamSkipModal';
Expand Down Expand Up @@ -187,7 +188,8 @@ const Configuration = () => {
application,
capacityBytes: getCapacityBytes(capacity, capacityUnit),
enableImmutableBackup:
application === VEEAM_BACKUP_REPLICATION_XML_VALUE
application === VEEAM_BACKUP_REPLICATION_XML_VALUE ||
application === VEEAM_OFFICE_365_V8
? enableImmutableBackup
: false,
accountName,
Expand Down Expand Up @@ -298,6 +300,12 @@ const Configuration = () => {
>
{VEEAM_OFFICE_365}
</Select.Option>
<Select.Option
key={VEEAM_OFFICE_365_V8}
value={VEEAM_OFFICE_365_V8}
>
{VEEAM_OFFICE_365_V8}
</Select.Option>
</Select>
);
}}
Expand All @@ -321,7 +329,8 @@ const Configuration = () => {
/>
}
/>
{application === VEEAM_BACKUP_REPLICATION_XML_VALUE ? (
{application === VEEAM_BACKUP_REPLICATION_XML_VALUE ||
application === VEEAM_OFFICE_365_V8 ? (
<FormGroup
id="enableImmutableBackup"
label="Immutable backup"
Expand Down
6 changes: 4 additions & 2 deletions src/react/ui-elements/Veeam/VeeamConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ export const BUCKET_TAG_VEEAM_APPLICATION = 'X-Scality-Veeam-Application';
export const VEEAM_BACKUP_REPLICATION = 'Veeam Backup & Replication';
export const VEEAM_BACKUP_REPLICATION_XML_VALUE =
'Veeam Backup &#38; Replication';
export const VEEAM_OFFICE_365 = 'Veeam Backup for Microsoft 365';
export const VEEAM_OFFICE_365 = 'Veeam Backup for Microsoft 365 (pre-v8)';
export const VEEAM_OFFICE_365_V8 = 'Veeam Backup for Microsoft 365 (v8)';
export const VEEAM_IMMUTABLE_POLICY_NAME = 'Scality-Veeam-Immutable-Policy';
export const GET_VEEAM_IMMUTABLE_POLICY = (bucketName: string) =>
JSON.stringify({
Expand Down Expand Up @@ -46,7 +47,8 @@ export const GET_CAPACITY_XML_CONTENT = (capacity: string) =>
export const VEEAM_DEFAULT_ACCOUNT_NAME = 'Veeam';
export enum VeeamApplicationType {
VEEAM_BACKUP_REPLICATION = 'Veeam Backup & Replication',
VEEAM_OFFICE_365 = 'Veeam Backup for Microsoft 365',
VEEAM_OFFICE_365 = 'Veeam Backup for Microsoft 365 (pre-v8)',
VEEAM_OFFICE_365_V8 = 'Veeam Backup for Microsoft 365 (v8)',
}
export const unitChoices = {
GiB: 1024 ** 3,
Expand Down
27 changes: 25 additions & 2 deletions src/react/ui-elements/Veeam/VeeamTable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ describe('VeeamTable', () => {
veeamApplicationSelect: () => screen.getByLabelText(/Veeam application/i),
veeamVBO: () =>
screen.getByRole('option', {
name: /Veeam Backup for Microsoft 365/i,
name: /Veeam Backup for Microsoft 365 \(pre-v8\)/i,
}),
veeamVBOV8: () =>
screen.getByRole('option', {
name: /Veeam Backup for Microsoft 365 \(v8\)/i,
}),
immutableBackupToggle: () => screen.getByLabelText('enableImmutableBackup'),
};
Expand Down Expand Up @@ -206,7 +210,7 @@ describe('VeeamTable', () => {
await verifySuccessActions(mutationActions);
});

it('should skip the SOSAPI setup step when choosing Veeam Backup for Microsoft 365', async () => {
it('should skip the SOSAPI setup step when choosing Veeam Backup for Microsoft 365 (pre-v8)', async () => {
//Setup
server.resetHandlers(...goodHandlers);
setupTest();
Expand All @@ -225,6 +229,25 @@ describe('VeeamTable', () => {
await verifySuccessActions(VeeamVBOActions);
});

it('should skip the SOSAPI setup when choosing VeeamBackup for Microsoft 365 (v8)', async () => {
//Setup
server.resetHandlers(...goodHandlers);
setupTest();
//Exercise
//Select Veeam Backup for Microsoft 365 (v8)
await selectClick(selectors.veeamApplicationSelect());
await userEvent.click(selectors.veeamVBOV8());
await userEvent.type(selectors.accountName(), VEEAM_DEFAULT_ACCOUNT_NAME);
await userEvent.type(selectors.setBucketName(), bucketName);

await waitFor(() => {
expect(selectors.continueButton()).toBeEnabled();
});
await userEvent.click(selectors.continueButton());
//V
await verifySuccessActions(VeeamVBOActions);
});

it('should get non immutable policy when immutable backup is not selected', async () => {
//Setup
server.resetHandlers(...goodHandlers);
Expand Down
9 changes: 6 additions & 3 deletions src/react/ui-elements/Veeam/useMutationTableData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
GET_VEEAM_NON_IMMUTABLE_POLICY,
SYSTEM_XML_CONTENT,
VEEAM_BACKUP_REPLICATION_XML_VALUE,
VEEAM_OFFICE_365_V8,
VEEAM_XML_PREFIX,
} from './VeeamConstants';
import { useCreateBucket } from '../../next-architecture/domain/business/buckets';
Expand Down Expand Up @@ -109,6 +110,7 @@ export const useMutationTableData = ({

const isVeeamVBR =
propsConfiguration.application === VEEAM_BACKUP_REPLICATION_XML_VALUE;
const isVeeamVBOV8 = propsConfiguration.application === VEEAM_OFFICE_365_V8;
const mutations = isVeeamVBR ? mutationsVBR : mutationsVBO;

const instanceId = useInstanceId();
Expand Down Expand Up @@ -140,9 +142,10 @@ export const useMutationTableData = ({
createBucketMutation: () => {
return {
Bucket: propsConfiguration.bucketName,
ObjectLockEnabledForBucket: isVeeamVBR
? propsConfiguration.enableImmutableBackup
: false,
ObjectLockEnabledForBucket:
isVeeamVBR || isVeeamVBOV8
? propsConfiguration.enableImmutableBackup
: false,
};
},
createIAMUserMutation: () => {
Expand Down
Loading