mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Index Patterns] Migrate tests to the new es client (#100760)
This commit is contained in:
parent
1c4d338668
commit
806566c62e
7 changed files with 16 additions and 20 deletions
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { errors as esErrors } from 'elasticsearch';
|
||||
import { errors as esErrors } from '@elastic/elasticsearch';
|
||||
import Boom from '@hapi/boom';
|
||||
|
||||
import {
|
||||
|
@ -20,7 +20,7 @@ import {
|
|||
import { getIndexNotFoundError, getDocNotFoundError } from './lib';
|
||||
|
||||
export default function ({ getService }) {
|
||||
const es = getService('legacyEs');
|
||||
const es = getService('es');
|
||||
const esArchiver = getService('esArchiver');
|
||||
|
||||
describe('index_patterns/* error handler', () => {
|
||||
|
@ -98,8 +98,8 @@ export default function ({ getService }) {
|
|||
});
|
||||
|
||||
it('wraps other errors in Boom', async () => {
|
||||
const error = new esErrors.AuthenticationException(
|
||||
{
|
||||
const error = new esErrors.ResponseError({
|
||||
body: {
|
||||
root_cause: [
|
||||
{
|
||||
type: 'security_exception',
|
||||
|
@ -109,10 +109,8 @@ export default function ({ getService }) {
|
|||
type: 'security_exception',
|
||||
reason: 'action [indices:data/read/field_caps] is unauthorized for user [standard]',
|
||||
},
|
||||
{
|
||||
statusCode: 403,
|
||||
}
|
||||
);
|
||||
statusCode: 403,
|
||||
});
|
||||
|
||||
expect(error).to.not.have.property('isBoom');
|
||||
const converted = convertEsError(indices, error);
|
||||
|
|
|
@ -14,7 +14,7 @@ export async function getIndexNotFoundError(es) {
|
|||
index: 'SHOULD NOT EXIST',
|
||||
});
|
||||
} catch (err) {
|
||||
expect(err).to.have.property('status', 404); // sanity check
|
||||
expect(err).to.have.property('statusCode', 404); // sanity check
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ export async function getDocNotFoundError(es) {
|
|||
id: '1234',
|
||||
});
|
||||
} catch (err) {
|
||||
expect(err).to.have.property('status', 404); // sanity check
|
||||
expect(err).to.have.property('statusCode', 404); // sanity check
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import expect from '@kbn/expect';
|
|||
export default function ({ getService, getPageObjects }) {
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const es = getService('legacyEs');
|
||||
const es = getService('es');
|
||||
const PageObjects = getPageObjects(['settings', 'common', 'header']);
|
||||
const security = getService('security');
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import expect from '@kbn/expect';
|
|||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const es = getService('legacyEs');
|
||||
const es = getService('es');
|
||||
const retry = getService('retry');
|
||||
const security = getService('security');
|
||||
const PageObjects = getPageObjects(['common', 'home', 'settings', 'discover', 'timePicker']);
|
||||
|
|
|
@ -21,7 +21,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const testSubjects = getService('testSubjects');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const browser = getService('browser');
|
||||
const es = getService('legacyEs');
|
||||
const es = getService('es');
|
||||
const retry = getService('retry');
|
||||
const scriptedFiledName = 'versionConflictScript';
|
||||
const PageObjects = getPageObjects(['common', 'home', 'settings', 'discover', 'header']);
|
||||
|
@ -49,7 +49,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
},
|
||||
});
|
||||
log.debug(JSON.stringify(response));
|
||||
expect(response.result).to.be('updated');
|
||||
expect(response.body.result).to.be('updated');
|
||||
await PageObjects.settings.setFieldFormat('url');
|
||||
await PageObjects.settings.clickSaveScriptedField();
|
||||
await retry.try(async function () {
|
||||
|
@ -80,7 +80,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
},
|
||||
});
|
||||
log.debug(JSON.stringify(response));
|
||||
expect(response.result).to.be('updated');
|
||||
expect(response.body.result).to.be('updated');
|
||||
await PageObjects.settings.controlChangeSave();
|
||||
await retry.try(async function () {
|
||||
//await PageObjects.common.sleep(2000);
|
||||
|
|
|
@ -15,7 +15,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
const PageObjects = getPageObjects(['common', 'settings']);
|
||||
const testSubjects = getService('testSubjects');
|
||||
const globalNav = getService('globalNav');
|
||||
const es = getService('legacyEs');
|
||||
const es = getService('es');
|
||||
|
||||
describe('index pattern empty view', () => {
|
||||
before(async () => {
|
||||
|
@ -28,7 +28,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
after(async () => {
|
||||
await esArchiver.loadIfNeeded('makelogs');
|
||||
// @ts-expect-error
|
||||
await es.transport.request({
|
||||
path: '/logstash-a',
|
||||
method: 'DELETE',
|
||||
|
@ -42,14 +41,13 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
`\n\nNOTE: If this test fails make sure there aren't any non-system indices in the _cat/indices output (use esArchiver.unload on them)`
|
||||
);
|
||||
log.debug(
|
||||
// @ts-expect-error
|
||||
await es.transport.request({
|
||||
path: '/_cat/indices',
|
||||
method: 'GET',
|
||||
})
|
||||
);
|
||||
await testSubjects.existOrFail('createAnyway');
|
||||
// @ts-expect-error
|
||||
|
||||
await es.transport.request({
|
||||
path: '/logstash-a/_doc',
|
||||
method: 'POST',
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const es = getService('legacyEs');
|
||||
const es = getService('es');
|
||||
const PageObjects = getPageObjects(['settings', 'common']);
|
||||
|
||||
describe('"Create Index Pattern" wizard', function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue