mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
migrate integration tests to the new es client (#107130)
* migrate integration tests to the new es client * error field does not exist on result Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
561b89889f
commit
7aef1be90d
2 changed files with 11 additions and 11 deletions
|
@ -12,7 +12,7 @@ import { MetricExpressionParams } from '../../../../plugins/infra/server/lib/ale
|
|||
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
export default function ({ getService }: FtrProviderContext) {
|
||||
const client = getService('legacyEs');
|
||||
const client = getService('es');
|
||||
const index = 'test-index';
|
||||
const getSearchParams = (aggType: string) =>
|
||||
({
|
||||
|
@ -42,11 +42,11 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
'@timestamp',
|
||||
timeframe
|
||||
);
|
||||
const result = await client.search({
|
||||
const { body: result } = await client.search({
|
||||
index,
|
||||
body: searchBody,
|
||||
});
|
||||
expect(result.error).to.not.be.ok();
|
||||
|
||||
expect(result.hits).to.be.ok();
|
||||
expect(result.aggregations).to.be.ok();
|
||||
});
|
||||
|
@ -63,11 +63,11 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
undefined,
|
||||
'{"bool":{"should":[{"match_phrase":{"agent.hostname":"foo"}}],"minimum_should_match":1}}'
|
||||
);
|
||||
const result = await client.search({
|
||||
const { body: result } = await client.search({
|
||||
index,
|
||||
body: searchBody,
|
||||
});
|
||||
expect(result.error).to.not.be.ok();
|
||||
|
||||
expect(result.hits).to.be.ok();
|
||||
expect(result.aggregations).to.be.ok();
|
||||
});
|
||||
|
@ -85,11 +85,11 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
timeframe,
|
||||
'agent.id'
|
||||
);
|
||||
const result = await client.search({
|
||||
const { body: result } = await client.search({
|
||||
index,
|
||||
body: searchBody,
|
||||
});
|
||||
expect(result.error).to.not.be.ok();
|
||||
|
||||
expect(result.hits).to.be.ok();
|
||||
expect(result.aggregations).to.be.ok();
|
||||
});
|
||||
|
@ -106,11 +106,11 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
'agent.id',
|
||||
'{"bool":{"should":[{"match_phrase":{"agent.hostname":"foo"}}],"minimum_should_match":1}}'
|
||||
);
|
||||
const result = await client.search({
|
||||
const { body: result } = await client.search({
|
||||
index,
|
||||
body: searchBody,
|
||||
});
|
||||
expect(result.error).to.not.be.ok();
|
||||
|
||||
expect(result.hits).to.be.ok();
|
||||
expect(result.aggregations).to.be.ok();
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ import * as beatsMetrics from '../../../../../plugins/monitoring/server/lib/metr
|
|||
import * as apmMetrics from '../../../../../plugins/monitoring/server/lib/metrics/apm/metrics';
|
||||
|
||||
export default function ({ getService }) {
|
||||
const es = getService('legacyEs');
|
||||
const es = getService('es');
|
||||
|
||||
const metricSets = [
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ export default function ({ getService }) {
|
|||
let mappings;
|
||||
|
||||
before('load mappings', async () => {
|
||||
const template = await es.indices.getTemplate({ name: indexTemplate });
|
||||
const { body: template } = await es.indices.getTemplate({ name: indexTemplate });
|
||||
mappings = get(template, [indexTemplate, 'mappings', 'properties']);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue