Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

ISPN-14835 Use BASIC when url contains user and password #356

Merged
merged 1 commit into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/e2e/cluster-welcome.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Welcome page', () => {
cy.contains('Default'); // cluster name
cy.contains('Running'); // cluster status
cy.contains('Cluster rebalancing on'); // rebalancing status
cy.contains('20 Caches');
cy.contains('19 Caches');
cy.contains('10 Counters');
cy.contains('1 Tasks');
cy.contains('13 Schemas');
Expand Down
10 changes: 4 additions & 6 deletions cypress/e2e/data-container.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe('Data Container Overview', () => {
const numberOfCaches = 20;
const numberOfCaches = 19;

beforeEach(() => {
cy.login(Cypress.env('username'), Cypress.env('password'));
Expand Down Expand Up @@ -148,18 +148,16 @@ describe('Data Container Overview', () => {
cy.wrap(badge).contains('Replicated');
});

//Adding filter by Invalidation and Scattered caches
//Adding filter by Invalidation cache
cy.get('[data-cy=cacheFilterSelect]').click();
cy.get('[data-cy=cacheFilterSelectExpanded]').should('exist');
cy.get('[id$="Invalidated"]').click(); //Filtering invalidated caches
cy.get('[id$="Scattered"]').click(); //Filtering scattered caches
cy.get('[data-cy=cacheFilterSelect]').click(); //Closing filter selectbox

//Verifying that only replicated,invalidated and scattered caches are shown
//Verifying that only replicated,invalidated caches are shown
cy.contains('jboss-cache');
cy.contains('invalidationCache');
cy.contains('scattered-cache');
cy.get('[data-cy=cachesTable] tr').should('have.length', 4); //4 including header row
cy.get('[data-cy=cachesTable] tr').should('have.length', 3); //3 including header row

//Clears all filters
cy.get('[data-cy=clearAllButton]').click();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/rbac_func.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('RBAC Functionlity Tests', () => {
cy.get('#cluster-manager-header').should('exist');
cy.get('[data-cy=cacheManagerStatus]').should('exist');
cy.get('[data-cy=navigationTabs]').should('exist');
cy.contains('19 Caches');
cy.contains('18 Caches');
cy.contains('12 Counters');
if (isMonitor) {
cy.contains('1 Tasks').should('not.exist');
Expand Down
9 changes: 0 additions & 9 deletions data/caches/scatteredCache.json

This file was deleted.

2 changes: 0 additions & 2 deletions data/create-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/indexe
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/octet-stream-cache
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/java-serialized-cache
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/invalidation-cache
curl -XDELETE --digest -u $userPass http://localhost:11222/rest/v2/caches/scattered-cache

echo "= Create schema"

Expand All @@ -40,7 +39,6 @@ curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@cache
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@caches/octet-stream.json" "http://localhost:11222/rest/v2/caches/octet-stream-cache"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@caches/javaSerializedCache.json" "http://localhost:11222/rest/v2/caches/java-serialized-cache"
# curl -XPOST -u $userPass -H "Content-Type: application/json" -d "@caches/invalidationCache.json" "http://localhost:11222/rest/v2/caches/invalidation-cache"
curl -XPOST --digest -u $userPass -H "Content-Type: application/json" -d "@caches/scatteredCache.json" "http://localhost:11222/rest/v2/caches/scattered-cache"


for i in {1..10}
Expand Down
2 changes: 1 addition & 1 deletion run-server-for-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ EXISTING_SERVER_PATH="${EXISTING_SERVER_PATH}"
#Base directory where the server should be downloaded
BASE_DIR="server"
#The version of the server is either set as an environment variable or is the latest dev version
SERVER_VERSION="${SERVER_VERSION:-"14.0.6.Final"}"
SERVER_VERSION="${SERVER_VERSION:-"15.0.0.Dev01"}"
#Root path from there the infinispan server should be downloaded
ZIP_ROOT="http://downloads.jboss.org/infinispan"
#If this environment variable is provided then it is used for downloading the server;
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/views/About.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('About page', () => {

expect(getByText('Infinispan Corona 1.9')).toBeTruthy();

expect(getByRole('img', { name: /Logo$/})).toBeInTheDocument();
expect(getByRole('img', { name: /Logo$/ })).toBeInTheDocument();

fireEvent.click(getByRole('button', { name: 'Close Dialog' }));

Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/views/counters/AddDeltaCounter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ describe('Add a delta', () => {
);
expect(screen.queryByRole('modal')).toBeDefined();
expect(screen.queryAllByRole('button')).toHaveLength(3);

const submitButton = screen.getByRole('button', { name: 'Confirm' });
fireEvent.click(submitButton);

expect(screen.getByText('cache-managers.counters.modal-delta-helper-invalid')).toBeTruthy();
expect(closeModalCalls).toBe(0);
expect(onAddDeltaCalls).toBe(0);
Expand Down
57 changes: 18 additions & 39 deletions src/__tests__/views/counters/CreateCounter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ mockedCounterHook.useCreateCounter.mockImplementation(() => {
describe('Create a counter', () => {
test('not render the dialog if the modal is closed', () => {
renderWithRouter(
<CreateCounter
submitModal={() => submitModalCalls++}
isModalOpen={false}
closeModal={() => closeModalCalls++}
/>
<CreateCounter submitModal={() => submitModalCalls++} isModalOpen={false} closeModal={() => closeModalCalls++} />
);
expect(screen.queryByRole('modal')).toBeNull();
expect(closeModalCalls).toBe(0);
Expand All @@ -39,15 +35,11 @@ describe('Create a counter', () => {

test('render the dialog and submit with empty values', () => {
renderWithRouter(
<CreateCounter
submitModal={() => submitModalCalls++}
isModalOpen={true}
closeModal={() => closeModalCalls++}
/>
<CreateCounter submitModal={() => submitModalCalls++} isModalOpen={true} closeModal={() => closeModalCalls++} />
);
expect(screen.queryByRole('modal')).toBeDefined();
expect(screen.queryAllByRole('button')).toHaveLength(5);

//Submiting empty form
const submitButton = screen.getByRole('button', { name: 'Create' });
fireEvent.click(submitButton);
Expand All @@ -59,20 +51,16 @@ describe('Create a counter', () => {

test('render the dialog and submit with filled name', () => {
renderWithRouter(
<CreateCounter
submitModal={() => submitModalCalls++}
isModalOpen={true}
closeModal={() => closeModalCalls++}
/>
<CreateCounter submitModal={() => submitModalCalls++} isModalOpen={true} closeModal={() => closeModalCalls++} />
);
expect(screen.queryByRole('modal')).toBeDefined();
expect(screen.queryAllByRole('button')).toHaveLength(5);

const submitButton = screen.getByRole('button', { name: 'Create' });
expect(onCreateCounterCalls).toBe(0);
//Submiting form with name filled
const nameInput = screen.getByLabelText('counter-name-input');
fireEvent.change(nameInput, {target: {value: 'TestCounter'}});
fireEvent.change(nameInput, { target: { value: 'TestCounter' } });
fireEvent.click(submitButton);

expect(closeModalCalls).toBe(1);
Expand All @@ -83,26 +71,22 @@ describe('Create a counter', () => {

test('render the dialog and submit with invalid values', () => {
renderWithRouter(
<CreateCounter
submitModal={() => submitModalCalls++}
isModalOpen={true}
closeModal={() => closeModalCalls++}
/>
<CreateCounter submitModal={() => submitModalCalls++} isModalOpen={true} closeModal={() => closeModalCalls++} />
);
expect(screen.queryByRole('modal')).toBeDefined();
expect(screen.queryAllByRole('button')).toHaveLength(5);

const submitButton = screen.getByRole('button', { name: 'Create' });

//Submiting form with name filled
const nameInput = screen.getByLabelText('counter-name-input');
fireEvent.change(nameInput, {target: {value: 'TestCounter1'}});
fireEvent.change(nameInput, { target: { value: 'TestCounter1' } });
const initialValueInput = screen.getByLabelText('initial-value-input');
fireEvent.change(initialValueInput, {target: {value: '5'}});
fireEvent.change(initialValueInput, { target: { value: '5' } });
const lowerBoundInput = screen.getByLabelText('lower-bound-input');
fireEvent.change(lowerBoundInput, {target: {value: '5'}});
fireEvent.change(lowerBoundInput, { target: { value: '5' } });
const upperBoundInput = screen.getByLabelText('upper-bound-input');
fireEvent.change(upperBoundInput, {target: {value: '5'}});
fireEvent.change(upperBoundInput, { target: { value: '5' } });
fireEvent.click(submitButton);
expect(screen.getByText('cache-managers.counters.modal-initial-value-invalid')).toBeTruthy();
expect(screen.getByText('cache-managers.counters.modal-lower-bound-invalid')).toBeTruthy();
Expand All @@ -114,32 +98,27 @@ describe('Create a counter', () => {

test('render the dialog and submit with valid values', () => {
renderWithRouter(
<CreateCounter
submitModal={() => submitModalCalls++}
isModalOpen={true}
closeModal={() => closeModalCalls++}
/>
<CreateCounter submitModal={() => submitModalCalls++} isModalOpen={true} closeModal={() => closeModalCalls++} />
);
expect(screen.queryByRole('modal')).toBeDefined();
expect(screen.queryAllByRole('button')).toHaveLength(5);

const submitButton = screen.getByRole('button', { name: 'Create' });

//Submiting form with name filled
const nameInput = screen.getByLabelText('counter-name-input');
fireEvent.change(nameInput, {target: {value: 'TestCounter1'}});
fireEvent.change(nameInput, { target: { value: 'TestCounter1' } });
const initialValueInput = screen.getByLabelText('initial-value-input');
fireEvent.change(initialValueInput, {target: {value: '5'}});
fireEvent.change(initialValueInput, { target: { value: '5' } });
const lowerBoundInput = screen.getByLabelText('lower-bound-input');
fireEvent.change(lowerBoundInput, {target: {value: '0'}});
fireEvent.change(lowerBoundInput, { target: { value: '0' } });
const upperBoundInput = screen.getByLabelText('upper-bound-input');
fireEvent.change(upperBoundInput, {target: {value: '10'}});
fireEvent.change(upperBoundInput, { target: { value: '10' } });
fireEvent.click(submitButton);

expect(closeModalCalls).toBe(1);
expect(onCreateCounterCalls).toBe(1);
expect(submitModalCalls).toBe(1);
expect(screen.queryByRole('modal')).toBeNull();
});

});
6 changes: 3 additions & 3 deletions src/app/AppLayout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ init, children }) => {
const [isWelcomePage, setIsWelcomePage] = useState(ConsoleServices.isWelcomePage());
const logoProps = {
target: '_self',
onClick: () => history.push('/')
onClick: () => history.push('/' + history.location.search)
};

const { t } = useTranslation();
Expand Down Expand Up @@ -87,7 +87,7 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ init, children }) => {
const Logo = (
<Flex alignItems={{ default: 'alignItemsCenter' }}>
<FlexItem style={{ marginTop: global_spacer_sm.value }}>
<Link to={'/'}>
<Link to={{ pathname: '/', search: location.search }}>
<Brand src={icon} alt={t('layout.console-name')} widths={{ default: '150px' }}>
<source srcSet={icon} />
</Brand>
Expand Down Expand Up @@ -179,7 +179,7 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ init, children }) => {
<NavItem key={`${route.label}-${idx}`} id={`${route.label}-${idx}`}>
<NavLink
exact
to={route.path}
to={route.path + history.location.search}
activeClassName="pf-m-current"
isActive={(match, location) => {
if (match) {
Expand Down
6 changes: 4 additions & 2 deletions src/app/CacheManagers/CacheTableDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ const CacheTableDisplay = (props: { cmName: string; setCachesCount: (count: numb
<Link
data-cy={`detailLink-${cacheInfo.name}`}
key={cacheInfo.name}
to={'/cache/' + encodeURIComponent(cacheInfo.name)}
to={{ pathname: '/cache/' + encodeURIComponent(cacheInfo.name), search: location.search }}
>
{cacheDetailAccess}
</Link>
Expand Down Expand Up @@ -517,7 +517,8 @@ const CacheTableDisplay = (props: { cmName: string; setCachesCount: (count: numb
<ToolbarItem style={{ marginRight: global_spacer_sm.value }}>
<Link
to={{
pathname: '/container/caches/create'
pathname: '/container/caches/create',
search: location.search
}}
>
<Button variant={ButtonVariant.primary} aria-label="create-cache-button" data-cy="createCacheButton">
Expand All @@ -534,6 +535,7 @@ const CacheTableDisplay = (props: { cmName: string; setCachesCount: (count: numb
<Link
to={{
pathname: '/container/' + props.cmName + '/configurations/',
search: location.search,
state: {
cmName: props.cmName
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/CacheManagers/CounterTableDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ const CounterTableDisplay = (props: { setCountersCount: (number) => void; isVisi
<React.Fragment>
<ToolbarItem variant={ToolbarItemVariant.separator}></ToolbarItem>
<ToolbarItem>
<Button onClick={() => setIsCreateCounter(!isCreateCounter)} data-cy='createCounterButton'>
<Button onClick={() => setIsCreateCounter(!isCreateCounter)} data-cy="createCounterButton">
{t('cache-managers.counters.modal-create-title')}
</Button>
</ToolbarItem>
Expand Down
4 changes: 2 additions & 2 deletions src/app/Caches/Create/CreateCacheWizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const CreateCacheWizard = (props: { cacheManager: CacheManager; create: boolean
const history = useHistory();

const closeWizard = () => {
history.push('/');
history.push('/' + history.location.search);
};

useEffect(() => {
Expand Down Expand Up @@ -366,7 +366,7 @@ const CreateCacheWizard = (props: { cacheManager: CacheManager; create: boolean
createCacheCall
.then((actionResponse) => {
if (actionResponse.success) {
history.push('/');
history.push('/' + history.location.search);
}
return actionResponse;
})
Expand Down
3 changes: 2 additions & 1 deletion src/app/Caches/DataAccessChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ const DataAccessChart = (props: { stats: CacheStats }) => {
</CardTitle>
<CardBody>
<div style={{ width: '100%', height: '480px' }}>
<ChartDonut data-cy='data-access-chart'
<ChartDonut
data-cy="data-access-chart"
width={600}
height={400}
constrainToVisibleArea={true}
Expand Down
3 changes: 2 additions & 1 deletion src/app/Caches/DataDistributionChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ const DataDistributionChart = (props: { cacheName: string }) => {
ariaDesc={t('caches.cache-metrics.data-distribution')}
ariaTitle={t('caches.cache-metrics.data-distribution')}
containerComponent={
<ChartVoronoiContainer data-cy='data-distribution-chart'
<ChartVoronoiContainer
data-cy="data-distribution-chart"
labels={({ datum }) =>
datum.y !== 0
? `${datum.y}`
Expand Down
9 changes: 6 additions & 3 deletions src/app/Caches/DetailCache.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ const DetailCache = (props: { cacheName: string }) => {
<EmptyStatePrimary>
<Link
to={{
pathname: '/'
pathname: '/',
search: location.search
}}
>
<Button variant={ButtonVariant.secondary}>Back</Button>
Expand Down Expand Up @@ -214,7 +215,8 @@ const DetailCache = (props: { cacheName: string }) => {
<ToolbarItem>
<Link
to={{
pathname: encodeURIComponent(cacheName) + '/backups'
pathname: encodeURIComponent(cacheName) + '/backups',
search: location.search
}}
>
<Button variant={ButtonVariant.link}>Manage</Button>
Expand Down Expand Up @@ -254,7 +256,8 @@ const DetailCache = (props: { cacheName: string }) => {
<FlexItem>
<Link
to={{
pathname: encodeURIComponent(cacheName) + '/indexing'
pathname: encodeURIComponent(cacheName) + '/indexing',
search: location.search
}}
>
<Button data-cy="manageIndexesLink" variant={ButtonVariant.link}>
Expand Down
4 changes: 2 additions & 2 deletions src/app/Caches/Query/ClearQueryMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ const ClearQueryMetrics = (props: { cacheName: string; isModalOpen: boolean; clo
onClose={props.closeModal}
aria-label={t('caches.query.modal-clear-query-stats-label')}
actions={[
<Button data-cy='confirmButton' key="confirm" variant={ButtonVariant.danger} onClick={onClickDeleteButton}>
<Button data-cy="confirmButton" key="confirm" variant={ButtonVariant.danger} onClick={onClickDeleteButton}>
{t('caches.query.modal-button-query-clear-stats')}
</Button>,
<Button data-cy='cancelButton' key="cancel" variant="link" onClick={props.closeModal}>
<Button data-cy="cancelButton" key="cancel" variant="link" onClick={props.closeModal}>
{t('caches.query.modal-button-cancel')}
</Button>
]}
Expand Down
6 changes: 5 additions & 1 deletion src/app/Caches/Query/QueryMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ const QueryMetrics = (props: { cacheName: string }) => {

return (
<LevelItem>
<Button data-cy='clearQueryMetricsButton' variant={ButtonVariant.danger} onClick={() => setClearMetricsModalOpen(true)}>
<Button
data-cy="clearQueryMetricsButton"
variant={ButtonVariant.danger}
onClick={() => setClearMetricsModalOpen(true)}
>
{t('caches.query.button-clear-query-stats')}
</Button>
<ClearQueryMetrics
Expand Down