Add CCR client integration test that asserts that the UI consumes the expected API when editing a follower index (#64440)
This commit is contained in:
parent
9e8809b117
commit
84aef3995e
1 changed files with 49 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* you may not use this file except in compliance with the Elastic License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { API_BASE_PATH } from '../../../common/constants';
|
||||||
import { FollowerIndexForm } from '../../app/components/follower_index_form/follower_index_form';
|
import { FollowerIndexForm } from '../../app/components/follower_index_form/follower_index_form';
|
||||||
import './mocks';
|
import './mocks';
|
||||||
import { FOLLOWER_INDEX_EDIT } from './helpers/constants';
|
import { FOLLOWER_INDEX_EDIT } from './helpers/constants';
|
||||||
|
@ -12,7 +13,7 @@ import { setupEnvironment, pageHelpers, nextTick } from './helpers';
|
||||||
const { setup } = pageHelpers.followerIndexEdit;
|
const { setup } = pageHelpers.followerIndexEdit;
|
||||||
const { setup: setupFollowerIndexAdd } = pageHelpers.followerIndexAdd;
|
const { setup: setupFollowerIndexAdd } = pageHelpers.followerIndexAdd;
|
||||||
|
|
||||||
describe('Edit Auto-follow pattern', () => {
|
describe('Edit follower index', () => {
|
||||||
let server;
|
let server;
|
||||||
let httpRequestsMockHelpers;
|
let httpRequestsMockHelpers;
|
||||||
|
|
||||||
|
@ -88,6 +89,53 @@ describe('Edit Auto-follow pattern', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('API', () => {
|
||||||
|
const remoteClusters = [{ name: 'new-york', seeds: ['localhost:123'], isConnected: true }];
|
||||||
|
let testBed;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
httpRequestsMockHelpers.setLoadRemoteClustersResponse(remoteClusters);
|
||||||
|
httpRequestsMockHelpers.setGetFollowerIndexResponse(FOLLOWER_INDEX_EDIT);
|
||||||
|
|
||||||
|
testBed = await setup();
|
||||||
|
await testBed.waitFor('followerIndexForm');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('is consumed correctly', async () => {
|
||||||
|
const { actions, form, component, find, waitFor } = testBed;
|
||||||
|
|
||||||
|
form.setInputValue('maxRetryDelayInput', '10s');
|
||||||
|
|
||||||
|
actions.clickSaveForm();
|
||||||
|
component.update(); // The modal to confirm the update opens
|
||||||
|
await waitFor('confirmModalTitleText');
|
||||||
|
find('confirmModalConfirmButton').simulate('click');
|
||||||
|
|
||||||
|
await nextTick(); // Make sure the Request went through
|
||||||
|
|
||||||
|
const latestRequest = server.requests[server.requests.length - 1];
|
||||||
|
const requestBody = JSON.parse(JSON.parse(latestRequest.requestBody).body);
|
||||||
|
|
||||||
|
// Verify the API endpoint called: method, path and payload
|
||||||
|
expect(latestRequest.method).toBe('PUT');
|
||||||
|
expect(latestRequest.url).toBe(
|
||||||
|
`${API_BASE_PATH}/follower_indices/${FOLLOWER_INDEX_EDIT.name}`
|
||||||
|
);
|
||||||
|
expect(requestBody).toEqual({
|
||||||
|
maxReadRequestOperationCount: 7845,
|
||||||
|
maxOutstandingReadRequests: 16,
|
||||||
|
maxReadRequestSize: '64mb',
|
||||||
|
maxWriteRequestOperationCount: 2456,
|
||||||
|
maxWriteRequestSize: '1048b',
|
||||||
|
maxOutstandingWriteRequests: 69,
|
||||||
|
maxWriteBufferCount: 123456,
|
||||||
|
maxWriteBufferSize: '256mb',
|
||||||
|
maxRetryDelay: '10s',
|
||||||
|
readPollTimeout: '2m',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('when the remote cluster is disconnected', () => {
|
describe('when the remote cluster is disconnected', () => {
|
||||||
let find;
|
let find;
|
||||||
let exists;
|
let exists;
|
||||||
|
|
Loading…
Reference in a new issue