Add sources selection for Azure

Fixes HMS-1511
This commit is contained in:
Ondrej Ezr 2023-03-28 10:21:00 +02:00 committed by Lucas Garfield
parent a9b43d0cf1
commit 065900c0f8
12 changed files with 1220 additions and 399 deletions

View file

@ -13,7 +13,8 @@ import {
googleCloudTarger,
imageName,
imageOutput,
msAzureTarget,
msAzureTargetStable,
msAzureTargetBeta,
packages,
packagesContentSources,
registration,
@ -103,7 +104,7 @@ const onSave = (values) => {
image_type: 'aws',
upload_request: {
type: 'aws',
options: options,
options,
},
},
],
@ -151,6 +152,13 @@ const onSave = (values) => {
}
if (values['target-environment']?.azure) {
const upload_options =
values['azure-type'] === 'azure-type-source'
? { source_id: values['azure-sources-select'] }
: {
tenant_id: values['azure-tenant-id'],
subscription_id: values['azure-subscription-id'],
};
const request = {
distribution: values.release,
image_name: values?.['image-name'],
@ -161,8 +169,7 @@ const onSave = (values) => {
upload_request: {
type: 'azure',
options: {
tenant_id: values['azure-tenant-id'],
subscription_id: values['azure-subscription-id'],
...upload_options,
resource_group: values['azure-resource-group'],
},
},
@ -332,9 +339,15 @@ const requestToState = (composeRequest) => {
formState['aws-target-type'] = 'aws-target-type-source';
}
} else if (targetEnvironment === 'azure') {
formState['azure-tenant-id'] = uploadRequest?.options?.tenant_id;
formState['azure-subscription-id'] =
uploadRequest?.options?.subscription_id;
if (uploadRequest?.options?.source_id) {
formState['azure-type'] = 'azure-type-source';
formState['azure-sources-select'] = uploadRequest?.options?.source_id;
} else {
formState['azure-type'] = 'azure-type-manual';
formState['azure-tenant-id'] = uploadRequest?.options?.tenant_id;
formState['azure-subscription-id'] =
uploadRequest?.options?.subscription_id;
}
formState['azure-resource-group'] =
uploadRequest?.options?.resource_group;
} else if (targetEnvironment === 'gcp') {
@ -502,12 +515,12 @@ const formStepHistory = (composeRequest) => {
};
const CreateImageWizard = () => {
const awsTarget = isBeta() ? awsTargetBeta : awsTargetStable;
const dispatch = useDispatch();
const navigate = useNavigate();
const location = useLocation();
const awsTarget = isBeta() ? awsTargetBeta : awsTargetStable;
const msAzureTarget = isBeta() ? msAzureTargetBeta : msAzureTargetStable;
const composeRequest = location?.state?.composeRequest;
const initialState = requestToState(composeRequest);
const stepHistory = formStepHistory(composeRequest);

View file

@ -10,6 +10,8 @@ import PropTypes from 'prop-types';
import ActivationKeys from './formComponents/ActivationKeys';
import { AWSSourcesSelect } from './formComponents/AWSSourcesSelect';
import AzureAuthButton from './formComponents/AzureAuthButton';
import AzureResourceGroups from './formComponents/AzureResourceGroups';
import AzureSourcesSelect from './formComponents/AzureSourcesSelect';
import CentOSAcknowledgement from './formComponents/CentOSAcknowledgement';
import FieldListenerWrapper from './formComponents/FieldListener';
import FileSystemConfiguration from './formComponents/FileSystemConfiguration';
@ -68,6 +70,8 @@ const ImageCreator = ({
'centos-acknowledgement': CentOSAcknowledgement,
'repositories-table': Repositories,
'aws-sources-select': AWSSourcesSelect,
'azure-sources-select': AzureSourcesSelect,
'azure-resource-groups': AzureResourceGroups,
'gallery-layout': GalleryLayout,
'field-listener': FieldListenerWrapper,
registration: Registration,

View file

@ -0,0 +1,95 @@
import React, { useState } from 'react';
import FormSpy from '@data-driven-forms/react-form-renderer/form-spy';
import useFieldApi from '@data-driven-forms/react-form-renderer/use-field-api';
import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api';
import {
FormGroup,
Select,
SelectOption,
SelectVariant,
Spinner,
} from '@patternfly/react-core';
import PropTypes from 'prop-types';
import { useGetAzureSourceDetailQuery } from '../../../store/apiSlice';
const AzureResourceGroups = ({ label, isRequired, className, ...props }) => {
const { change, getState } = useFormApi();
const { input } = useFieldApi(props);
const [isOpen, setIsOpen] = useState(false);
const [sourceId, setSourceId] = useState(
getState()?.values?.['azure-sources-select']
);
const onFormChange = ({ values }) => {
setSourceId(values['azure-sources-select']);
};
const { data: sourceDetails, isFetching } = useGetAzureSourceDetailQuery(
sourceId,
{
skip: !sourceId,
}
);
const resourceGroups = (sourceId && sourceDetails?.resource_groups) || [];
const setResourceGroup = (_, selection) => {
setIsOpen(false);
change(input.name, selection);
};
const handleClear = () => {
change(input.name, undefined);
};
return (
<FormGroup
isRequired={isRequired}
label={label}
data-testid="azure-resource-groups"
>
<FormSpy subscription={{ values: true }} onChange={onFormChange} />
<Select
variant={SelectVariant.typeahead}
className={className}
onToggle={() => setIsOpen(!isOpen)}
onSelect={setResourceGroup}
onClear={handleClear}
selections={input.value}
isOpen={isOpen}
placeholderText="Select resource group"
typeAheadAriaLabel="Select resource group"
>
{isFetching && (
<SelectOption
isNoResultsOption={true}
data-testid="azure-resource-groups-loading"
>
<Spinner isSVG size="lg" />
</SelectOption>
)}
{resourceGroups.map((name, index) => (
<SelectOption
key={index}
value={name}
aria-label={`Resource group ${name}`}
/>
))}
</Select>
</FormGroup>
);
};
AzureResourceGroups.propTypes = {
label: PropTypes.node,
isRequired: PropTypes.bool,
className: PropTypes.string,
};
AzureResourceGroups.defaultProps = {
label: '',
isRequired: false,
className: '',
};
export default AzureResourceGroups;

View file

@ -0,0 +1,153 @@
import React, { useState, useEffect } from 'react';
import FormSpy from '@data-driven-forms/react-form-renderer/form-spy';
import useFieldApi from '@data-driven-forms/react-form-renderer/use-field-api';
import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api';
import { Alert } from '@patternfly/react-core';
import {
FormGroup,
Select,
SelectOption,
SelectVariant,
Spinner,
} from '@patternfly/react-core';
import PropTypes from 'prop-types';
import {
useGetAzureSourcesQuery,
useGetAzureSourceDetailQuery,
} from '../../../store/apiSlice';
const AzureSourcesSelect = ({ label, isRequired, className, ...props }) => {
const { change } = useFormApi();
const { input } = useFieldApi(props);
const [isOpen, setIsOpen] = useState(false);
const selectedSourceId = input.value;
const {
data: sources,
isFetching,
isSuccess,
isError,
refetch,
} = useGetAzureSourcesQuery();
const {
data: sourceDetails,
isFetching: isFetchingDetails,
isSuccess: isSuccessDetails,
isError: isErrorDetails,
} = useGetAzureSourceDetailQuery(selectedSourceId, {
skip: !selectedSourceId,
});
useEffect(() => {
if (isFetchingDetails || !isSuccessDetails) return;
change('azure-tenant-id', sourceDetails.tenant_id);
change('azure-subscription-id', sourceDetails.subscription_id);
}, [isFetchingDetails, isSuccessDetails]);
const onFormChange = ({ values }) => {
if (
values['azure-type'] !== 'azure-type-source' ||
values[input.name] == undefined
) {
change(input.name, undefined);
change('azure-tenant-id', undefined);
change('azure-subscription-id', undefined);
}
};
const handleSelect = (_, sourceName) => {
const sourceId = sources.find((source) => source.name === sourceName).id;
change(input.name, sourceId);
setIsOpen(false);
};
const handleClear = () => {
change(input.name, undefined);
};
const handleToggle = () => {
// Refetch upon opening (but not upon closing)
if (!isOpen) {
refetch();
}
setIsOpen(!isOpen);
};
return (
<>
<FormSpy subscription={{ values: true }} onChange={onFormChange} />
<FormGroup
isRequired={isRequired}
label={label}
data-testid="azure-sources"
>
<Select
ouiaId="source_select"
variant={SelectVariant.typeahead}
className={className}
onToggle={handleToggle}
onSelect={handleSelect}
onClear={handleClear}
selections={
selectedSourceId
? sources.find((source) => source.id === selectedSourceId)?.name
: undefined
}
isOpen={isOpen}
placeholderText="Select source"
typeAheadAriaLabel="Select source"
menuAppendTo="parent"
maxHeight="25rem"
isDisabled={!isSuccess}
>
{isSuccess &&
sources.map((source) => (
<SelectOption key={source.id} value={source.name} />
))}
{isFetching && (
<SelectOption isNoResultsOption={true}>
<Spinner isSVG size="lg" />
</SelectOption>
)}
</Select>
</FormGroup>
<>
{isError && (
<Alert
variant={'danger'}
isPlain
isInline
title={'Sources unavailable'}
>
Sources cannot be reached, try again later or enter an account info
for upload manually.
</Alert>
)}
{!isError && isErrorDetails && (
<Alert
variant={'danger'}
isPlain
isInline
title={'Azure details unavailable'}
>
Could not fetch Tenant id and Subscription id from Azure for given
Source. Check Sources page for the source availability or select a
different Source.
</Alert>
)}
</>
</>
);
};
AzureSourcesSelect.propTypes = {
className: PropTypes.string,
label: PropTypes.node,
isRequired: PropTypes.bool,
};
export default AzureSourcesSelect;

View file

@ -24,7 +24,10 @@ import {
} from './ReviewStepTables';
import { RELEASES, UNIT_GIB } from '../../../constants';
import { useGetAWSSourcesQuery } from '../../../store/apiSlice';
import {
useGetAWSSourcesQuery,
useGetAzureSourcesQuery,
} from '../../../store/apiSlice';
import { googleAccType } from '../steps/googleCloud';
const ExpirationWarning = () => {
@ -158,6 +161,8 @@ export const TargetEnvGCPList = () => {
export const TargetEnvAzureList = () => {
const { getState } = useFormApi();
const { data: azureSources, isSuccess: isSuccessAzureSources } =
useGetAzureSourcesQuery();
return (
<TextContent>
<Text component={TextVariants.h3}>Microsoft Azure</Text>
@ -173,18 +178,38 @@ export const TargetEnvAzureList = () => {
<br />
<ExpirationWarning />
</TextListItem>
<TextListItem component={TextListItemVariants.dt}>
Azure Tenant ID
</TextListItem>
<TextListItem component={TextListItemVariants.dd}>
{getState()?.values?.['azure-tenant-id']}
</TextListItem>
<TextListItem component={TextListItemVariants.dt}>
Subscription ID
</TextListItem>
<TextListItem component={TextListItemVariants.dd}>
{getState()?.values?.['azure-subscription-id']}
</TextListItem>
{getState()?.values?.['azure-type'] === 'azure-type-source' &&
isSuccessAzureSources && (
<>
<TextListItem component={TextListItemVariants.dt}>
Azure Source
</TextListItem>
<TextListItem component={TextListItemVariants.dd}>
{
azureSources.find(
(source) =>
source.id === getState()?.values?.['azure-sources-select']
)?.name
}
</TextListItem>
</>
)}
{getState()?.values?.['azure-type'] === 'azure-type-manual' && (
<>
<TextListItem component={TextListItemVariants.dt}>
Azure Tenant ID
</TextListItem>
<TextListItem component={TextListItemVariants.dd}>
{getState()?.values?.['azure-tenant-id']}
</TextListItem>
<TextListItem component={TextListItemVariants.dt}>
Subscription ID
</TextListItem>
<TextListItem component={TextListItemVariants.dd}>
{getState()?.values?.['azure-subscription-id']}
</TextListItem>
</>
)}
<TextListItem component={TextListItemVariants.dt}>
Resource group
</TextListItem>

View file

@ -1,7 +1,8 @@
export { default as awsTargetStable } from './aws';
export { default as awsTargetBeta } from './aws.beta';
export { default as googleCloudTarger } from './googleCloud';
export { default as msAzureTarget } from './msAzure';
export { default as msAzureTargetStable } from './msAzure';
export { default as msAzureTargetBeta } from './msAzure.beta';
export { default as packages } from './packages';
export { default as packagesContentSources } from './packagesContentSources';
export { default as registration } from './registration';

View file

@ -0,0 +1,262 @@
import React from 'react';
import componentTypes from '@data-driven-forms/react-form-renderer/component-types';
import validatorTypes from '@data-driven-forms/react-form-renderer/validator-types';
import { Button, Text, TextContent, Title } from '@patternfly/react-core';
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
import nextStepMapper from './imageOutputStepMapper';
import StepTemplate from './stepTemplate';
import CustomButtons from '../formComponents/CustomButtons';
const SourcesButton = () => {
return (
<Button
component="a"
target="_blank"
variant="link"
icon={<ExternalLinkAltIcon />}
iconPosition="right"
isInline
href={'settings/sources'}
>
Create and manage sources here
</Button>
);
};
export default {
StepTemplate,
id: 'wizard-target-msazure',
title: 'Microsoft Azure',
customTitle: (
<Title headingLevel="h1" size="xl">
Target environment - Microsoft Azure
</Title>
),
name: 'ms-azure-target-env',
substepOf: 'Target environment',
nextStep: ({ values }) =>
nextStepMapper(values, {
skipAws: true,
skipGoogle: true,
skipAzure: true,
}),
buttons: CustomButtons,
fields: [
{
component: componentTypes.PLAIN_TEXT,
name: 'azure-description',
label: (
<TextContent>
<Text>
Upon build, Image Builder sends the image to the selected authorized
Azure account. The image will be uploaded to the resource group in
the subscription you specify.
</Text>
<Text>
To authorize Image Builder to push images to Microsoft Azure, the
account owner must configure Image Builder as an authorized
application for a specific tenant ID and give it the role of
&quot;Contributor&quot; for the resource group you want to upload
to. This applies even when defining target by Source selection.
<br />
<Button
component="a"
target="_blank"
variant="link"
icon={<ExternalLinkAltIcon />}
iconPosition="right"
isInline
href="https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow"
>
Learn more about OAuth 2.0
</Button>
</Text>
</TextContent>
),
},
{
component: componentTypes.RADIO,
label: 'Share method:',
name: 'azure-type',
initialValue: 'azure-type-source',
autoFocus: true,
options: [
{
label: 'Use an account configured from Sources.',
description:
'Use a configured source to launch environments directly from the console.',
value: 'azure-type-source',
'data-testid': 'azure-radio-source',
autoFocus: true,
},
{
label: 'Manually enter the account information.',
value: 'azure-type-manual',
'data-testid': 'azure-radio-manual',
className: 'pf-u-mt-sm',
},
],
},
{
component: 'azure-sources-select',
name: 'azure-sources-select',
className: 'pf-u-max-width',
label: 'Source Name',
isRequired: true,
validate: [
{
type: validatorTypes.REQUIRED,
},
],
condition: {
when: 'azure-type',
is: 'azure-type-source',
},
},
{
component: componentTypes.PLAIN_TEXT,
name: 'azure-sources-select-description',
label: <SourcesButton />,
condition: {
when: 'azure-type',
is: 'azure-type-source',
},
},
{
name: 'gallery-layout',
component: 'gallery-layout',
minWidths: { default: '12.5rem' },
maxWidths: { default: '12.5rem' },
fields: [
{
component: componentTypes.TEXT_FIELD,
name: 'azure-tenant-id',
'data-testid': 'azure-tenant-id-source',
type: 'text',
label: 'Azure Tenant GUID',
isRequired: true,
isReadOnly: true,
},
{
component: componentTypes.TEXT_FIELD,
name: 'azure-subscription-id',
'data-testid': 'azure-subscription-id-source',
type: 'text',
label: 'Subscription ID',
isRequired: true,
isReadOnly: true,
condition: {
when: 'azure-type',
is: 'azure-type-source',
},
},
],
condition: {
when: 'azure-type',
is: 'azure-type-source',
},
},
{
component: componentTypes.TEXT_FIELD,
name: 'azure-tenant-id',
className: 'pf-u-w-50',
'data-testid': 'azure-tenant-id-manual',
type: 'text',
label: 'Azure Tenant GUID',
isRequired: true,
autoFocus: true,
validate: [
{
type: validatorTypes.REQUIRED,
},
{
type: validatorTypes.PATTERN,
pattern:
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
message: 'Please enter a valid tenant ID',
},
],
condition: {
when: 'azure-type',
is: 'azure-type-manual',
},
},
{
component: 'azure-auth-button',
name: 'azure-auth-button',
'data-testid': 'azure-auth-button',
required: true,
isRequired: true,
},
{
component: componentTypes.TEXT_FIELD,
name: 'azure-subscription-id',
className: 'pf-u-w-50',
'data-testid': 'azure-subscription-id-manual',
type: 'text',
label: 'Subscription ID',
isRequired: true,
validate: [
{
type: validatorTypes.REQUIRED,
},
{
type: validatorTypes.PATTERN,
pattern:
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
message: 'Please enter a valid subscription ID',
},
],
condition: {
when: 'azure-type',
is: 'azure-type-manual',
},
},
{
component: 'azure-resource-groups',
name: 'azure-resource-group',
className: 'pf-u-max-width',
'data-testid': 'azure-resource-group-select',
label: 'Resource group',
isRequired: true,
validate: [
{
type: validatorTypes.REQUIRED,
},
],
condition: {
when: 'azure-type',
is: 'azure-type-source',
},
},
{
component: componentTypes.TEXT_FIELD,
name: 'azure-resource-group',
className: 'pf-u-w-50',
'data-testid': 'azure-resource-group-manual',
type: 'text',
label: 'Resource group',
isRequired: true,
validate: [
{
type: validatorTypes.REQUIRED,
},
{
type: validatorTypes.PATTERN,
pattern: /^[-\w._()]+[-\w_()]$/,
message:
'Resource group names only allow alphanumeric characters, ' +
'periods, underscores, hyphens, and parenthesis and cannot end in a period',
},
],
condition: {
when: 'azure-type',
is: 'azure-type-manual',
},
},
// TODO check oauth2 thing too here?
],
};

View file

@ -41,6 +41,14 @@ export const apiSlice = createApi({
return awsSources;
},
}),
getAzureSources: builder.query({
query: () => `${PROVISIONING_SOURCES_ENDPOINT}?provider=azure`,
}),
getAzureSourceDetail: builder.query({
query: (sourceId) =>
`${PROVISIONING_SOURCES_ENDPOINT}/${sourceId}/upload_info`,
transformResponse: (response) => response.azure,
}),
getArchitecturesByDistribution: builder.query({
query: (distribution) =>
`${IMAGE_BUILDER_API}/architectures/${distribution}`,
@ -51,5 +59,7 @@ export const apiSlice = createApi({
export const {
useGetAWSSourcesQuery,
useGetArchitecturesByDistributionQuery,
useGetAzureSourcesQuery,
useGetAzureSourceDetailQuery,
usePrefetch,
} = apiSlice;

View file

@ -0,0 +1,206 @@
import '@testing-library/jest-dom';
import React from 'react';
import { screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { rest } from 'msw';
import api from '../../../api.js';
import CreateImageWizard from '../../../Components/CreateImageWizard/CreateImageWizard';
import { PROVISIONING_SOURCES_ENDPOINT } from '../../../constants.js';
import { mockRepositoryResults } from '../../fixtures/repositories';
import { server } from '../../mocks/server.js';
import { renderWithReduxRouter } from '../../testUtils';
describe('Step Upload to Azure', () => {
const getNextButton = () => {
const next = screen.getByRole('button', { name: /Next/ });
return next;
};
const getSourceDropdown = async () => {
const sourceDropdown = screen.getByRole('textbox', {
name: /select source/i,
});
// Wait for isSuccess === true, dropdown is disabled while isSuccess === false
await waitFor(() => expect(sourceDropdown).toBeEnabled());
return sourceDropdown;
};
beforeAll(() => {
// scrollTo is not defined in jsdom
window.HTMLElement.prototype.scrollTo = function () {};
// mock the activation key api call
const mockActivationKeys = [{ name: 'name0' }, { name: 'name1' }];
jest
.spyOn(api, 'getActivationKeys')
.mockImplementation(() => Promise.resolve(mockActivationKeys));
const mockActivationKey = { body: [{ name: 'name0' }, { name: 'name1' }] };
jest.spyOn(api, 'getActivationKey').mockImplementation((name) => {
return Promise.resolve(mockActivationKey[name]);
});
jest
.spyOn(api, 'getRepositories')
.mockImplementation(() => Promise.resolve(mockRepositoryResults));
global.insights = {
chrome: {
auth: {
getUser: () => {
return {
identity: {
internal: {
org_id: 5,
},
},
};
},
},
isBeta: () => {
return true;
},
isProd: () => {
return true;
},
getEnvironment: () => {
return 'prod';
},
},
};
});
afterEach(() => {
jest.clearAllMocks();
});
// restore global mock
afterAll(() => {
global.insights = undefined;
});
const user = userEvent.setup();
const setUp = async () => {
renderWithReduxRouter(<CreateImageWizard />);
// select aws as upload destination
const azureTile = screen.getByTestId('upload-azure');
azureTile.click();
getNextButton().click();
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent(
'Target environment - Microsoft Azure'
);
};
test('azure step basics works', async () => {
setUp();
expect(getNextButton()).toHaveClass('pf-m-disabled');
expect(screen.getByTestId('azure-radio-source')).toBeChecked();
await user.click(screen.getByTestId('azure-radio-manual'));
expect(screen.getByTestId('azure-radio-manual')).toBeChecked();
expect(getNextButton()).toHaveClass('pf-m-disabled');
await user.type(
screen.getByTestId('azure-tenant-id-manual'),
'c983c2cd-94d7-44e1-9c6e-9cfa3a40995f'
);
await user.type(
screen.getByTestId('azure-subscription-id-manual'),
'f8f200aa-6234-4bfb-86c2-163d33dffc0c'
);
await user.type(
screen.getByTestId('azure-resource-group-manual'),
'testGroup'
);
expect(getNextButton()).not.toHaveClass('pf-m-disabled');
screen.getByTestId('azure-radio-source').click();
expect(getNextButton()).toHaveClass('pf-m-disabled');
const sourceDropdown = await getSourceDropdown();
// manual values should be cleared out
expect(screen.getByTestId('azure-tenant-id-source')).toHaveValue('');
expect(screen.getByTestId('azure-subscription-id-source')).toHaveValue('');
sourceDropdown.click();
const source = await screen.findByRole('option', {
name: /azureSource1/i,
});
source.click();
// wait for fetching the upload info
await waitFor(() =>
expect(screen.getByTestId('azure-tenant-id-source')).not.toHaveValue('')
);
const resourceGroupDropdown = screen.getByRole('textbox', {
name: /select resource group/i,
});
await user.click(resourceGroupDropdown);
const groups = screen.getAllByLabelText(/^Resource group/);
expect(groups).toHaveLength(2);
await user.click(screen.getByLabelText('Resource group myResourceGroup1'));
expect(getNextButton()).not.toHaveClass('pf-m-disabled');
});
test('handles change of selected Source', async () => {
setUp();
const sourceDropdown = await getSourceDropdown();
sourceDropdown.click();
const source = await screen.findByRole('option', {
name: /azureSource1/i,
});
source.click();
await waitFor(() =>
expect(screen.getByTestId('azure-tenant-id-source')).not.toHaveValue('')
);
sourceDropdown.click();
const source2 = await screen.findByRole('option', {
name: /azureSource2/i,
});
source2.click();
await waitFor(() =>
expect(screen.getByTestId('azure-tenant-id-source')).toHaveValue(
'73d5694c-7a28-417e-9fca-55840084f508'
)
);
const resourceGroupDropdown = screen.getByRole('textbox', {
name: /select resource group/i,
});
await user.click(resourceGroupDropdown);
const groups = screen.getByLabelText(/^Resource group/);
expect(groups).toBeInTheDocument();
expect(screen.getByLabelText('Resource group theirGroup2')).toBeVisible();
});
test('component renders error state correctly', async () => {
setUp();
server.use(
rest.get(
'http://localhost'.concat(PROVISIONING_SOURCES_ENDPOINT),
(req, res, ctx) => res(ctx.status(500))
)
);
await screen.findByText(
/Sources cannot be reached, try again later or enter an account info for upload manually\./i
);
//
});
// set test timeout on 10 seconds
}, 10000);

View file

@ -18,6 +18,7 @@ import {
RHEL_9,
PROVISIONING_SOURCES_ENDPOINT,
} from '../../../constants.js';
import { mockRepositoryResults } from '../../fixtures/repositories';
import { server } from '../../mocks/server.js';
import { renderWithReduxRouter } from '../../testUtils';
@ -52,379 +53,6 @@ const mockPkgResultAlphaContentSources = [
},
];
const mockRepositoryResults = {
data: [
{
uuid: 'dbad4dfc-1547-45f8-b5af-1d7fec0476c6',
name: '13lk3',
url: 'http://yum.theforeman.org/releases/3.4/el8/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:54:00.962352 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:54:00.962352 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:18:12.123607 +0000 UTC',
last_introspection_error: '',
package_count: 605,
status: 'Valid',
gpg_key:
'-----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-----',
metadata_verification: false,
},
{
uuid: '9cf1d45d-aa06-46fe-87ea-121845cc6bbb',
name: '2lmdtj',
url: 'http://mirror.stream.centos.org/SIGs/9/kmods/x86_64/packages-main/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 00:00:12.714873 +0000 UTC',
last_success_introspection_time: '2022-11-23 00:00:12.714873 +0000 UTC',
last_update_introspection_time: '2022-11-18 08:00:10.119093 +0000 UTC',
last_introspection_error: '',
package_count: 21,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '828e7db8-c0d4-48fc-a887-9070e0e75c45',
name: '2zmya',
url: 'https://download-i2.fedoraproject.org/pub/epel/9/Everything/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:18.111405 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:18.111405 +0000 UTC',
last_update_introspection_time: '2022-11-23 08:00:18.111405 +0000 UTC',
last_introspection_error: '',
package_count: 11526,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'ffe90892-6e6c-43c0-a284-df78977d8e37',
name: '4tnt6f',
url: 'https://mirror.linux.duke.edu/pub/centos/8-stream/BaseOS/x86_64/os/',
distribution_versions: ['any'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-22 16:00:06.455684 +0000 UTC',
last_success_introspection_time: '2022-11-22 16:00:06.455684 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:06:03.021973 +0000 UTC',
last_introspection_error: '',
package_count: 11908,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '744000a5-fde5-481d-a1ae-07f27e7f4db9',
name: '76nlti',
url: 'https://download-i2.fedoraproject.org/pub/epel/7/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:01:28.74002 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:01:28.74002 +0000 UTC',
last_update_introspection_time: '2022-11-23 08:01:28.74002 +0000 UTC',
last_introspection_error: '',
package_count: 13739,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '45068247-67b9-4f6d-8f19-1718ab56586e',
name: '938l0k',
url: 'http://yum.theforeman.org/client/3.4/el8/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:20.911292 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:20.911292 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:18:10.148583 +0000 UTC',
last_introspection_error: '',
package_count: 17,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '60887c35-ce7a-4abc-8c57-1cb8a596f63d',
name: 'a6vac',
url: 'http://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/',
distribution_versions: ['7'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:21.719974 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:21.719974 +0000 UTC',
last_update_introspection_time: '2022-09-20 00:21:01.891526 +0000 UTC',
last_introspection_error: '',
package_count: 0,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'f033a5af-ae00-4c26-8bb9-7329d4f17180',
name: 'abi7n',
url: 'http://yum.theforeman.org/katello/4.6/katello/el8/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:01:31.52995 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:01:31.52995 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:11:04.043452 +0000 UTC',
last_introspection_error: '',
package_count: 102,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'be0fd64b-b7d0-48f1-b671-4c74b93a42d2',
name: 'g2ikq',
url: 'http://yum.theforeman.org/client/3.4/el9/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:21.465594 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:21.465594 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:18:10.830524 +0000 UTC',
last_introspection_error: '',
package_count: 11,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'bf5270e6-0559-469b-a4bd-9c881f603813',
name: 'gnome-shell-extensions',
url: 'https://gitlab.gnome.org/GNOME/gnome-shell-extensions/',
distribution_versions: ['any'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:01:33.91888 +0000 UTC',
last_success_introspection_time: '',
last_update_introspection_time: '',
last_introspection_error:
'error parsing repomd.xml: xml.Unmarshal failure: expected element type <repomd> but have <html>',
package_count: 0,
status: 'Invalid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '31ae1b1c-0a14-46df-a6d4-4170f88abeee',
name: 'i9arb',
url: 'http://yum.theforeman.org/pulpcore/3.18/el8/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 00:00:12.263236 +0000 UTC',
last_success_introspection_time: '2022-11-23 00:00:12.263236 +0000 UTC',
last_update_introspection_time: '2022-11-12 00:00:18.375292 +0000 UTC',
last_introspection_error: '',
package_count: 340,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'ea375230-32f7-490d-82b6-501f0a8c2932',
name: 'ixgwo',
url: 'http://yum.theforeman.org/client/3.3/el7/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:37.091305 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:37.091305 +0000 UTC',
last_update_introspection_time: '2022-10-10 16:11:35.690955 +0000 UTC',
last_introspection_error: '',
package_count: 14,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'aa9506b1-e5dd-42be-b5b0-a674f4db915f',
name: 'k64ic',
url: 'http://yum.theforeman.org/pulpcore/3.18/el9/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:18.671713 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:18.671713 +0000 UTC',
last_update_introspection_time: '2022-11-12 00:00:08.970966 +0000 UTC',
last_introspection_error: '',
package_count: 338,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '3cce24d2-41e2-481d-8f01-2b043c72fd6f',
name: 'lrqm',
url: 'http://yum.theforeman.org/client/3.3/el8/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:11.11247 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:11.11247 +0000 UTC',
last_update_introspection_time: '2022-10-10 16:01:36.465549 +0000 UTC',
last_introspection_error: '',
package_count: 16,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'c988934a-87e2-482f-b887-d9ba677a037a',
name: 'mo1qy',
url: 'https://download-i2.fedoraproject.org/pub/epel/8/Everything/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:09.394253 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:09.394253 +0000 UTC',
last_update_introspection_time: '2022-11-23 08:00:09.394253 +0000 UTC',
last_introspection_error: '',
package_count: 9452,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'bbc2bba5-9d7d-4726-b96f-a48408e130b5',
name: 's2h9z',
url: 'http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/',
distribution_versions: ['7'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-22 16:00:06.224391 +0000 UTC',
last_success_introspection_time: '2022-11-22 16:00:06.224391 +0000 UTC',
last_update_introspection_time: '2022-09-20 00:27:02.197045 +0000 UTC',
last_introspection_error: '',
package_count: 0,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '593a973b-715f-4867-ae9c-fa791b59b92d',
name: 'v9h0m',
url: 'http://yum.theforeman.org/pulpcore/3.18/el7/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:19.586273 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:19.586273 +0000 UTC',
last_update_introspection_time: '2022-11-13 00:00:25.156398 +0000 UTC',
last_introspection_error: '',
package_count: 259,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'd08a74ef-589b-486f-aae0-60c6abe25768',
name: 'vbazm',
url: 'http://yum.theforeman.org/client/3.4/el7/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:37.944592 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:37.944592 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:18:09.561151 +0000 UTC',
last_introspection_error: '',
package_count: 15,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '0a12a77d-c3fa-4cd7-958b-ecbec1fd1494',
name: 'vv5jk',
url: 'http://yum.theforeman.org/client/3.2/el7/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 00:00:20.495629 +0000 UTC',
last_success_introspection_time: '2022-11-23 00:00:20.495629 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:20:17.587417 +0000 UTC',
last_introspection_error: '',
package_count: 14,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '5288c386-274c-4598-8f09-0e2f65346e0d',
name: 'ycxvp',
url: 'https://dl.google.com/linux/chrome/rpm/stable/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:09.595446 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:09.595446 +0000 UTC',
last_update_introspection_time: '2022-11-18 08:00:13.259506 +0000 UTC',
last_introspection_error: '',
package_count: 3,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'f087f9ad-dfe6-4627-9d53-336c09886cd4',
name: 'yzfsx',
url: 'http://yum.theforeman.org/client/3.3/el9/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:22.137451 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:22.137451 +0000 UTC',
last_update_introspection_time: '2022-10-10 16:00:18.041568 +0000 UTC',
last_introspection_error: '',
package_count: 11,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
],
meta: {
limit: 100,
offset: 0,
count: 21,
},
links: {
first: '/api/content-sources/v1/repositories/?limit=100&offset=0',
last: '/api/content-sources/v1/repositories/?limit=100&offset=0',
},
};
const mockRepositoryResponsePartial = {
data: new Array(100).fill().map((_, i) => {
return {
@ -1159,17 +787,18 @@ describe('Click through all steps', () => {
await user.type(screen.getByTestId('input-google-email'), 'test@test.com');
screen.getByRole('button', { name: /Next/ }).click();
screen.getByTestId('azure-radio-manual').click();
// Randomly generated GUID
await user.type(
screen.getByTestId('azure-tenant-id'),
screen.getByTestId('azure-tenant-id-manual'),
'b8f86d22-4371-46ce-95e7-65c415f3b1e2'
);
await user.type(
screen.getByTestId('azure-subscription-id'),
screen.getByTestId('azure-subscription-id-manual'),
'60631143-a7dc-4d15-988b-ba83f3c99711'
);
await user.type(
screen.getByTestId('azure-resource-group'),
screen.getByTestId('azure-resource-group-manual'),
'testResourceGroup'
);
screen.getByRole('button', { name: /Next/ }).click();

372
src/test/fixtures/repositories.js vendored Normal file
View file

@ -0,0 +1,372 @@
export const mockRepositoryResults = {
data: [
{
uuid: 'dbad4dfc-1547-45f8-b5af-1d7fec0476c6',
name: '13lk3',
url: 'http://yum.theforeman.org/releases/3.4/el8/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:54:00.962352 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:54:00.962352 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:18:12.123607 +0000 UTC',
last_introspection_error: '',
package_count: 605,
status: 'Valid',
gpg_key:
'-----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-----',
metadata_verification: false,
},
{
uuid: '9cf1d45d-aa06-46fe-87ea-121845cc6bbb',
name: '2lmdtj',
url: 'http://mirror.stream.centos.org/SIGs/9/kmods/x86_64/packages-main/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 00:00:12.714873 +0000 UTC',
last_success_introspection_time: '2022-11-23 00:00:12.714873 +0000 UTC',
last_update_introspection_time: '2022-11-18 08:00:10.119093 +0000 UTC',
last_introspection_error: '',
package_count: 21,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '828e7db8-c0d4-48fc-a887-9070e0e75c45',
name: '2zmya',
url: 'https://download-i2.fedoraproject.org/pub/epel/9/Everything/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:18.111405 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:18.111405 +0000 UTC',
last_update_introspection_time: '2022-11-23 08:00:18.111405 +0000 UTC',
last_introspection_error: '',
package_count: 11526,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'ffe90892-6e6c-43c0-a284-df78977d8e37',
name: '4tnt6f',
url: 'https://mirror.linux.duke.edu/pub/centos/8-stream/BaseOS/x86_64/os/',
distribution_versions: ['any'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-22 16:00:06.455684 +0000 UTC',
last_success_introspection_time: '2022-11-22 16:00:06.455684 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:06:03.021973 +0000 UTC',
last_introspection_error: '',
package_count: 11908,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '744000a5-fde5-481d-a1ae-07f27e7f4db9',
name: '76nlti',
url: 'https://download-i2.fedoraproject.org/pub/epel/7/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:01:28.74002 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:01:28.74002 +0000 UTC',
last_update_introspection_time: '2022-11-23 08:01:28.74002 +0000 UTC',
last_introspection_error: '',
package_count: 13739,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '45068247-67b9-4f6d-8f19-1718ab56586e',
name: '938l0k',
url: 'http://yum.theforeman.org/client/3.4/el8/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:20.911292 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:20.911292 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:18:10.148583 +0000 UTC',
last_introspection_error: '',
package_count: 17,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '60887c35-ce7a-4abc-8c57-1cb8a596f63d',
name: 'a6vac',
url: 'http://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/',
distribution_versions: ['7'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:21.719974 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:21.719974 +0000 UTC',
last_update_introspection_time: '2022-09-20 00:21:01.891526 +0000 UTC',
last_introspection_error: '',
package_count: 0,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'f033a5af-ae00-4c26-8bb9-7329d4f17180',
name: 'abi7n',
url: 'http://yum.theforeman.org/katello/4.6/katello/el8/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:01:31.52995 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:01:31.52995 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:11:04.043452 +0000 UTC',
last_introspection_error: '',
package_count: 102,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'be0fd64b-b7d0-48f1-b671-4c74b93a42d2',
name: 'g2ikq',
url: 'http://yum.theforeman.org/client/3.4/el9/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:21.465594 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:21.465594 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:18:10.830524 +0000 UTC',
last_introspection_error: '',
package_count: 11,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'bf5270e6-0559-469b-a4bd-9c881f603813',
name: 'gnome-shell-extensions',
url: 'https://gitlab.gnome.org/GNOME/gnome-shell-extensions/',
distribution_versions: ['any'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:01:33.91888 +0000 UTC',
last_success_introspection_time: '',
last_update_introspection_time: '',
last_introspection_error:
'error parsing repomd.xml: xml.Unmarshal failure: expected element type <repomd> but have <html>',
package_count: 0,
status: 'Invalid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '31ae1b1c-0a14-46df-a6d4-4170f88abeee',
name: 'i9arb',
url: 'http://yum.theforeman.org/pulpcore/3.18/el8/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 00:00:12.263236 +0000 UTC',
last_success_introspection_time: '2022-11-23 00:00:12.263236 +0000 UTC',
last_update_introspection_time: '2022-11-12 00:00:18.375292 +0000 UTC',
last_introspection_error: '',
package_count: 340,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'ea375230-32f7-490d-82b6-501f0a8c2932',
name: 'ixgwo',
url: 'http://yum.theforeman.org/client/3.3/el7/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:37.091305 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:37.091305 +0000 UTC',
last_update_introspection_time: '2022-10-10 16:11:35.690955 +0000 UTC',
last_introspection_error: '',
package_count: 14,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'aa9506b1-e5dd-42be-b5b0-a674f4db915f',
name: 'k64ic',
url: 'http://yum.theforeman.org/pulpcore/3.18/el9/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:18.671713 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:18.671713 +0000 UTC',
last_update_introspection_time: '2022-11-12 00:00:08.970966 +0000 UTC',
last_introspection_error: '',
package_count: 338,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '3cce24d2-41e2-481d-8f01-2b043c72fd6f',
name: 'lrqm',
url: 'http://yum.theforeman.org/client/3.3/el8/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:11.11247 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:11.11247 +0000 UTC',
last_update_introspection_time: '2022-10-10 16:01:36.465549 +0000 UTC',
last_introspection_error: '',
package_count: 16,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'c988934a-87e2-482f-b887-d9ba677a037a',
name: 'mo1qy',
url: 'https://download-i2.fedoraproject.org/pub/epel/8/Everything/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:09.394253 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:09.394253 +0000 UTC',
last_update_introspection_time: '2022-11-23 08:00:09.394253 +0000 UTC',
last_introspection_error: '',
package_count: 9452,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'bbc2bba5-9d7d-4726-b96f-a48408e130b5',
name: 's2h9z',
url: 'http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/',
distribution_versions: ['7'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-22 16:00:06.224391 +0000 UTC',
last_success_introspection_time: '2022-11-22 16:00:06.224391 +0000 UTC',
last_update_introspection_time: '2022-09-20 00:27:02.197045 +0000 UTC',
last_introspection_error: '',
package_count: 0,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '593a973b-715f-4867-ae9c-fa791b59b92d',
name: 'v9h0m',
url: 'http://yum.theforeman.org/pulpcore/3.18/el7/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:19.586273 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:19.586273 +0000 UTC',
last_update_introspection_time: '2022-11-13 00:00:25.156398 +0000 UTC',
last_introspection_error: '',
package_count: 259,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'd08a74ef-589b-486f-aae0-60c6abe25768',
name: 'vbazm',
url: 'http://yum.theforeman.org/client/3.4/el7/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:37.944592 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:37.944592 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:18:09.561151 +0000 UTC',
last_introspection_error: '',
package_count: 15,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '0a12a77d-c3fa-4cd7-958b-ecbec1fd1494',
name: 'vv5jk',
url: 'http://yum.theforeman.org/client/3.2/el7/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'any',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 00:00:20.495629 +0000 UTC',
last_success_introspection_time: '2022-11-23 00:00:20.495629 +0000 UTC',
last_update_introspection_time: '2022-10-04 00:20:17.587417 +0000 UTC',
last_introspection_error: '',
package_count: 14,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: '5288c386-274c-4598-8f09-0e2f65346e0d',
name: 'ycxvp',
url: 'https://dl.google.com/linux/chrome/rpm/stable/x86_64/',
distribution_versions: ['any'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:09.595446 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:09.595446 +0000 UTC',
last_update_introspection_time: '2022-11-18 08:00:13.259506 +0000 UTC',
last_introspection_error: '',
package_count: 3,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
{
uuid: 'f087f9ad-dfe6-4627-9d53-336c09886cd4',
name: 'yzfsx',
url: 'http://yum.theforeman.org/client/3.3/el9/x86_64/',
distribution_versions: ['7'],
distribution_arch: 'x86_64',
account_id: '6416440',
org_id: '13476545',
last_introspection_time: '2022-11-23 08:00:22.137451 +0000 UTC',
last_success_introspection_time: '2022-11-23 08:00:22.137451 +0000 UTC',
last_update_introspection_time: '2022-10-10 16:00:18.041568 +0000 UTC',
last_introspection_error: '',
package_count: 11,
status: 'Valid',
gpg_key: '',
metadata_verification: false,
},
],
meta: {
limit: 100,
offset: 0,
count: 21,
},
links: {
first: '/api/content-sources/v1/repositories/?limit=100&offset=0',
last: '/api/content-sources/v1/repositories/?limit=100&offset=0',
},
};

View file

@ -21,6 +21,24 @@ export const handlers = [
},
])
);
} else if (provider === 'azure') {
return res(
ctx.status(200),
ctx.json([
{
id: '666',
name: 'azureSource1',
source_type_id: '3',
uid: '9f48059c-25db-47ac-81e8-dac7f8a76170',
},
{
id: '667',
name: 'azureSource2',
source_type_id: '3',
uid: '73d5694c-7a28-417e-9fca-55840084f508',
},
])
);
}
}
),
@ -44,6 +62,39 @@ export const handlers = [
}
}
),
rest.get(
baseURL.concat(`${PROVISIONING_SOURCES_ENDPOINT}/:sourceId/upload_info`),
(req, res, ctx) => {
const { sourceId } = req.params;
if (sourceId === '666') {
return res(
ctx.status(200),
ctx.json({
provider: 'azure',
azure: {
tenant_id: '2fd7c95c-0d63-4e81-b914-3fbd5288daf7',
subscription_id: 'dfb83267-e016-4429-ae6e-b0768bf36d65',
resource_groups: ['myResourceGroup1', 'testResourceGroup'],
},
})
);
} else if (sourceId === '667') {
return res(
ctx.status(200),
ctx.json({
provider: 'azure',
azure: {
tenant_id: '73d5694c-7a28-417e-9fca-55840084f508',
subscription_id: 'a66682d2-ce3e-46f7-a127-1d106c34e10c',
resource_groups: ['theirGroup2'],
},
})
);
} else {
return res(ctx.status(404));
}
}
),
rest.post(
baseURL.concat('/api/content-sources/v1/rpms/names'),
async (req, res, ctx) => {