diff --git a/src/react/endpoint/EndpointList.tsx b/src/react/endpoint/EndpointList.tsx
index 6970b13f1..89e311931 100644
--- a/src/react/endpoint/EndpointList.tsx
+++ b/src/react/endpoint/EndpointList.tsx
@@ -14,6 +14,7 @@ import {
cloudServerDashboard,
} from './AdvancedMetricsButton';
import { DeleteEndpoint } from './DeleteEndpoint';
+import { SelectAccountIAMRole } from '../ui-elements/SelectAccountIAMRole';
type CellProps = {
row: {
original: Endpoint;
@@ -139,6 +140,10 @@ function EndpointList({ endpoints, locations }: Props) {
dashboard={cloudServerDashboard}
/>
+
+ Demo
+
+
{
+ return regexArn.exec(arn)?.groups?.['account_id'] ?? '';
+};
+
/**
* DataServiceRoleProvider is using the path to figure out what is the current account.
* In order to reuse this logic, we need to have a router and set DataServiceRoleProvider under
@@ -169,10 +173,12 @@ const SelectAccountIAMRoleWithAccount = (
const rolesQuery = getListRolesQuery(accountName, IAMClient);
const queryClient = useQueryClient();
- const assumedRoleAccountId = regexArn.exec(assumedRole?.AssumedRoleUser?.Arn)
- ?.groups?.['account_id'];
- const selectedAccountId = regexArn.exec(account?.preferredAssumableRoleArn)
- ?.groups?.['account_id'];
+ const assumedRoleAccountId = extractAccountIdFromARN(
+ assumedRole?.AssumedRoleUser?.Arn,
+ );
+ const selectedAccountId = extractAccountIdFromARN(
+ account?.preferredAssumableRoleArn,
+ );
/**
* When we change account, it will take some time to assume the role for the new account.
@@ -263,7 +269,7 @@ export const _SelectAccountIAMRole = (props: SelectAccountIAMRoleProps) => {
} = props;
const accessibleAccountsAdapter = useAccessibleAccountsAdapter();
- const metricsAdapter = new NoOppMetricsAdapter();
+ const metricsAdapter = new NoOpMetricsAdapter();
const accounts = useListAccounts({
accessibleAccountsAdapter,
metricsAdapter,
@@ -273,6 +279,7 @@ export const _SelectAccountIAMRole = (props: SelectAccountIAMRoleProps) => {
return (
idx < 5)}
defaultValue={defaultValue}
hideAccountRoles={hideAccountRoles}
onChange={onChange}
diff --git a/src/react/ui-elements/__tests__/SelectAccountIAMRole.test.tsx b/src/react/ui-elements/__tests__/SelectAccountIAMRole.test.tsx
index 753193413..2c40f9f0d 100644
--- a/src/react/ui-elements/__tests__/SelectAccountIAMRole.test.tsx
+++ b/src/react/ui-elements/__tests__/SelectAccountIAMRole.test.tsx
@@ -1,14 +1,12 @@
-import {
- render,
- screen,
- waitFor,
- waitForElementToBeRemoved,
-} from '@testing-library/react';
+import { render, screen, waitFor } from '@testing-library/react';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import { QueryClient, QueryClientProvider } from 'react-query';
import { TEST_API_BASE_URL } from '../../../react/utils/testUtil';
-import { SelectAccountIAMRole } from '../SelectAccountIAMRole';
+import {
+ SelectAccountIAMRole,
+ extractAccountIdFromARN,
+} from '../SelectAccountIAMRole';
import userEvent from '@testing-library/user-event';
import { debug } from 'jest-preview';
@@ -18,7 +16,8 @@ import {
} from '../../../js/mock/managementClientMSWHandlers';
import { INSTANCE_ID } from '../../../react/actions/__tests__/utils/testUtil';
-const testAccountId = '064609833007';
+const testAccountId1 = '064609833007';
+const testAccountId2 = '377232323695';
const genFn = (getPayloadFn: jest.Mock) => {
return rest.post(`${TEST_API_BASE_URL}/`, (req, res, ctx) => {
@@ -27,31 +26,63 @@ const genFn = (getPayloadFn: jest.Mock) => {
getPayloadFn(params);
if (params.get('Action') === 'AssumeRoleWithWebIdentity') {
- return res(
- ctx.status(200),
- ctx.xml(`
-
-
-
- arn:aws:sts::${testAccountId}:assumed-role/storage-manager-role/ui-9160673b-2c2a-4a6f-a1ef-a3cb6ce25d7f
- OES3SPDIYW4L92S8K1QE6MINE31LQG04:ui-9160673b-2c2a-4a6f-a1ef-a3cb6ce25d7f
-
-
- v/0Nq1YMw4nNbvtgQlgi0l6m/PXWjlk1VLmn2I5q
- 72SPRZFF71WPWXXUG6XF
- eyJzYWx0IjoicVIvVGdIdS9FVjJ4TjN5RmtXSnVLZGE0M0krK0g1L3lFVDU5UkV0enpYYz0iLCJ0YWciOiI4d05WRTIwTlQ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itaSEV5dVZvdEVzeUFtY1V5QTdFZzJtY3BXd1pnbHZrYkZQQmI5M2NDN0ZhZGhpNEUzQ0hQbm9BczF5eVNKNkxIOTZZTHJoaXk1Q1h3VWloSTlRdmxuSDNlV3EwaElBZTFGc2N6bThzVWRCTGU2SWlVc3ZJVDlpMjJzcTZnaVpmdld5czVlaU9NZzRQMFBaZCtPK0VDRmdmd3dxdUhYcFdEL1F5RnR1RENVb0xxblNyMU9lOHdCQ2lXNDFYaGtacmEzWTdtVW1QYXlNWTN6MXpOZm1XRllJV0dWZzlBNVFUaUZLWGlZTngxdUtWZGJ3Qk54SmowVmxlTTE4azlDNFR3Z2U3dVYyKzEzcWVkTW5xOUpLa2Uwa1NsNmMxMWM5N1RUbGJ4TUx5YS9WY1JLWkNkbHJaTGZNK0hjSTJWaGdkSzNzWHJIVEN6UENFRC9lMVBRTkg1RVZBVThLRlNHWGEzb1dPWm9VcmlSYlk1L3R5eTQvbHRKTkVhNnV3R2hra0ljR3JLMjltUndkaDJHSE94R1laYmdGL0VVUDYreUs5cjQrVzc5Y1RYc3NRcEpSM1M1bkZpUHE2bHR6NXM1ZlNYalNkcUxSM0gvTVZlcXV6K3RON0czMk1ieW9halZvcVJxcks2WjZIVm1vM3pDZ1M4TURQQk9jVkY3Ymc0QmhXaXFUTjc5a0ZqV0xkWWZSVlB5Qk1VaXBHNmZCcGlBdUZCZEV1S2lLMHBwVkhQNUpZL0h5ZXRBbVgxMzdVK1U5d3prbmw3eXhyOEQ0TkdNL05yaVhBT21hSDN4YVEifQ==
- 2023-11-28T10:16:13Z
-
- www.scality.com
-
-
- 8e94c64ebf4486567b0e
-
- `),
- );
+ console.log('req.body', req.body);
+ console.log('hey', params.get('RoleArn'));
+ const accountId = extractAccountIdFromARN(params.get('RoleArn'));
+ console.log('accountId', accountId);
+
+ if (accountId === testAccountId1) {
+ return res(
+ ctx.status(200),
+ ctx.xml(`
+
+
+
+ arn:aws:sts::${testAccountId1}:assumed-role/storage-manager-role/ui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XhyOEQ0TkdNL05yaVhBT21hSDN4YVEifQ==
+ 2023-11-28T10:16:13Z
+
+ www.scality.com
+
+
+ 8e94c64ebf4486567b0e
+
+ `),
+ );
+ } else if (accountId === testAccountId2) {
+ return res(
+ ctx.status(200),
+ ctx.xml(`
+
+
+
+ arn:aws:sts::${testAccountId2}:assumed-role/storage-manager-role/ui-9160673b-2c2a-4a6f-a1ef-a3cb6ce25d7f
+ OES3SPDIYW4L92S8K1QE6MINE31LQG04:ui-9160673b-2c2a-4a6f-a1ef-a3cb6ce25d7f
+
+
+ v/0Nq1YMw4nNbvtgQlgi0l6m/PXWjlk1VLmn2I5q
+ 72SPRZFF71WPWXXUG6XF
+ eyJzYWx0IjoicVIvVGdIdS9FVjJ4TjN5RmtXSnVLZGE0M0krK0g1L3lFVDU5UkV0enpYYz0iLCJ0YWciOiI4d05WRTIwTlQxWTVKbWtZemo2ZGJ3PT0iLCJjaXBoZXJ0ZXh0IjoiQVNIanI0M0VZc3dzK0QwWDFkVXRXQ2JMbzlFOVZ5SzF5WWt6a21lRjRXOUpCU3hwbmNxS21zWnpIU3ZvYlZEYjNKaDRNTm16bW1yVUd6dTU1bmRwMTk0eTVlVjFSVWMzaHZnSTFxZTRuYmJxNHBPdit5V3VZQ3RtSExUbE5BTHpDK3VhYW1tZDdzWk9BVXNKQlhRcmVHUG5sTFphb0kySTFveXJjbk10QlVpb1AvYnNjNUd6RHFqdTFWMjVQRE9PQWgzM2JFSktHdmorbEoyL2lWV0x5UHBQU1pLZmdZUnd1QjRXczdGaG81dHhaem9uWWhpaG9ocnFtdmFnNUJSNytiN2lGN3ZxZjBVSnFPZXI5Wm9ldDk1dlpqL01qTU04aGhGQXI1MmZnTHpzOHAzVlN3dHV0OENFSTBoVEJJNlVycUY4SWxiUmhFOUtlaHo0cnRiZHRKQzVmVHFRSkVPZWltb0RIbGpZZXZqOVlIZzZPVFhDR2ZhVzRIWDc3T0g5M1BRa0dHc1RCSjVpRTEyZEdYQjhYWWdSM1V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R6NXM1ZlNYalNkcUxSM0gvTVZlcXV6K3RON0czMk1ieW9halZvcVJxcks2WjZIVm1vM3pDZ1M4TURQQk9jVkY3Ymc0QmhXaXFUTjc5a0ZqV0xkWWZSVlB5Qk1VaXBHNmZCcGlBdUZCZEV1S2lLMHBwVkhQNUpZL0h5ZXRBbVgxMzdVK1U5d3prbmw3eXhyOEQ0TkdNL05yaVhBT21hSDN4YVEifQ==
+ 2023-11-28T10:16:13Z
+
+ www.scality.com
+
+
+ 8e94c64ebf4486567b0e
+
+ `),
+ );
+ }
}
if (params.get('Action') === 'ListRoles') {
+ console.log('req.body ListRoles', req.body);
return res(
ctx.xml(`
{
}
if (params.get('Action') === 'GetRolesForWebIdentity') {
- const TEST_ACCOUNT =
- USERS.find((user) => user.id === testAccountId)?.userName ?? '';
- const TEST_ACCOUNT_CREATION_DATE =
- USERS.find((user) => user.id === testAccountId)?.createDate ?? '';
+ const testAccount1 = USERS.find((user) => user.id === testAccountId1);
+ const testAccount2 = USERS.find((user) => user.id === testAccountId2);
+ const accounts = [testAccount1, testAccount2];
return res(
ctx.json({
IsTruncated: false,
- Accounts: [
- {
- Name: TEST_ACCOUNT,
- CreationDate: TEST_ACCOUNT_CREATION_DATE,
+ Accounts: accounts.map((account) => {
+ return {
+ Name: account.userName,
+ CreationDate: account.createDate,
Roles: [
{
Name: 'storage-manager-role',
- Arn: `arn:aws:iam::${testAccountId}:role/scality-internal/storage-manager-role`,
+ Arn: `arn:aws:iam::${account.id}:role/scality-internal/storage-manager-role`,
},
],
- },
- ],
+ };
+ }),
}),
);
}
@@ -209,8 +239,8 @@ const LocalWrapper = ({ children }) => {
describe('SelectAccountIAMRole', () => {
const seletors = {
- accountSelect: () => screen.getByText(/select account/i),
- roleSelect: () => screen.getByText(/select role/i),
+ accountSelect: () => screen.getByRole('listbox'),
+ roleSelect: () => screen.getByRole('combobox', { name: '' }),
selectOption: (name: string | RegExp) =>
screen.getByRole('option', {
name: new RegExp(name, 'i'),
@@ -255,7 +285,7 @@ describe('SelectAccountIAMRole', () => {
const account = {
assumableRoles: [
{
- Arn: `arn:aws:iam::${testAccountId}:role/scality-internal/storage-manager-role`,
+ Arn: `arn:aws:iam::${testAccountId1}:role/scality-internal/storage-manager-role`,
Name: 'storage-manager-role',
},
],
@@ -263,9 +293,9 @@ describe('SelectAccountIAMRole', () => {
canonicalId:
'1e3492312ab47ab0785e3411824352a8fa8aab68cece94973af04167926b8f2c',
creationDate: '2022-03-18T12:51:44.000Z',
- id: testAccountId,
+ id: testAccountId1,
name: 'no-bucket',
- preferredAssumableRoleArn: `arn:aws:iam::${testAccountId}:role/scality-internal/storage-manager-role`,
+ preferredAssumableRoleArn: `arn:aws:iam::${testAccountId1}:role/scality-internal/storage-manager-role`,
usedCapacity: {
status: 'unknown',
},
@@ -284,6 +314,170 @@ describe('SelectAccountIAMRole', () => {
expect(onChange).toHaveBeenCalledWith(account, role);
});
+ it.only('test the change of account and role', async () => {
+ // Select Account A, check that role B does not exist and select role A
+ // Change Account to Account B and Role B
+
+ const getPayloadFn = jest.fn();
+ server.use(genFn(getPayloadFn));
+ const onChange = jest.fn();
+ render(
+
+
+ ,
+ );
+
+ await waitFor(() => {
+ expect(seletors.accountSelect()).toBeInTheDocument();
+ });
+
+ await userEvent.click(seletors.accountSelect());
+
+ // expect(screen.getByText('no-bucket')).toBeInTheDocument();
+
+ await userEvent.click(seletors.selectOption(/no-bucket/i));
+
+ await waitFor(() => {
+ expect(seletors.roleSelect()).toBeInTheDocument();
+ });
+
+ debug();
+
+ await userEvent.click(seletors.roleSelect());
+ await userEvent.click(seletors.selectOption(/backbeat-gc-1/i));
+
+ await userEvent.click(seletors.accountSelect());
+
+ expect(screen.getByText('yanjin')).toBeInTheDocument();
+
+ await userEvent.click(seletors.selectOption(/yanjin/i));
+
+ server.use(
+ rest.post(`${TEST_API_BASE_URL}/`, (req, res, ctx) => {
+ console.log('CHANGE !');
+ //@ts-ignore
+ const params = new URLSearchParams(req.body);
+ getPayloadFn(params);
+
+ if (params.get('Action') === 'ListRoles') {
+ console.log('req.body ListRoles', req.body);
+ return res(
+ ctx.xml(`
+
+
+
+
+ %7B%22Statement%22%3A%5B%7B%22Action%22%3A%22sts%3AAssumeRole%22%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22AWS%22%3A%22arn%3Aaws%3Aiam%3A%3A000000000000%3Auser%2Fscality-internal%2Fbackbeat-gc-1%22%7D%7D%5D%2C%22Version%22%3A%222012-10-17%22%7D
+ undefined
+ /scality-internal/
+ backbeat-gc-1
+ NPP7LHXVP8THSFDX9J58KJED1VKO5WIZ
+ arn:aws:iam::232853836441:role/scality-internal/backbeat-gc-1
+ 2024-04-17T16:31:36Z
+
+
+ %7B%22Statement%22%3A%5B%7B%22Action%22%3A%22sts%3AAssumeRole%22%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22AWS%22%3A%22arn%3Aaws%3Aiam%3A%3A000000000000%3Auser%2Fscality-internal%2Fbackbeat-lifecycle-bp-1%22%7D%7D%5D%2C%22Version%22%3A%222012-10-17%22%7D
+ undefined
+ /scality-internal/
+ backbeat-lifecycle-bp-1
+ B5HBXF8G2DQ7Z7N13LJA87JRJ1SU40QS
+ arn:aws:iam::232853836441:role/scality-internal/backbeat-lifecycle-bp-1
+ 2024-04-17T16:31:36Z
+
+
+ %7B%22Statement%22%3A%5B%7B%22Action%22%3A%22sts%3AAssumeRole%22%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22AWS%22%3A%22arn%3Aaws%3Aiam%3A%3A000000000000%3Auser%2Fscality-internal%2Fbackbeat-lifecycle-conductor-1%22%7D%7D%5D%2C%22Version%22%3A%222012-10-17%22%7D
+ undefined
+ /scality-internal/
+ backbeat-lifecycle-conductor-1
+ SBPV35W7A65Q5OCCWR1FD203538EELDB
+ arn:aws:iam::232853836441:role/scality-internal/backbeat-lifecycle-conductor-1
+ 2024-04-17T16:31:36Z
+
+
+ %7B%22Statement%22%3A%5B%7B%22Action%22%3A%22sts%3AAssumeRole%22%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22AWS%22%3A%22arn%3Aaws%3Aiam%3A%3A000000000000%3Auser%2Fscality-internal%2Fbackbeat-lifecycle-op-1%22%7D%7D%5D%2C%22Version%22%3A%222012-10-17%22%7D
+ undefined
+ /scality-internal/
+ backbeat-lifecycle-op-1
+ WHS10HK95B2PN9RK8UY2D9Z8377F9E5X
+ arn:aws:iam::232853836441:role/scality-internal/backbeat-lifecycle-op-1
+ 2024-04-17T16:31:36Z
+
+
+ %7B%22Statement%22%3A%5B%7B%22Action%22%3A%22sts%3AAssumeRole%22%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22AWS%22%3A%22arn%3Aaws%3Aiam%3A%3A000000000000%3Auser%2Fscality-internal%2Fbackbeat-lifecycle-tp-1%22%7D%7D%5D%2C%22Version%22%3A%222012-10-17%22%7D
+ undefined
+ /scality-internal/
+ backbeat-lifecycle-tp-1
+ YSXDD002ETBE0CJEZQYFDAYJQTWOVJ51
+ arn:aws:iam::232853836441:role/scality-internal/backbeat-lifecycle-tp-1
+ 2024-04-17T16:31:36Z
+
+
+ %7B%22Statement%22%3A%5B%7B%22Action%22%3A%22sts%3AAssumeRole%22%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22AWS%22%3A%22arn%3Aaws%3Aiam%3A%3A000000000000%3Auser%2Fscality-internal%2Fsorbet-fwd-2%22%7D%7D%5D%2C%22Version%22%3A%222012-10-17%22%7D
+ undefined
+ /scality-internal/
+ cold-storage-archive-role-2
+ DMELLEKK4LI9B3F5EWGTXEMRBKU35R3E
+ arn:aws:iam::232853836441:role/scality-internal/cold-storage-archive-role-2
+ 2024-04-17T16:31:36Z
+
+
+ %7B%22Statement%22%3A%5B%7B%22Action%22%3A%22sts%3AAssumeRole%22%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22AWS%22%3A%22arn%3Aaws%3Aiam%3A%3A000000000000%3Auser%2Fscality-internal%2Fsorbet-fwd-2%22%7D%7D%5D%2C%22Version%22%3A%222012-10-17%22%7D
+ undefined
+ /scality-internal/
+ cold-storage-restore-role-2
+ H3Y58C2OQTKRH4M1EBXASEKSLOMEGRI1
+ arn:aws:iam::232853836441:role/scality-internal/cold-storage-restore-role-2
+ 2024-04-17T16:31:36Z
+
+
+ %7B%22Statement%22%3A%5B%7B%22Action%22%3A%22sts%3AAssumeRoleWithWebIdentity%22%2C%22Condition%22%3A%7B%22StringEquals%22%3A%7B%22keycloak%3Agroups%22%3A%22100%3A%3ADataConsumer%22%7D%7D%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22Federated%22%3A%22https%3A%2F%2Fui.pod-choco.local%2Fauth%2Frealms%2Fartesca%22%7D%7D%2C%7B%22Action%22%3A%22sts%3AAssumeRoleWithWebIdentity%22%2C%22Condition%22%3A%7B%22StringEquals%22%3A%7B%22keycloak%3Agroups%22%3A%22100%3A%3ADataConsumer%22%7D%7D%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22Federated%22%3A%22https%3A%2F%2F13.48.197.10%3A8443%2Fauth%2Frealms%2Fartesca%22%7D%7D%5D%2C%22Version%22%3A%222012-10-17%22%7D
+ Has S3 read and write accesses to 100 S3 Buckets. Cannot create or delete S3 Buckets.
+ /scality-internal/
+ data-consumer-role
+ YGEX9QWC7RI9KMBQEKS4RA9OND4JZ35U
+ arn:aws:iam::232853836441:role/scality-internal/data-consumer-role
+ 2024-04-17T16:31:36Z
+
+
+ %7B%22Statement%22%3A%5B%7B%22Action%22%3A%22sts%3AAssumeRoleWithWebIdentity%22%2C%22Condition%22%3A%7B%22StringEquals%22%3A%7B%22keycloak%3Agroups%22%3A%22100%3A%3AStorageAccountOwner%22%7D%7D%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22Federated%22%3A%22https%3A%2F%2Fui.pod-choco.local%2Fauth%2Frealms%2Fartesca%22%7D%7D%2C%7B%22Action%22%3A%22sts%3AAssumeRoleWithWebIdentity%22%2C%22Condition%22%3A%7B%22StringEquals%22%3A%7B%22keycloak%3Agroups%22%3A%22100%3A%3AStorageAccountOwner%22%7D%7D%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22Federated%22%3A%22https%3A%2F%2F13.48.197.10%3A8443%2Fauth%2Frealms%2Fartesca%22%7D%7D%5D%2C%22Version%22%3A%222012-10-17%22%7D
+ Manages the 100 account (Policies, Users, Roles, Groups).
+ /scality-internal/
+ storage-account-owner-role
+ OYYDW5GLCETHME90KWAZCG5Z8KNZA1OT
+ arn:aws:iam::232853836441:role/scality-internal/storage-account-owner-role
+ 2024-04-17T16:31:36Z
+
+
+ %7B%22Statement%22%3A%5B%7B%22Action%22%3A%22sts%3AAssumeRoleWithWebIdentity%22%2C%22Condition%22%3A%7B%22StringEquals%22%3A%7B%22keycloak%3Aroles%22%3A%22StorageManager%22%7D%7D%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22Federated%22%3A%22https%3A%2F%2Fui.pod-choco.local%2Fauth%2Frealms%2Fartesca%22%7D%7D%2C%7B%22Action%22%3A%22sts%3AAssumeRoleWithWebIdentity%22%2C%22Condition%22%3A%7B%22StringEquals%22%3A%7B%22keycloak%3Aroles%22%3A%22StorageManager%22%7D%7D%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22Federated%22%3A%22https%3A%2F%2F13.48.197.10%3A8443%2Fauth%2Frealms%2Fartesca%22%7D%7D%5D%2C%22Version%22%3A%222012-10-17%22%7D
+ Has all permissions and full access to the 100 account resources and manages ARTESCA users.
+ /scality-internal/
+ storage-manager-role
+ YRA3NTDUTWN6DRN76LSSDM6HA22RWBO9
+ arn:aws:iam::232853836441:role/scality-internal/storage-manager-role
+ 2024-04-17T16:31:36Z
+
+
+ false
+
+
+ 148012f42345b8eb7c29
+
+
+ `),
+ );
+ }
+ }),
+ );
+
+ // await waitFor(() => {
+ // expect(seletors.roleSelect()).toBeInTheDocument();
+ // });
+
+ // await userEvent.click(seletors.roleSelect());
+ // await userEvent.click(seletors.selectOption(/backbeat-gc-1/i));
+ });
+
it('renders with default value', async () => {
const getPayloadFn = jest.fn();
server.use(genFn(getPayloadFn));