test: Add edit mode tests
This adds basic edit mode tests for the remaining steps.
This commit is contained in:
parent
d7726c30a6
commit
da1d76ad94
16 changed files with 926 additions and 221 deletions
|
|
@ -223,10 +223,11 @@ describe('Blueprints', () => {
|
|||
expect(button).toBeEnabled();
|
||||
});
|
||||
|
||||
await user.click(button);
|
||||
await user.click(button);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getAllByRole('checkbox')).toHaveLength(3);
|
||||
expect(screen.getAllByRole('checkbox')).toHaveLength(7);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import { screen } from '@testing-library/react';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT } from '../../../../../constants';
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
|
||||
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
|
||||
import { detailsCreateBlueprintRequest } from '../../../../fixtures/editMode';
|
||||
import { clickNext, getNextButton } from '../../../../testUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
|
|
@ -10,8 +12,10 @@ import {
|
|||
enterBlueprintName,
|
||||
goToRegistrationStep,
|
||||
interceptBlueprintRequest,
|
||||
interceptEditBlueprintRequest,
|
||||
openAndDismissSaveAndBuildModal,
|
||||
renderCreateMode,
|
||||
renderEditMode,
|
||||
} from '../../wizardTestUtils';
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
|
|
@ -113,6 +117,22 @@ describe('registration request generated correctly', () => {
|
|||
description: 'Now with extra carmine!',
|
||||
};
|
||||
|
||||
await waitFor(() => {
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Details edit mode', () => {
|
||||
test('edit mode works', async () => {
|
||||
const id = mockBlueprintIds['details'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = detailsCreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,20 +1,25 @@
|
|||
import { screen, within } from '@testing-library/react';
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import {
|
||||
CREATE_BLUEPRINT,
|
||||
EDIT_BLUEPRINT,
|
||||
UNIT_GIB,
|
||||
UNIT_KIB,
|
||||
UNIT_MIB,
|
||||
} from '../../../../../constants';
|
||||
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
|
||||
import { fscCreateBlueprintRequest } from '../../../../fixtures/editMode';
|
||||
import { clickNext } from '../../../../testUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
clickRegisterLater,
|
||||
enterBlueprintName,
|
||||
interceptBlueprintRequest,
|
||||
interceptEditBlueprintRequest,
|
||||
openAndDismissSaveAndBuildModal,
|
||||
renderCreateMode,
|
||||
renderEditMode,
|
||||
} from '../../wizardTestUtils';
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
|
|
@ -256,6 +261,22 @@ describe('file system configuration request generated correctly', () => {
|
|||
},
|
||||
};
|
||||
|
||||
await waitFor(() => {
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('FSC edit mode', () => {
|
||||
test('edit mode works', async () => {
|
||||
const id = mockBlueprintIds['fsc'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = fscCreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,22 +1,28 @@
|
|||
import { screen } from '@testing-library/react';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import {
|
||||
CREATE_BLUEPRINT,
|
||||
EDIT_BLUEPRINT,
|
||||
FIRST_BOOT_SERVICE,
|
||||
FIRST_BOOT_SERVICE_DATA,
|
||||
} from '../../../../../constants';
|
||||
import { File as ImageBuilderFile } from '../../../../../store/imageBuilderApi';
|
||||
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
|
||||
import {
|
||||
SCRIPT,
|
||||
firstBootCreateBlueprintRequest,
|
||||
firstBootData,
|
||||
} from '../../../../fixtures/editMode';
|
||||
import { clickNext } from '../../../../testUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
clickRegisterLater,
|
||||
enterBlueprintName,
|
||||
interceptBlueprintRequest,
|
||||
interceptEditBlueprintRequest,
|
||||
openAndDismissSaveAndBuildModal,
|
||||
renderCreateMode,
|
||||
renderEditMode,
|
||||
} from '../../wizardTestUtils';
|
||||
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
|
|
@ -78,26 +84,6 @@ const goToReviewStep = async (): Promise<void> => {
|
|||
await clickNext(); // Review
|
||||
};
|
||||
|
||||
const SCRIPT = `#!/bin/bash
|
||||
systemctl enable cockpit.socket`;
|
||||
|
||||
const BASE64_SCRIPT = btoa(SCRIPT);
|
||||
const firstBootData: ImageBuilderFile[] = [
|
||||
{
|
||||
path: '/etc/systemd/system/custom-first-boot.service',
|
||||
data: FIRST_BOOT_SERVICE_DATA,
|
||||
data_encoding: 'base64',
|
||||
ensure_parents: true,
|
||||
},
|
||||
{
|
||||
path: '/usr/local/sbin/custom-first-boot',
|
||||
data: BASE64_SCRIPT,
|
||||
data_encoding: 'base64',
|
||||
mode: '0774',
|
||||
ensure_parents: true,
|
||||
},
|
||||
];
|
||||
|
||||
describe('First Boot step', () => {
|
||||
test('should render First Boot step', async () => {
|
||||
await renderCreateMode();
|
||||
|
|
@ -124,7 +110,23 @@ describe('First Boot step', () => {
|
|||
},
|
||||
};
|
||||
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
await waitFor(() => {
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('First Boot edit mode', () => {
|
||||
test('edit mode works', async () => {
|
||||
const id = mockBlueprintIds['firstBoot'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = firstBootCreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,14 +5,32 @@ import { screen, waitFor } from '@testing-library/react';
|
|||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
import CreateImageWizard from '../../../../../Components/CreateImageWizardV2/CreateImageWizard';
|
||||
import { AARCH64, RHEL_8, RHEL_9, X86_64 } from '../../../../../constants';
|
||||
import {
|
||||
AARCH64,
|
||||
EDIT_BLUEPRINT,
|
||||
RHEL_8,
|
||||
RHEL_9,
|
||||
X86_64,
|
||||
} from '../../../../../constants';
|
||||
import { mockArchitecturesByDistro } from '../../../../fixtures/architectures';
|
||||
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
|
||||
import {
|
||||
aarch64CreateBlueprintRequest,
|
||||
centos9CreateBlueprintRequest,
|
||||
rhel8CreateBlueprintRequest,
|
||||
rhel9CreateBlueprintRequest,
|
||||
x86_64CreateBlueprintRequest,
|
||||
} from '../../../../fixtures/editMode';
|
||||
import { server } from '../../../../mocks/server';
|
||||
import {
|
||||
clickNext,
|
||||
renderCustomRoutesWithReduxRouter,
|
||||
} from '../../../../testUtils';
|
||||
import { renderCreateMode } from '../../wizardTestUtils';
|
||||
import {
|
||||
interceptEditBlueprintRequest,
|
||||
renderCreateMode,
|
||||
renderEditMode,
|
||||
} from '../../wizardTestUtils';
|
||||
|
||||
const routes = [
|
||||
{
|
||||
|
|
@ -349,3 +367,61 @@ describe('set target using query parameter', () => {
|
|||
await screen.findByText('Virtualization - Guest image (.qcow2)');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Image Output edit mode', () => {
|
||||
test('edit mode works - rhel9', async () => {
|
||||
const id = mockBlueprintIds['rhel9'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = rhel9CreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
test('edit mode works - rhel8', async () => {
|
||||
const id = mockBlueprintIds['rhel8'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = rhel8CreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
test('edit mode works - centos9', async () => {
|
||||
const id = mockBlueprintIds['centos9'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = centos9CreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
test('edit mode works - x86_64', async () => {
|
||||
const id = mockBlueprintIds['x86_64'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = x86_64CreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
test('edit mode works - aarch64', async () => {
|
||||
const id = mockBlueprintIds['aarch64'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = aarch64CreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import { screen } from '@testing-library/react';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
|
||||
import { CreateBlueprintRequest } from '../../../../../store/imageBuilderApi';
|
||||
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
|
||||
import {
|
||||
baseCreateBlueprintRequest,
|
||||
mockBlueprintIds,
|
||||
oscapCreateBlueprintRequest,
|
||||
} from '../../../../fixtures/blueprints';
|
||||
} from '../../../../fixtures/editMode';
|
||||
import { clickNext } from '../../../../testUtils';
|
||||
import {
|
||||
clickRegisterLater,
|
||||
|
|
@ -173,11 +173,13 @@ describe('oscap', () => {
|
|||
name: 'oscap',
|
||||
};
|
||||
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
await waitFor(() => {
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('oscap edit mode', () => {
|
||||
describe('OpenSCAP edit mode', () => {
|
||||
test('edit mode works', async () => {
|
||||
const id = mockBlueprintIds['oscap'];
|
||||
await renderEditMode(id);
|
||||
|
|
|
|||
|
|
@ -1,16 +1,26 @@
|
|||
import { screen } from '@testing-library/react';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT } from '../../../../../constants';
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
|
||||
import { CreateBlueprintRequest } from '../../../../../store/imageBuilderApi';
|
||||
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
|
||||
import {
|
||||
expectedAllPackageRecommendations,
|
||||
expectedPackages,
|
||||
expectedPackagesWithoutRecommendations,
|
||||
expectedSinglePackageRecommendation,
|
||||
packagesCreateBlueprintRequest,
|
||||
} from '../../../../fixtures/editMode';
|
||||
import { clickNext } from '../../../../testUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
clickRegisterLater,
|
||||
enterBlueprintName,
|
||||
interceptBlueprintRequest,
|
||||
interceptEditBlueprintRequest,
|
||||
openAndDismissSaveAndBuildModal,
|
||||
renderCreateMode,
|
||||
renderEditMode,
|
||||
} from '../../wizardTestUtils';
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
|
|
@ -101,8 +111,6 @@ const deselectRecommendation = async () => {
|
|||
};
|
||||
|
||||
describe('packages request generated correctly', () => {
|
||||
const expectedPackages: string[] = ['test'];
|
||||
|
||||
test('with custom packages', async () => {
|
||||
await renderCreateMode();
|
||||
await goToPackagesStep();
|
||||
|
|
@ -140,22 +148,6 @@ describe('packages request generated correctly', () => {
|
|||
});
|
||||
|
||||
describe('package recommendations', () => {
|
||||
const expectedSinglePackageRecommendation: string[] = [
|
||||
'test', // recommendations are generated only when some packages have been selected
|
||||
'recommendedPackage1',
|
||||
];
|
||||
|
||||
const expectedAllPackageRecommendations: string[] = [
|
||||
'test', // recommendations are generated only when some packages have been selected
|
||||
'recommendedPackage1',
|
||||
'recommendedPackage2',
|
||||
'recommendedPackage3',
|
||||
'recommendedPackage4',
|
||||
'recommendedPackage5',
|
||||
];
|
||||
|
||||
const expectedPackagesWithoutRecommendations: string[] = ['test'];
|
||||
|
||||
test('selecting single recommendation adds it to the request', async () => {
|
||||
await renderCreateMode();
|
||||
await goToPackagesStep();
|
||||
|
|
@ -212,6 +204,22 @@ describe('package recommendations', () => {
|
|||
},
|
||||
};
|
||||
|
||||
await waitFor(() => {
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Packages edit mode', () => {
|
||||
test('edit mode works', async () => {
|
||||
const id = mockBlueprintIds['packages'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = packagesCreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,11 +1,17 @@
|
|||
import { screen } from '@testing-library/react';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT, RHEL_9 } from '../../../../../constants';
|
||||
import {
|
||||
CREATE_BLUEPRINT,
|
||||
EDIT_BLUEPRINT,
|
||||
RHEL_9,
|
||||
} from '../../../../../constants';
|
||||
import {
|
||||
CreateBlueprintRequest,
|
||||
ImageRequest,
|
||||
} from '../../../../../store/imageBuilderApi';
|
||||
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
|
||||
import { registrationCreateBlueprintRequest } from '../../../../fixtures/editMode';
|
||||
import { clickNext } from '../../../../testUtils';
|
||||
import {
|
||||
enterBlueprintName,
|
||||
|
|
@ -14,6 +20,8 @@ import {
|
|||
goToRegistrationStep,
|
||||
clickRegisterLater,
|
||||
openAndDismissSaveAndBuildModal,
|
||||
renderEditMode,
|
||||
interceptEditBlueprintRequest,
|
||||
} from '../../wizardTestUtils';
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
|
|
@ -184,6 +192,22 @@ describe('registration request generated correctly', () => {
|
|||
customizations: {},
|
||||
};
|
||||
|
||||
await waitFor(() => {
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Registration edit mode', () => {
|
||||
test('edit mode works', async () => {
|
||||
const id = mockBlueprintIds['registration'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = registrationCreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ import {
|
|||
CustomRepository,
|
||||
Repository,
|
||||
} from '../../../../../store/imageBuilderApi';
|
||||
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
|
||||
import {
|
||||
expectedCustomRepositories,
|
||||
expectedPayloadRepositories,
|
||||
mockBlueprintIds,
|
||||
repositoriesCreateBlueprintRequest,
|
||||
} from '../../../../fixtures/blueprints';
|
||||
} from '../../../../fixtures/editMode';
|
||||
import { clickNext } from '../../../../testUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
|
|
@ -161,11 +161,13 @@ describe('repositories request generated correctly', () => {
|
|||
|
||||
const expectedRequest = blueprintRequest;
|
||||
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
await waitFor(() => {
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('repositories edit mode', () => {
|
||||
describe('Repositories edit mode', () => {
|
||||
test('edit mode works', async () => {
|
||||
const id = mockBlueprintIds['repositories'];
|
||||
await renderEditMode(id);
|
||||
|
|
|
|||
|
|
@ -1,20 +1,24 @@
|
|||
import { screen } from '@testing-library/react';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT } from '../../../../../constants';
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
|
||||
import { CreateBlueprintRequest } from '../../../../../store/imageBuilderApi';
|
||||
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
|
||||
import {
|
||||
CreateBlueprintRequest,
|
||||
CustomRepository,
|
||||
Repository,
|
||||
} from '../../../../../store/imageBuilderApi';
|
||||
expectedCustomRepositories,
|
||||
expectedPayloadRepositories,
|
||||
snapshotCreateBlueprintRequest,
|
||||
} from '../../../../fixtures/editMode';
|
||||
import { clickNext } from '../../../../testUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
clickRegisterLater,
|
||||
enterBlueprintName,
|
||||
interceptBlueprintRequest,
|
||||
interceptEditBlueprintRequest,
|
||||
openAndDismissSaveAndBuildModal,
|
||||
renderCreateMode,
|
||||
renderEditMode,
|
||||
} from '../../wizardTestUtils';
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
|
|
@ -84,30 +88,6 @@ const getSnapshotMethodElement = async () =>
|
|||
await screen.findByRole('button', { name: /Snapshot method/i });
|
||||
|
||||
describe('repository snapshot tab - ', () => {
|
||||
const expectedPayloadRepositories: Repository[] = [
|
||||
{
|
||||
baseurl: 'http://valid.link.to.repo.org/x86_64/',
|
||||
check_gpg: true,
|
||||
check_repo_gpg: false,
|
||||
gpgkey:
|
||||
'-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINBGN9300BEAC1FLODu0cL6saMMHa7yJY1JZUc+jQUI/HdECQrrsTaPXlcc7nM\nykYMMv6amPqbnhH/R5BW2Ano+OMse+PXtUr0NXU4OcvxbnnXkrVBVUf8mXI9DzLZ\njw8KoD+4/s0BuzO78zAJF5uhuyHMAK0ll9v0r92kK45Fas9iZTfRFcqFAzvgjScf\n5jeBnbRs5U3UTz9mtDy802mk357o1A8BD0qlu3kANDpjLbORGWdAj21A6sMJDYXy\nHS9FBNV54daNcr+weky2L9gaF2yFjeu2rSEHCSfkbWfpSiVUx/bDTj7XS6XDOuJT\nJqvGS8jHqjHAIFBirhCA4cY/jLKxWyMr5N6IbXpPAYgt8/YYz2aOYVvdyB8tZ1u1\nkVsMYSGcvTBexZCn1cDkbO6I+waIlsc0uxGqUGBKF83AVYCQqOkBjF1uNnu9qefE\nkEc9obr4JZsAgnisboU25ss5ZJddKlmFMKSi66g4S5ChLEPFq7MB06PhLFioaD3L\nEXza7XitoW5VBwr0BSVKAHMC0T2xbm70zY06a6gQRlvr9a10lPmv4Tptc7xgQReg\nu1TlFPbrkGJ0d8O6vHQRAd3zdsNaVr4gX0Tg7UYiqT9ZUkP7hOc8PYXQ28hHrHTB\nA63MTq0aiPlJ/ivTuX8M6+Bi25dIV6N6IOUi/NQKIYxgovJCDSdCAAM0fQARAQAB\ntCFMdWNhcyBHYXJmaWVsZCA8bHVjYXNAcmVkaGF0LmNvbT6JAlcEEwEIAEEWIQTO\nQZeiHnXqdjmfUURc6PeuecS2PAUCY33fTQIbAwUJA8JnAAULCQgHAgIiAgYVCgkI\nCwIEFgIDAQIeBwIXgAAKCRBc6PeuecS2PCk3D/9jW7xrBB/2MQFKd5l+mNMFyKwc\nL9M/M5RFI9GaQRo55CwnPb0nnxOJR1V5GzZ/YGii53H2ose65CfBOE2L/F/RvKF0\nH9S9MInixlahzzKtV3TpDoZGk5oZIHEMuPmPS4XaHggolrzExY0ib0mQuBBE/uEV\n/HlyHEunBKPhTkAe+6Q+2dl22SUuVfWr4Uzlp65+DkdN3M37WI1a3Suhnef3rOSM\nV6puUzWRR7qcYs5C2In87AcYPn92P5ur1y/C32r8Ftg3fRWnEzI9QfRG52ojNOLK\nyGQ8ZC9PGe0q7VFcF7ridT/uzRU+NVKldbJg+rvBnszb1MjNuR7rUQHyvGmbsUVQ\nRCsgdovkee3lP4gfZHzk2SSLVSo0+NJRNaM90EmPk14Pgi/yfRSDGBVvLBbEanYI\nv1ZtdIPRyKi+/IaMOu/l7nayM/8RzghdU+0f1FAif5qf9nXuI13P8fqcqfu67gNd\nkh0UUF1XyR5UHHEZQQDqCuKEkZJ/+27jYlsG1ZiLb1odlIWoR44RP6k5OJl0raZb\nyLXbAfpITsXiJJBpCam9P9+XR5VSfgkqp5hIa7J8piN3DoMpoExg4PPQr6PbLAJy\nOUCOnuB7yYVbj0wYuMXTuyrcBHh/UymQnS8AMpQoEkCLWS/A/Hze/pD23LgiBoLY\nXIn5A2EOAf7t2IMSlA==\n=OanT\n-----END PGP PUBLIC KEY BLOCK-----',
|
||||
rhsm: false,
|
||||
},
|
||||
];
|
||||
|
||||
const expectedCustomRepositories: CustomRepository[] = [
|
||||
{
|
||||
baseurl: ['http://valid.link.to.repo.org/x86_64/'],
|
||||
check_gpg: true,
|
||||
check_repo_gpg: false,
|
||||
gpgkey: [
|
||||
'-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINBGN9300BEAC1FLODu0cL6saMMHa7yJY1JZUc+jQUI/HdECQrrsTaPXlcc7nM\nykYMMv6amPqbnhH/R5BW2Ano+OMse+PXtUr0NXU4OcvxbnnXkrVBVUf8mXI9DzLZ\njw8KoD+4/s0BuzO78zAJF5uhuyHMAK0ll9v0r92kK45Fas9iZTfRFcqFAzvgjScf\n5jeBnbRs5U3UTz9mtDy802mk357o1A8BD0qlu3kANDpjLbORGWdAj21A6sMJDYXy\nHS9FBNV54daNcr+weky2L9gaF2yFjeu2rSEHCSfkbWfpSiVUx/bDTj7XS6XDOuJT\nJqvGS8jHqjHAIFBirhCA4cY/jLKxWyMr5N6IbXpPAYgt8/YYz2aOYVvdyB8tZ1u1\nkVsMYSGcvTBexZCn1cDkbO6I+waIlsc0uxGqUGBKF83AVYCQqOkBjF1uNnu9qefE\nkEc9obr4JZsAgnisboU25ss5ZJddKlmFMKSi66g4S5ChLEPFq7MB06PhLFioaD3L\nEXza7XitoW5VBwr0BSVKAHMC0T2xbm70zY06a6gQRlvr9a10lPmv4Tptc7xgQReg\nu1TlFPbrkGJ0d8O6vHQRAd3zdsNaVr4gX0Tg7UYiqT9ZUkP7hOc8PYXQ28hHrHTB\nA63MTq0aiPlJ/ivTuX8M6+Bi25dIV6N6IOUi/NQKIYxgovJCDSdCAAM0fQARAQAB\ntCFMdWNhcyBHYXJmaWVsZCA8bHVjYXNAcmVkaGF0LmNvbT6JAlcEEwEIAEEWIQTO\nQZeiHnXqdjmfUURc6PeuecS2PAUCY33fTQIbAwUJA8JnAAULCQgHAgIiAgYVCgkI\nCwIEFgIDAQIeBwIXgAAKCRBc6PeuecS2PCk3D/9jW7xrBB/2MQFKd5l+mNMFyKwc\nL9M/M5RFI9GaQRo55CwnPb0nnxOJR1V5GzZ/YGii53H2ose65CfBOE2L/F/RvKF0\nH9S9MInixlahzzKtV3TpDoZGk5oZIHEMuPmPS4XaHggolrzExY0ib0mQuBBE/uEV\n/HlyHEunBKPhTkAe+6Q+2dl22SUuVfWr4Uzlp65+DkdN3M37WI1a3Suhnef3rOSM\nV6puUzWRR7qcYs5C2In87AcYPn92P5ur1y/C32r8Ftg3fRWnEzI9QfRG52ojNOLK\nyGQ8ZC9PGe0q7VFcF7ridT/uzRU+NVKldbJg+rvBnszb1MjNuR7rUQHyvGmbsUVQ\nRCsgdovkee3lP4gfZHzk2SSLVSo0+NJRNaM90EmPk14Pgi/yfRSDGBVvLBbEanYI\nv1ZtdIPRyKi+/IaMOu/l7nayM/8RzghdU+0f1FAif5qf9nXuI13P8fqcqfu67gNd\nkh0UUF1XyR5UHHEZQQDqCuKEkZJ/+27jYlsG1ZiLb1odlIWoR44RP6k5OJl0raZb\nyLXbAfpITsXiJJBpCam9P9+XR5VSfgkqp5hIa7J8piN3DoMpoExg4PPQr6PbLAJy\nOUCOnuB7yYVbj0wYuMXTuyrcBHh/UymQnS8AMpQoEkCLWS/A/Hze/pD23LgiBoLY\nXIn5A2EOAf7t2IMSlA==\n=OanT\n-----END PGP PUBLIC KEY BLOCK-----',
|
||||
],
|
||||
id: 'ae39f556-6986-478a-95d1-f9c7e33d066c',
|
||||
name: '01-test-valid-repo',
|
||||
},
|
||||
];
|
||||
|
||||
test('select use a snapshot with 1 repo selected', async () => {
|
||||
await renderCreateMode();
|
||||
await goToSnapshotStep();
|
||||
|
|
@ -156,6 +136,22 @@ describe('repository snapshot tab - ', () => {
|
|||
// Check date was recorded correctly
|
||||
expect(snapshotMethodElement).toHaveTextContent('No repositories selected');
|
||||
// Check that the button is clickable (has 1 repo selected)
|
||||
expect(snapshotMethodElement).toHaveAttribute('aria-disabled', 'true');
|
||||
await waitFor(() => {
|
||||
expect(snapshotMethodElement).toHaveAttribute('aria-disabled', 'true');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Snapshot edit mode', () => {
|
||||
test('edit mode works', async () => {
|
||||
const id = mockBlueprintIds['snapshot'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = snapshotCreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,19 +1,23 @@
|
|||
import { screen } from '@testing-library/react';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT } from '../../../../../../constants';
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../../constants';
|
||||
import {
|
||||
CreateBlueprintRequest,
|
||||
ImageRequest,
|
||||
} from '../../../../../../store/imageBuilderApi';
|
||||
import { mockBlueprintIds } from '../../../../../fixtures/blueprints';
|
||||
import { awsCreateBlueprintRequest } from '../../../../../fixtures/editMode';
|
||||
import { clickBack, clickNext } from '../../../../../testUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
clickRegisterLater,
|
||||
enterBlueprintName,
|
||||
interceptBlueprintRequest,
|
||||
interceptEditBlueprintRequest,
|
||||
openAndDismissSaveAndBuildModal,
|
||||
renderCreateMode,
|
||||
renderEditMode,
|
||||
} from '../../../wizardTestUtils';
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
|
|
@ -161,6 +165,22 @@ describe('aws image type request generated correctly', () => {
|
|||
await goToReview();
|
||||
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
|
||||
|
||||
expect(receivedRequest).toEqual(blueprintRequest);
|
||||
await waitFor(() => {
|
||||
expect(receivedRequest).toEqual(blueprintRequest);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('AWS edit mode', () => {
|
||||
test('edit mode works', async () => {
|
||||
const id = mockBlueprintIds['aws'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = awsCreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,19 +1,23 @@
|
|||
import { screen } from '@testing-library/react';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT } from '../../../../../../constants';
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../../constants';
|
||||
import {
|
||||
CreateBlueprintRequest,
|
||||
ImageRequest,
|
||||
} from '../../../../../../store/imageBuilderApi';
|
||||
import { mockBlueprintIds } from '../../../../../fixtures/blueprints';
|
||||
import { azureCreateBlueprintRequest } from '../../../../../fixtures/editMode';
|
||||
import { clickBack, clickNext } from '../../../../../testUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
clickRegisterLater,
|
||||
enterBlueprintName,
|
||||
interceptBlueprintRequest,
|
||||
interceptEditBlueprintRequest,
|
||||
openAndDismissSaveAndBuildModal,
|
||||
renderCreateMode,
|
||||
renderEditMode,
|
||||
} from '../../../wizardTestUtils';
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
|
|
@ -194,6 +198,22 @@ describe('azure image type request generated correctly', () => {
|
|||
await goToReview();
|
||||
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
|
||||
|
||||
expect(receivedRequest).toEqual(blueprintRequest);
|
||||
await waitFor(() => {
|
||||
expect(receivedRequest).toEqual(blueprintRequest);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Azure edit mode', () => {
|
||||
test('edit mode works', async () => {
|
||||
const id = mockBlueprintIds['azure'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = azureCreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
import { screen } from '@testing-library/react';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT } from '../../../../../constants';
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
|
||||
import {
|
||||
CreateBlueprintRequest,
|
||||
GcpUploadRequestOptions,
|
||||
ImageRequest,
|
||||
ImageTypes,
|
||||
} from '../../../../../store/imageBuilderApi';
|
||||
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
|
||||
import { gcpCreateBlueprintRequest } from '../../../../fixtures/editMode';
|
||||
import { clickBack, clickNext } from '../../../../testUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
|
|
@ -15,8 +17,10 @@ import {
|
|||
enterBlueprintName,
|
||||
imageRequest,
|
||||
interceptBlueprintRequest,
|
||||
interceptEditBlueprintRequest,
|
||||
openAndDismissSaveAndBuildModal,
|
||||
renderCreateMode,
|
||||
renderEditMode,
|
||||
} from '../../wizardTestUtils';
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
|
|
@ -179,6 +183,22 @@ describe('gcp image type request generated correctly', () => {
|
|||
await goToReview();
|
||||
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
|
||||
|
||||
expect(receivedRequest).toEqual(blueprintRequest);
|
||||
await waitFor(() => {
|
||||
expect(receivedRequest).toEqual(blueprintRequest);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('GCP edit mode', () => {
|
||||
test('edit mode works', async () => {
|
||||
const id = mockBlueprintIds['gcp'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = gcpCreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
260
src/test/fixtures/blueprints.ts
vendored
260
src/test/fixtures/blueprints.ts
vendored
|
|
@ -4,11 +4,6 @@ import {
|
|||
CreateBlueprintResponse,
|
||||
GetBlueprintComposesApiResponse,
|
||||
GetBlueprintApiResponse,
|
||||
CreateBlueprintRequest,
|
||||
ImageRequest,
|
||||
BlueprintResponse,
|
||||
Repository,
|
||||
CustomRepository,
|
||||
} from '../../store/imageBuilderApi';
|
||||
|
||||
export const mockBlueprintsCreation: CreateBlueprintResponse[] = [
|
||||
|
|
@ -19,23 +14,65 @@ export const mockBlueprintsCreation: CreateBlueprintResponse[] = [
|
|||
|
||||
export const mockBlueprintIds = {
|
||||
darkChocolate: '677b010b-e95e-4694-9813-d11d847f1bfc',
|
||||
rhel9: 'b40509a4-741e-44c8-a2a9-25ef2bbf378c',
|
||||
rhel8: 'c6b0bbcf-f006-4059-a20c-4bcafa452b76',
|
||||
centos9: '2206aa19-f1ae-4691-a386-e9c3f6c2cf99',
|
||||
x86_64: '00ec80dc-a64a-4756-879a-461e98591e6d',
|
||||
aarch64: '035810f9-22b6-4118-bdc1-c46183437d40',
|
||||
aws: 'ae17f987-0808-4398-a0bb-93605f02768e',
|
||||
gcp: '34449e42-1b61-4fd7-9bf2-55210b5f21cd',
|
||||
azure: '21698d07-10af-425f-bae3-51e6961318b5',
|
||||
registration: '00d2bf0f-55fc-40ae-ad3e-14368c69497a',
|
||||
oscap: '260823fd-0a51-43fd-bc1c-77255848de04',
|
||||
fsc: 'ec486dea-78f8-43ee-9c69-8f76b9d1b143',
|
||||
snapshot: '5dafa0fc-a5c8-4dc3-8a03-ceeb3677b28a',
|
||||
repositories: '6f20ab62-37ba-4afd-9945-734919e9307b',
|
||||
packages: 'b3437c4e-f6f8-4270-8d32-323ac60bc929',
|
||||
firstBoot: 'd0a8376e-e44e-47b3-845d-30f5199a35b6',
|
||||
details: '58991b91-4b98-47e0-b26d-8d908678ddb3',
|
||||
};
|
||||
|
||||
const mockBlueprintNames = {
|
||||
export const mockBlueprintNames = {
|
||||
rhel9: 'rhel9',
|
||||
rhel8: 'rhel8',
|
||||
centos9: 'centos9',
|
||||
x86_64: 'x86_64',
|
||||
aarch64: 'aarch64',
|
||||
aws: 'aws',
|
||||
gcp: 'gcp',
|
||||
azure: 'azure',
|
||||
registration: 'registration',
|
||||
oscap: 'oscap',
|
||||
fsc: 'fsc',
|
||||
snapshot: 'snapshot',
|
||||
repositories: 'repositories',
|
||||
packages: 'packages',
|
||||
firstBoot: 'firstBoot',
|
||||
details: 'details',
|
||||
};
|
||||
|
||||
const mockBlueprintDescriptions = {
|
||||
export const mockBlueprintDescriptions = {
|
||||
rhel9: '',
|
||||
rhel8: '',
|
||||
centos9: '',
|
||||
x86_64: '',
|
||||
aarch64: '',
|
||||
aws: '',
|
||||
gcp: '',
|
||||
azure: '',
|
||||
registration: '',
|
||||
oscap: '',
|
||||
fsc: '',
|
||||
snapshot: '',
|
||||
repositories: '',
|
||||
packages: '',
|
||||
firstBoot: '',
|
||||
details: 'This is a test description for the Details step.',
|
||||
};
|
||||
|
||||
export const mockGetBlueprints: GetBlueprintsApiResponse = {
|
||||
links: { first: 'first', last: 'last' },
|
||||
meta: { count: 13 },
|
||||
meta: { count: 27 },
|
||||
data: [
|
||||
{
|
||||
id: '677b010b-e95e-4694-9813-d11d847f1bfc',
|
||||
|
|
@ -114,6 +151,69 @@ export const mockGetBlueprints: GetBlueprintsApiResponse = {
|
|||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['rhel9'],
|
||||
name: mockBlueprintNames['rhel9'],
|
||||
description: mockBlueprintDescriptions['rhel9'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['rhel8'],
|
||||
name: mockBlueprintNames['rhel8'],
|
||||
description: mockBlueprintDescriptions['rhel8'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['centos9'],
|
||||
name: mockBlueprintNames['centos9'],
|
||||
description: mockBlueprintDescriptions['centos9'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['x86_64'],
|
||||
name: mockBlueprintNames['x86_64'],
|
||||
description: mockBlueprintDescriptions['x86_64'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['aarch64'],
|
||||
name: mockBlueprintNames['aarch64'],
|
||||
description: mockBlueprintDescriptions['aarch64'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['aws'],
|
||||
name: mockBlueprintNames['aws'],
|
||||
description: mockBlueprintDescriptions['aws'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['gcp'],
|
||||
name: mockBlueprintNames['gcp'],
|
||||
description: mockBlueprintDescriptions['gcp'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['azure'],
|
||||
name: mockBlueprintNames['azure'],
|
||||
description: mockBlueprintDescriptions['azure'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['registration'],
|
||||
name: mockBlueprintNames['registration'],
|
||||
description: mockBlueprintDescriptions['registration'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['oscap'],
|
||||
name: mockBlueprintNames['oscap'],
|
||||
|
|
@ -121,6 +221,20 @@ export const mockGetBlueprints: GetBlueprintsApiResponse = {
|
|||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['fsc'],
|
||||
name: mockBlueprintNames['fsc'],
|
||||
description: mockBlueprintDescriptions['fsc'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['snapshot'],
|
||||
name: mockBlueprintNames['snapshot'],
|
||||
description: mockBlueprintDescriptions['snapshot'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['repositories'],
|
||||
name: mockBlueprintNames['repositories'],
|
||||
|
|
@ -128,6 +242,27 @@ export const mockGetBlueprints: GetBlueprintsApiResponse = {
|
|||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['packages'],
|
||||
name: mockBlueprintNames['packages'],
|
||||
description: mockBlueprintDescriptions['packages'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['firstBoot'],
|
||||
name: mockBlueprintNames['firstBoot'],
|
||||
description: mockBlueprintDescriptions['firstBoot'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
{
|
||||
id: mockBlueprintIds['details'],
|
||||
name: mockBlueprintNames['details'],
|
||||
description: mockBlueprintDescriptions['details'],
|
||||
version: 1,
|
||||
last_modified_at: '2021-09-08T21:00:00.000Z',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
|
@ -293,112 +428,3 @@ export const darkChocolateBlueprintResponse: GetBlueprintApiResponse = {
|
|||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const baseImageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'guest-image',
|
||||
upload_request: {
|
||||
options: {},
|
||||
type: 'aws.s3',
|
||||
},
|
||||
};
|
||||
|
||||
export const baseCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
name: 'Red Velvet',
|
||||
description: '',
|
||||
distribution: RHEL_9,
|
||||
image_requests: [baseImageRequest],
|
||||
customizations: {},
|
||||
};
|
||||
|
||||
const expectedOpenscapCisL1 = {
|
||||
profile_id: 'xccdf_org.ssgproject.content_profile_cis_workstation_l1',
|
||||
};
|
||||
|
||||
const expectedPackagesCisL1 = ['aide', 'neovim'];
|
||||
|
||||
const expectedServicesCisL1 = {
|
||||
enabled: ['crond', 'neovim-service'],
|
||||
disabled: ['rpcbind', 'autofs', 'nftables'],
|
||||
masked: ['nfs-server', 'emacs-service'],
|
||||
};
|
||||
|
||||
const expectedKernelCisL1 = {
|
||||
append: 'audit_backlog_limit=8192 audit=1',
|
||||
};
|
||||
|
||||
const expectedFilesystemCisL1 = [
|
||||
{ min_size: 10737418240, mountpoint: '/' },
|
||||
{ min_size: 1073741824, mountpoint: '/tmp' },
|
||||
{ min_size: 1073741824, mountpoint: '/home' },
|
||||
];
|
||||
|
||||
export const oscapCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['oscap'],
|
||||
description: mockBlueprintDescriptions['oscap'],
|
||||
customizations: {
|
||||
packages: expectedPackagesCisL1,
|
||||
openscap: expectedOpenscapCisL1,
|
||||
services: expectedServicesCisL1,
|
||||
kernel: expectedKernelCisL1,
|
||||
filesystem: expectedFilesystemCisL1,
|
||||
},
|
||||
};
|
||||
|
||||
export const oscapBlueprintResponse: BlueprintResponse = {
|
||||
...oscapCreateBlueprintRequest,
|
||||
id: mockBlueprintIds['oscap'],
|
||||
description: mockBlueprintDescriptions['oscap'],
|
||||
};
|
||||
|
||||
export const expectedPayloadRepositories: Repository[] = [
|
||||
{
|
||||
baseurl: 'http://valid.link.to.repo.org/x86_64/',
|
||||
check_gpg: true,
|
||||
check_repo_gpg: false,
|
||||
gpgkey:
|
||||
'-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINBGN9300BEAC1FLODu0cL6saMMHa7yJY1JZUc+jQUI/HdECQrrsTaPXlcc7nM\nykYMMv6amPqbnhH/R5BW2Ano+OMse+PXtUr0NXU4OcvxbnnXkrVBVUf8mXI9DzLZ\njw8KoD+4/s0BuzO78zAJF5uhuyHMAK0ll9v0r92kK45Fas9iZTfRFcqFAzvgjScf\n5jeBnbRs5U3UTz9mtDy802mk357o1A8BD0qlu3kANDpjLbORGWdAj21A6sMJDYXy\nHS9FBNV54daNcr+weky2L9gaF2yFjeu2rSEHCSfkbWfpSiVUx/bDTj7XS6XDOuJT\nJqvGS8jHqjHAIFBirhCA4cY/jLKxWyMr5N6IbXpPAYgt8/YYz2aOYVvdyB8tZ1u1\nkVsMYSGcvTBexZCn1cDkbO6I+waIlsc0uxGqUGBKF83AVYCQqOkBjF1uNnu9qefE\nkEc9obr4JZsAgnisboU25ss5ZJddKlmFMKSi66g4S5ChLEPFq7MB06PhLFioaD3L\nEXza7XitoW5VBwr0BSVKAHMC0T2xbm70zY06a6gQRlvr9a10lPmv4Tptc7xgQReg\nu1TlFPbrkGJ0d8O6vHQRAd3zdsNaVr4gX0Tg7UYiqT9ZUkP7hOc8PYXQ28hHrHTB\nA63MTq0aiPlJ/ivTuX8M6+Bi25dIV6N6IOUi/NQKIYxgovJCDSdCAAM0fQARAQAB\ntCFMdWNhcyBHYXJmaWVsZCA8bHVjYXNAcmVkaGF0LmNvbT6JAlcEEwEIAEEWIQTO\nQZeiHnXqdjmfUURc6PeuecS2PAUCY33fTQIbAwUJA8JnAAULCQgHAgIiAgYVCgkI\nCwIEFgIDAQIeBwIXgAAKCRBc6PeuecS2PCk3D/9jW7xrBB/2MQFKd5l+mNMFyKwc\nL9M/M5RFI9GaQRo55CwnPb0nnxOJR1V5GzZ/YGii53H2ose65CfBOE2L/F/RvKF0\nH9S9MInixlahzzKtV3TpDoZGk5oZIHEMuPmPS4XaHggolrzExY0ib0mQuBBE/uEV\n/HlyHEunBKPhTkAe+6Q+2dl22SUuVfWr4Uzlp65+DkdN3M37WI1a3Suhnef3rOSM\nV6puUzWRR7qcYs5C2In87AcYPn92P5ur1y/C32r8Ftg3fRWnEzI9QfRG52ojNOLK\nyGQ8ZC9PGe0q7VFcF7ridT/uzRU+NVKldbJg+rvBnszb1MjNuR7rUQHyvGmbsUVQ\nRCsgdovkee3lP4gfZHzk2SSLVSo0+NJRNaM90EmPk14Pgi/yfRSDGBVvLBbEanYI\nv1ZtdIPRyKi+/IaMOu/l7nayM/8RzghdU+0f1FAif5qf9nXuI13P8fqcqfu67gNd\nkh0UUF1XyR5UHHEZQQDqCuKEkZJ/+27jYlsG1ZiLb1odlIWoR44RP6k5OJl0raZb\nyLXbAfpITsXiJJBpCam9P9+XR5VSfgkqp5hIa7J8piN3DoMpoExg4PPQr6PbLAJy\nOUCOnuB7yYVbj0wYuMXTuyrcBHh/UymQnS8AMpQoEkCLWS/A/Hze/pD23LgiBoLY\nXIn5A2EOAf7t2IMSlA==\n=OanT\n-----END PGP PUBLIC KEY BLOCK-----',
|
||||
rhsm: false,
|
||||
},
|
||||
];
|
||||
|
||||
export const expectedCustomRepositories: CustomRepository[] = [
|
||||
{
|
||||
baseurl: ['http://valid.link.to.repo.org/x86_64/'],
|
||||
check_gpg: true,
|
||||
check_repo_gpg: false,
|
||||
gpgkey: [
|
||||
'-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINBGN9300BEAC1FLODu0cL6saMMHa7yJY1JZUc+jQUI/HdECQrrsTaPXlcc7nM\nykYMMv6amPqbnhH/R5BW2Ano+OMse+PXtUr0NXU4OcvxbnnXkrVBVUf8mXI9DzLZ\njw8KoD+4/s0BuzO78zAJF5uhuyHMAK0ll9v0r92kK45Fas9iZTfRFcqFAzvgjScf\n5jeBnbRs5U3UTz9mtDy802mk357o1A8BD0qlu3kANDpjLbORGWdAj21A6sMJDYXy\nHS9FBNV54daNcr+weky2L9gaF2yFjeu2rSEHCSfkbWfpSiVUx/bDTj7XS6XDOuJT\nJqvGS8jHqjHAIFBirhCA4cY/jLKxWyMr5N6IbXpPAYgt8/YYz2aOYVvdyB8tZ1u1\nkVsMYSGcvTBexZCn1cDkbO6I+waIlsc0uxGqUGBKF83AVYCQqOkBjF1uNnu9qefE\nkEc9obr4JZsAgnisboU25ss5ZJddKlmFMKSi66g4S5ChLEPFq7MB06PhLFioaD3L\nEXza7XitoW5VBwr0BSVKAHMC0T2xbm70zY06a6gQRlvr9a10lPmv4Tptc7xgQReg\nu1TlFPbrkGJ0d8O6vHQRAd3zdsNaVr4gX0Tg7UYiqT9ZUkP7hOc8PYXQ28hHrHTB\nA63MTq0aiPlJ/ivTuX8M6+Bi25dIV6N6IOUi/NQKIYxgovJCDSdCAAM0fQARAQAB\ntCFMdWNhcyBHYXJmaWVsZCA8bHVjYXNAcmVkaGF0LmNvbT6JAlcEEwEIAEEWIQTO\nQZeiHnXqdjmfUURc6PeuecS2PAUCY33fTQIbAwUJA8JnAAULCQgHAgIiAgYVCgkI\nCwIEFgIDAQIeBwIXgAAKCRBc6PeuecS2PCk3D/9jW7xrBB/2MQFKd5l+mNMFyKwc\nL9M/M5RFI9GaQRo55CwnPb0nnxOJR1V5GzZ/YGii53H2ose65CfBOE2L/F/RvKF0\nH9S9MInixlahzzKtV3TpDoZGk5oZIHEMuPmPS4XaHggolrzExY0ib0mQuBBE/uEV\n/HlyHEunBKPhTkAe+6Q+2dl22SUuVfWr4Uzlp65+DkdN3M37WI1a3Suhnef3rOSM\nV6puUzWRR7qcYs5C2In87AcYPn92P5ur1y/C32r8Ftg3fRWnEzI9QfRG52ojNOLK\nyGQ8ZC9PGe0q7VFcF7ridT/uzRU+NVKldbJg+rvBnszb1MjNuR7rUQHyvGmbsUVQ\nRCsgdovkee3lP4gfZHzk2SSLVSo0+NJRNaM90EmPk14Pgi/yfRSDGBVvLBbEanYI\nv1ZtdIPRyKi+/IaMOu/l7nayM/8RzghdU+0f1FAif5qf9nXuI13P8fqcqfu67gNd\nkh0UUF1XyR5UHHEZQQDqCuKEkZJ/+27jYlsG1ZiLb1odlIWoR44RP6k5OJl0raZb\nyLXbAfpITsXiJJBpCam9P9+XR5VSfgkqp5hIa7J8piN3DoMpoExg4PPQr6PbLAJy\nOUCOnuB7yYVbj0wYuMXTuyrcBHh/UymQnS8AMpQoEkCLWS/A/Hze/pD23LgiBoLY\nXIn5A2EOAf7t2IMSlA==\n=OanT\n-----END PGP PUBLIC KEY BLOCK-----',
|
||||
],
|
||||
id: 'ae39f556-6986-478a-95d1-f9c7e33d066c',
|
||||
name: '01-test-valid-repo',
|
||||
},
|
||||
];
|
||||
|
||||
export const repositoriesCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['repositories'],
|
||||
description: mockBlueprintDescriptions['repositories'],
|
||||
customizations: {
|
||||
custom_repositories: expectedCustomRepositories,
|
||||
payload_repositories: expectedPayloadRepositories,
|
||||
},
|
||||
};
|
||||
|
||||
export const repositoriesBlueprintResponse: BlueprintResponse = {
|
||||
...repositoriesCreateBlueprintRequest,
|
||||
id: mockBlueprintIds['repositories'],
|
||||
description: mockBlueprintDescriptions['repositories'],
|
||||
};
|
||||
|
||||
export const getMockBlueprintResponses = (id: string) => {
|
||||
switch (id) {
|
||||
case mockBlueprintIds['darkChocolate']:
|
||||
return darkChocolateBlueprintResponse;
|
||||
case mockBlueprintIds['oscap']:
|
||||
return oscapBlueprintResponse;
|
||||
case mockBlueprintIds['repositories']:
|
||||
return repositoriesBlueprintResponse;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
467
src/test/fixtures/editMode.ts
vendored
Normal file
467
src/test/fixtures/editMode.ts
vendored
Normal file
|
|
@ -0,0 +1,467 @@
|
|||
import {
|
||||
darkChocolateBlueprintResponse,
|
||||
mockBlueprintDescriptions,
|
||||
mockBlueprintIds,
|
||||
mockBlueprintNames,
|
||||
} from './blueprints';
|
||||
|
||||
import {
|
||||
AARCH64,
|
||||
CENTOS_9,
|
||||
FIRST_BOOT_SERVICE,
|
||||
FIRST_BOOT_SERVICE_DATA,
|
||||
RHEL_8,
|
||||
RHEL_9,
|
||||
UNIT_GIB,
|
||||
UNIT_KIB,
|
||||
UNIT_MIB,
|
||||
X86_64,
|
||||
} from '../../constants';
|
||||
import {
|
||||
BlueprintResponse,
|
||||
CreateBlueprintRequest,
|
||||
CustomRepository,
|
||||
File,
|
||||
ImageRequest,
|
||||
Repository,
|
||||
} from '../../store/imageBuilderApi';
|
||||
|
||||
// Registration
|
||||
export const expectedSubscription = {
|
||||
'activation-key': 'name0',
|
||||
insights: true,
|
||||
rhc: true,
|
||||
organization: 5,
|
||||
'server-url': 'subscription.rhsm.redhat.com',
|
||||
'base-url': 'https://cdn.redhat.com/',
|
||||
};
|
||||
|
||||
// OpenSCAP
|
||||
export const expectedOpenscapCisL1 = {
|
||||
profile_id: 'xccdf_org.ssgproject.content_profile_cis_workstation_l1',
|
||||
};
|
||||
|
||||
export const expectedPackagesCisL1 = ['aide', 'neovim'];
|
||||
|
||||
export const expectedServicesCisL1 = {
|
||||
enabled: ['crond', 'neovim-service'],
|
||||
disabled: ['rpcbind', 'autofs', 'nftables'],
|
||||
masked: ['nfs-server', 'emacs-service'],
|
||||
};
|
||||
|
||||
export const expectedKernelCisL1 = {
|
||||
append: 'audit_backlog_limit=8192 audit=1',
|
||||
};
|
||||
|
||||
export const expectedFilesystemCisL1 = [
|
||||
{ min_size: 10737418240, mountpoint: '/' },
|
||||
{ min_size: 1073741824, mountpoint: '/tmp' },
|
||||
{ min_size: 1073741824, mountpoint: '/home' },
|
||||
];
|
||||
|
||||
// FSC
|
||||
export const expectedFsc = [
|
||||
{ min_size: 10 * UNIT_GIB, mountpoint: '/' },
|
||||
{ min_size: 10 * UNIT_MIB, mountpoint: '/home' },
|
||||
{ min_size: 10 * UNIT_KIB, mountpoint: '/app' },
|
||||
];
|
||||
|
||||
// Repositories
|
||||
export const expectedPayloadRepositories: Repository[] = [
|
||||
{
|
||||
baseurl: 'http://valid.link.to.repo.org/x86_64/',
|
||||
check_gpg: true,
|
||||
check_repo_gpg: false,
|
||||
gpgkey:
|
||||
'-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINBGN9300BEAC1FLODu0cL6saMMHa7yJY1JZUc+jQUI/HdECQrrsTaPXlcc7nM\nykYMMv6amPqbnhH/R5BW2Ano+OMse+PXtUr0NXU4OcvxbnnXkrVBVUf8mXI9DzLZ\njw8KoD+4/s0BuzO78zAJF5uhuyHMAK0ll9v0r92kK45Fas9iZTfRFcqFAzvgjScf\n5jeBnbRs5U3UTz9mtDy802mk357o1A8BD0qlu3kANDpjLbORGWdAj21A6sMJDYXy\nHS9FBNV54daNcr+weky2L9gaF2yFjeu2rSEHCSfkbWfpSiVUx/bDTj7XS6XDOuJT\nJqvGS8jHqjHAIFBirhCA4cY/jLKxWyMr5N6IbXpPAYgt8/YYz2aOYVvdyB8tZ1u1\nkVsMYSGcvTBexZCn1cDkbO6I+waIlsc0uxGqUGBKF83AVYCQqOkBjF1uNnu9qefE\nkEc9obr4JZsAgnisboU25ss5ZJddKlmFMKSi66g4S5ChLEPFq7MB06PhLFioaD3L\nEXza7XitoW5VBwr0BSVKAHMC0T2xbm70zY06a6gQRlvr9a10lPmv4Tptc7xgQReg\nu1TlFPbrkGJ0d8O6vHQRAd3zdsNaVr4gX0Tg7UYiqT9ZUkP7hOc8PYXQ28hHrHTB\nA63MTq0aiPlJ/ivTuX8M6+Bi25dIV6N6IOUi/NQKIYxgovJCDSdCAAM0fQARAQAB\ntCFMdWNhcyBHYXJmaWVsZCA8bHVjYXNAcmVkaGF0LmNvbT6JAlcEEwEIAEEWIQTO\nQZeiHnXqdjmfUURc6PeuecS2PAUCY33fTQIbAwUJA8JnAAULCQgHAgIiAgYVCgkI\nCwIEFgIDAQIeBwIXgAAKCRBc6PeuecS2PCk3D/9jW7xrBB/2MQFKd5l+mNMFyKwc\nL9M/M5RFI9GaQRo55CwnPb0nnxOJR1V5GzZ/YGii53H2ose65CfBOE2L/F/RvKF0\nH9S9MInixlahzzKtV3TpDoZGk5oZIHEMuPmPS4XaHggolrzExY0ib0mQuBBE/uEV\n/HlyHEunBKPhTkAe+6Q+2dl22SUuVfWr4Uzlp65+DkdN3M37WI1a3Suhnef3rOSM\nV6puUzWRR7qcYs5C2In87AcYPn92P5ur1y/C32r8Ftg3fRWnEzI9QfRG52ojNOLK\nyGQ8ZC9PGe0q7VFcF7ridT/uzRU+NVKldbJg+rvBnszb1MjNuR7rUQHyvGmbsUVQ\nRCsgdovkee3lP4gfZHzk2SSLVSo0+NJRNaM90EmPk14Pgi/yfRSDGBVvLBbEanYI\nv1ZtdIPRyKi+/IaMOu/l7nayM/8RzghdU+0f1FAif5qf9nXuI13P8fqcqfu67gNd\nkh0UUF1XyR5UHHEZQQDqCuKEkZJ/+27jYlsG1ZiLb1odlIWoR44RP6k5OJl0raZb\nyLXbAfpITsXiJJBpCam9P9+XR5VSfgkqp5hIa7J8piN3DoMpoExg4PPQr6PbLAJy\nOUCOnuB7yYVbj0wYuMXTuyrcBHh/UymQnS8AMpQoEkCLWS/A/Hze/pD23LgiBoLY\nXIn5A2EOAf7t2IMSlA==\n=OanT\n-----END PGP PUBLIC KEY BLOCK-----',
|
||||
rhsm: false,
|
||||
},
|
||||
];
|
||||
|
||||
export const expectedCustomRepositories: CustomRepository[] = [
|
||||
{
|
||||
baseurl: ['http://valid.link.to.repo.org/x86_64/'],
|
||||
check_gpg: true,
|
||||
check_repo_gpg: false,
|
||||
gpgkey: [
|
||||
'-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINBGN9300BEAC1FLODu0cL6saMMHa7yJY1JZUc+jQUI/HdECQrrsTaPXlcc7nM\nykYMMv6amPqbnhH/R5BW2Ano+OMse+PXtUr0NXU4OcvxbnnXkrVBVUf8mXI9DzLZ\njw8KoD+4/s0BuzO78zAJF5uhuyHMAK0ll9v0r92kK45Fas9iZTfRFcqFAzvgjScf\n5jeBnbRs5U3UTz9mtDy802mk357o1A8BD0qlu3kANDpjLbORGWdAj21A6sMJDYXy\nHS9FBNV54daNcr+weky2L9gaF2yFjeu2rSEHCSfkbWfpSiVUx/bDTj7XS6XDOuJT\nJqvGS8jHqjHAIFBirhCA4cY/jLKxWyMr5N6IbXpPAYgt8/YYz2aOYVvdyB8tZ1u1\nkVsMYSGcvTBexZCn1cDkbO6I+waIlsc0uxGqUGBKF83AVYCQqOkBjF1uNnu9qefE\nkEc9obr4JZsAgnisboU25ss5ZJddKlmFMKSi66g4S5ChLEPFq7MB06PhLFioaD3L\nEXza7XitoW5VBwr0BSVKAHMC0T2xbm70zY06a6gQRlvr9a10lPmv4Tptc7xgQReg\nu1TlFPbrkGJ0d8O6vHQRAd3zdsNaVr4gX0Tg7UYiqT9ZUkP7hOc8PYXQ28hHrHTB\nA63MTq0aiPlJ/ivTuX8M6+Bi25dIV6N6IOUi/NQKIYxgovJCDSdCAAM0fQARAQAB\ntCFMdWNhcyBHYXJmaWVsZCA8bHVjYXNAcmVkaGF0LmNvbT6JAlcEEwEIAEEWIQTO\nQZeiHnXqdjmfUURc6PeuecS2PAUCY33fTQIbAwUJA8JnAAULCQgHAgIiAgYVCgkI\nCwIEFgIDAQIeBwIXgAAKCRBc6PeuecS2PCk3D/9jW7xrBB/2MQFKd5l+mNMFyKwc\nL9M/M5RFI9GaQRo55CwnPb0nnxOJR1V5GzZ/YGii53H2ose65CfBOE2L/F/RvKF0\nH9S9MInixlahzzKtV3TpDoZGk5oZIHEMuPmPS4XaHggolrzExY0ib0mQuBBE/uEV\n/HlyHEunBKPhTkAe+6Q+2dl22SUuVfWr4Uzlp65+DkdN3M37WI1a3Suhnef3rOSM\nV6puUzWRR7qcYs5C2In87AcYPn92P5ur1y/C32r8Ftg3fRWnEzI9QfRG52ojNOLK\nyGQ8ZC9PGe0q7VFcF7ridT/uzRU+NVKldbJg+rvBnszb1MjNuR7rUQHyvGmbsUVQ\nRCsgdovkee3lP4gfZHzk2SSLVSo0+NJRNaM90EmPk14Pgi/yfRSDGBVvLBbEanYI\nv1ZtdIPRyKi+/IaMOu/l7nayM/8RzghdU+0f1FAif5qf9nXuI13P8fqcqfu67gNd\nkh0UUF1XyR5UHHEZQQDqCuKEkZJ/+27jYlsG1ZiLb1odlIWoR44RP6k5OJl0raZb\nyLXbAfpITsXiJJBpCam9P9+XR5VSfgkqp5hIa7J8piN3DoMpoExg4PPQr6PbLAJy\nOUCOnuB7yYVbj0wYuMXTuyrcBHh/UymQnS8AMpQoEkCLWS/A/Hze/pD23LgiBoLY\nXIn5A2EOAf7t2IMSlA==\n=OanT\n-----END PGP PUBLIC KEY BLOCK-----',
|
||||
],
|
||||
id: 'ae39f556-6986-478a-95d1-f9c7e33d066c',
|
||||
name: '01-test-valid-repo',
|
||||
},
|
||||
];
|
||||
|
||||
// First Boot
|
||||
export const SCRIPT = `#!/bin/bash
|
||||
systemctl enable cockpit.socket`;
|
||||
export const BASE64_SCRIPT = btoa(SCRIPT);
|
||||
|
||||
export const firstBootData: File[] = [
|
||||
{
|
||||
path: '/etc/systemd/system/custom-first-boot.service',
|
||||
data: FIRST_BOOT_SERVICE_DATA,
|
||||
data_encoding: 'base64',
|
||||
ensure_parents: true,
|
||||
},
|
||||
{
|
||||
path: '/usr/local/sbin/custom-first-boot',
|
||||
data: BASE64_SCRIPT,
|
||||
data_encoding: 'base64',
|
||||
mode: '0774',
|
||||
ensure_parents: true,
|
||||
},
|
||||
];
|
||||
|
||||
// Packages
|
||||
export const expectedPackages: string[] = ['test'];
|
||||
|
||||
export const expectedSinglePackageRecommendation: string[] = [
|
||||
'test', // recommendations are generated only when some packages have been selected
|
||||
'recommendedPackage1',
|
||||
];
|
||||
|
||||
export const expectedAllPackageRecommendations: string[] = [
|
||||
'test', // recommendations are generated only when some packages have been selected
|
||||
'recommendedPackage1',
|
||||
'recommendedPackage2',
|
||||
'recommendedPackage3',
|
||||
'recommendedPackage4',
|
||||
'recommendedPackage5',
|
||||
];
|
||||
|
||||
export const expectedPackagesWithoutRecommendations: string[] = ['test'];
|
||||
|
||||
// Requests and responses
|
||||
export const baseImageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'guest-image',
|
||||
upload_request: {
|
||||
options: {},
|
||||
type: 'aws.s3',
|
||||
},
|
||||
};
|
||||
|
||||
export const baseCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
name: 'Red Velvet',
|
||||
description: '',
|
||||
distribution: RHEL_9,
|
||||
image_requests: [baseImageRequest],
|
||||
customizations: {},
|
||||
};
|
||||
|
||||
export const rhel9CreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
distribution: RHEL_9,
|
||||
image_requests: [baseImageRequest],
|
||||
name: mockBlueprintNames['rhel9'],
|
||||
description: mockBlueprintDescriptions['rhel9'],
|
||||
customizations: {},
|
||||
};
|
||||
|
||||
export const rhel9BlueprintResponse: BlueprintResponse = {
|
||||
...rhel9CreateBlueprintRequest,
|
||||
id: mockBlueprintIds['rhel9'],
|
||||
description: mockBlueprintDescriptions['rhel9'],
|
||||
};
|
||||
|
||||
export const rhel8CreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
distribution: RHEL_8,
|
||||
image_requests: [baseImageRequest],
|
||||
name: mockBlueprintNames['rhel8'],
|
||||
description: mockBlueprintDescriptions['rhel8'],
|
||||
customizations: {},
|
||||
};
|
||||
|
||||
export const rhel8BlueprintResponse: BlueprintResponse = {
|
||||
...rhel8CreateBlueprintRequest,
|
||||
id: mockBlueprintIds['rhel8'],
|
||||
description: mockBlueprintDescriptions['rhel8'],
|
||||
};
|
||||
|
||||
export const centos9CreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
distribution: CENTOS_9,
|
||||
image_requests: [baseImageRequest],
|
||||
name: mockBlueprintNames['centos9'],
|
||||
description: mockBlueprintDescriptions['centos9'],
|
||||
customizations: {},
|
||||
};
|
||||
|
||||
export const centos9BlueprintResponse: BlueprintResponse = {
|
||||
...centos9CreateBlueprintRequest,
|
||||
id: mockBlueprintIds['centos9'],
|
||||
description: mockBlueprintDescriptions['centos9'],
|
||||
};
|
||||
|
||||
export const x86_64ImageRequest: ImageRequest = {
|
||||
...baseImageRequest,
|
||||
architecture: X86_64,
|
||||
};
|
||||
|
||||
export const x86_64CreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['x86_64'],
|
||||
description: mockBlueprintDescriptions['x86_64'],
|
||||
image_requests: [x86_64ImageRequest],
|
||||
};
|
||||
|
||||
export const x86_64BlueprintResponse: BlueprintResponse = {
|
||||
...x86_64CreateBlueprintRequest,
|
||||
id: mockBlueprintIds['x86_64'],
|
||||
description: mockBlueprintDescriptions['x86_64'],
|
||||
};
|
||||
|
||||
export const aarch64ImageRequest: ImageRequest = {
|
||||
...baseImageRequest,
|
||||
architecture: AARCH64,
|
||||
};
|
||||
|
||||
export const aarch64CreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['aarch64'],
|
||||
description: mockBlueprintDescriptions['aarch64'],
|
||||
image_requests: [x86_64ImageRequest],
|
||||
};
|
||||
|
||||
export const aarch64BlueprintResponse: BlueprintResponse = {
|
||||
...aarch64CreateBlueprintRequest,
|
||||
id: mockBlueprintIds['aarch64'],
|
||||
description: mockBlueprintDescriptions['aarch64'],
|
||||
};
|
||||
|
||||
export const awsImageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'aws',
|
||||
upload_request: {
|
||||
options: {
|
||||
share_with_accounts: ['123123123123'],
|
||||
},
|
||||
type: 'aws',
|
||||
},
|
||||
};
|
||||
|
||||
export const awsCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['aws'],
|
||||
description: mockBlueprintDescriptions['aws'],
|
||||
image_requests: [awsImageRequest],
|
||||
};
|
||||
|
||||
export const awsBlueprintResponse: BlueprintResponse = {
|
||||
...awsCreateBlueprintRequest,
|
||||
id: mockBlueprintIds['registration'],
|
||||
description: mockBlueprintDescriptions['registration'],
|
||||
};
|
||||
|
||||
export const gcpImageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'gcp',
|
||||
upload_request: {
|
||||
type: 'gcp',
|
||||
options: {
|
||||
share_with_accounts: ['serviceAccount:test@email.com'],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const gcpCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['gcp'],
|
||||
description: mockBlueprintDescriptions['gcp'],
|
||||
image_requests: [gcpImageRequest],
|
||||
};
|
||||
|
||||
export const gcpBlueprintResponse: BlueprintResponse = {
|
||||
...gcpCreateBlueprintRequest,
|
||||
id: mockBlueprintIds['gcp'],
|
||||
description: mockBlueprintDescriptions['gcp'],
|
||||
};
|
||||
|
||||
export const azureImageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'azure',
|
||||
upload_request: {
|
||||
options: {
|
||||
source_id: '666',
|
||||
resource_group: 'myResourceGroup1',
|
||||
},
|
||||
type: 'azure',
|
||||
},
|
||||
};
|
||||
|
||||
export const azureCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['azure'],
|
||||
description: mockBlueprintDescriptions['azure'],
|
||||
image_requests: [azureImageRequest],
|
||||
};
|
||||
|
||||
export const azureBlueprintResponse: BlueprintResponse = {
|
||||
...azureCreateBlueprintRequest,
|
||||
id: mockBlueprintIds['azure'],
|
||||
description: mockBlueprintDescriptions['azure'],
|
||||
};
|
||||
|
||||
export const registrationCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['registration'],
|
||||
description: mockBlueprintDescriptions['registration'],
|
||||
customizations: {
|
||||
subscription: expectedSubscription,
|
||||
},
|
||||
};
|
||||
|
||||
export const registrationBlueprintResponse: BlueprintResponse = {
|
||||
...registrationCreateBlueprintRequest,
|
||||
id: mockBlueprintIds['registration'],
|
||||
description: mockBlueprintDescriptions['registration'],
|
||||
};
|
||||
|
||||
export const oscapCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['oscap'],
|
||||
description: mockBlueprintDescriptions['oscap'],
|
||||
customizations: {
|
||||
packages: expectedPackagesCisL1,
|
||||
openscap: expectedOpenscapCisL1,
|
||||
services: expectedServicesCisL1,
|
||||
kernel: expectedKernelCisL1,
|
||||
filesystem: expectedFilesystemCisL1,
|
||||
},
|
||||
};
|
||||
|
||||
export const oscapBlueprintResponse: BlueprintResponse = {
|
||||
...oscapCreateBlueprintRequest,
|
||||
id: mockBlueprintIds['oscap'],
|
||||
description: mockBlueprintDescriptions['oscap'],
|
||||
};
|
||||
|
||||
export const fscCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['fsc'],
|
||||
description: mockBlueprintDescriptions['fsc'],
|
||||
customizations: {
|
||||
filesystem: expectedFsc,
|
||||
},
|
||||
};
|
||||
|
||||
export const fscBlueprintResponse: BlueprintResponse = {
|
||||
...fscCreateBlueprintRequest,
|
||||
id: mockBlueprintIds['fsc'],
|
||||
description: mockBlueprintDescriptions['fsc'],
|
||||
};
|
||||
|
||||
export const snapshotCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['snapshot'],
|
||||
description: mockBlueprintDescriptions['snapshot'],
|
||||
customizations: {
|
||||
custom_repositories: expectedCustomRepositories,
|
||||
payload_repositories: expectedPayloadRepositories,
|
||||
},
|
||||
};
|
||||
|
||||
export const snapshotBlueprintResponse: BlueprintResponse = {
|
||||
...snapshotCreateBlueprintRequest,
|
||||
id: mockBlueprintIds['snapshot'],
|
||||
description: mockBlueprintDescriptions['snapshot'],
|
||||
};
|
||||
|
||||
export const repositoriesCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['repositories'],
|
||||
description: mockBlueprintDescriptions['repositories'],
|
||||
customizations: {
|
||||
custom_repositories: expectedCustomRepositories,
|
||||
payload_repositories: expectedPayloadRepositories,
|
||||
},
|
||||
};
|
||||
|
||||
export const repositoriesBlueprintResponse: BlueprintResponse = {
|
||||
...repositoriesCreateBlueprintRequest,
|
||||
id: mockBlueprintIds['repositories'],
|
||||
description: mockBlueprintDescriptions['repositories'],
|
||||
};
|
||||
|
||||
export const packagesCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['packages'],
|
||||
description: mockBlueprintDescriptions['packages'],
|
||||
customizations: {
|
||||
packages: expectedPackages,
|
||||
},
|
||||
};
|
||||
|
||||
export const packagesBlueprintResponse: BlueprintResponse = {
|
||||
...packagesCreateBlueprintRequest,
|
||||
id: mockBlueprintIds['packages'],
|
||||
description: mockBlueprintDescriptions['packages'],
|
||||
};
|
||||
|
||||
export const firstBootCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['firstBoot'],
|
||||
description: mockBlueprintDescriptions['firstBoot'],
|
||||
customizations: {
|
||||
files: firstBootData,
|
||||
services: { enabled: [FIRST_BOOT_SERVICE] },
|
||||
},
|
||||
};
|
||||
|
||||
export const firstBootBlueprintResponse: BlueprintResponse = {
|
||||
...firstBootCreateBlueprintRequest,
|
||||
id: mockBlueprintIds['firstBoot'],
|
||||
description: mockBlueprintDescriptions['firstBoot'],
|
||||
};
|
||||
|
||||
export const detailsCreateBlueprintRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: mockBlueprintNames['details'],
|
||||
description: mockBlueprintDescriptions['details'],
|
||||
customizations: {},
|
||||
};
|
||||
|
||||
export const detailsBlueprintResponse: BlueprintResponse = {
|
||||
...detailsCreateBlueprintRequest,
|
||||
id: mockBlueprintIds['details'],
|
||||
description: mockBlueprintDescriptions['details'],
|
||||
};
|
||||
|
||||
export const getMockBlueprintResponse = (id: string) => {
|
||||
switch (id) {
|
||||
case mockBlueprintIds['darkChocolate']:
|
||||
return darkChocolateBlueprintResponse;
|
||||
case mockBlueprintIds['rhel9']:
|
||||
return rhel9BlueprintResponse;
|
||||
case mockBlueprintIds['rhel8']:
|
||||
return rhel8BlueprintResponse;
|
||||
case mockBlueprintIds['centos9']:
|
||||
return centos9BlueprintResponse;
|
||||
case mockBlueprintIds['x86_64']:
|
||||
return x86_64BlueprintResponse;
|
||||
case mockBlueprintIds['aarch64']:
|
||||
return aarch64BlueprintResponse;
|
||||
case mockBlueprintIds['aws']:
|
||||
return awsBlueprintResponse;
|
||||
case mockBlueprintIds['gcp']:
|
||||
return gcpBlueprintResponse;
|
||||
case mockBlueprintIds['azure']:
|
||||
return azureBlueprintResponse;
|
||||
case mockBlueprintIds['registration']:
|
||||
return registrationBlueprintResponse;
|
||||
case mockBlueprintIds['fsc']:
|
||||
return fscBlueprintResponse;
|
||||
case mockBlueprintIds['oscap']:
|
||||
return oscapBlueprintResponse;
|
||||
case mockBlueprintIds['snapshot']:
|
||||
return snapshotBlueprintResponse;
|
||||
case mockBlueprintIds['repositories']:
|
||||
return repositoriesBlueprintResponse;
|
||||
case mockBlueprintIds['packages']:
|
||||
return packagesBlueprintResponse;
|
||||
case mockBlueprintIds['firstBoot']:
|
||||
return firstBootBlueprintResponse;
|
||||
case mockBlueprintIds['details']:
|
||||
return detailsBlueprintResponse;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
|
@ -13,7 +13,6 @@ import {
|
|||
} from '../fixtures/activationKeys';
|
||||
import { mockArchitecturesByDistro } from '../fixtures/architectures';
|
||||
import {
|
||||
getMockBlueprintResponses,
|
||||
mockBlueprintComposes,
|
||||
mockBlueprintComposesOutOfSync,
|
||||
mockCentosBlueprintComposes,
|
||||
|
|
@ -26,6 +25,7 @@ import {
|
|||
mockCloneStatus,
|
||||
mockStatus,
|
||||
} from '../fixtures/composes';
|
||||
import { getMockBlueprintResponse } from '../fixtures/editMode';
|
||||
import { mockedFeatureResponse } from '../fixtures/features';
|
||||
import {
|
||||
distributionOscapProfiles,
|
||||
|
|
@ -195,7 +195,7 @@ export const handlers = [
|
|||
}),
|
||||
rest.get(`${IMAGE_BUILDER_API}/blueprints/:id`, (req, res, ctx) => {
|
||||
const id = req.params['id'];
|
||||
return res(ctx.status(200), ctx.json(getMockBlueprintResponses(id)));
|
||||
return res(ctx.status(200), ctx.json(getMockBlueprintResponse(id)));
|
||||
}),
|
||||
rest.put(`${IMAGE_BUILDER_API}/blueprints/:id`, (req, res, ctx) => {
|
||||
const id = req.params['id'];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue