Skip to content

Commit

Permalink
Merge branch 'i/88107' of github.com:szabosteve/kibana into i/88107
Browse files Browse the repository at this point in the history
  • Loading branch information
szabosteve committed Jan 20, 2021
2 parents 933f797 + 4acd606 commit 9f98ea9
Show file tree
Hide file tree
Showing 80 changed files with 873 additions and 491 deletions.
2 changes: 2 additions & 0 deletions .ci/es-snapshots/Jenkinsfile_verify_es
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ kibanaPipeline(timeoutMinutes: 150) {
'xpack-ciGroup9': kibanaPipeline.xpackCiGroupProcess(9),
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
'xpack-ciGroup11': kibanaPipeline.xpackCiGroupProcess(11),
'xpack-ciGroup12': kibanaPipeline.xpackCiGroupProcess(12),
'xpack-ciGroup13': kibanaPipeline.xpackCiGroupProcess(13),
]),
])
}
Expand Down
2 changes: 2 additions & 0 deletions .ci/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ JOB:
- x-pack-ciGroup9
- x-pack-ciGroup10
- x-pack-ciGroup11
- x-pack-ciGroup12
- x-pack-ciGroup13
- x-pack-accessibility
- x-pack-visualRegression

Expand Down
6 changes: 6 additions & 0 deletions src/plugins/telemetry/server/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,19 @@ export class FetcherTask {
updateTelemetrySavedObject(this.internalRepository!, {
reportFailureCount: 0,
lastReported: this.lastReported,
}).catch((err) => {
err.message = `Failed to update the telemetry saved object: ${err.message}`;
this.logger.debug(err);
});
}

private async updateReportFailure({ failureCount }: { failureCount: number }) {
updateTelemetrySavedObject(this.internalRepository!, {
reportFailureCount: failureCount + 1,
reportFailureVersion: this.currentKibanaVersion,
}).catch((err) => {
err.message = `Failed to update the telemetry saved object: ${err.message}`;
this.logger.debug(err);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
* Public License, v 1.
*/

export default function ({ loadTestFile }) {
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('home apis', () => {
loadTestFile(require.resolve('./sample_data'));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService }) {
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const es = getService('legacyEs');
const es = getService('es');

const MILLISECOND_IN_WEEK = 1000 * 60 * 60 * 24 * 7;

Expand Down Expand Up @@ -43,7 +44,7 @@ export default function ({ getService }) {
});

it('should load elasticsearch index containing sample data with dates relative to current time', async () => {
const resp = await es.search({
const { body: resp } = await es.search({
index: 'kibana_sample_data_flights',
});

Expand All @@ -61,7 +62,7 @@ export default function ({ getService }) {
.post(`/api/sample_data/flights?now=${nowString}`)
.set('kbn-xsrf', 'kibana');

const resp = await es.search({
const { body: resp } = await es.search({
index: 'kibana_sample_data_flights',
});

Expand All @@ -80,7 +81,7 @@ export default function ({ getService }) {
});

it('should remove elasticsearch index containing sample data', async () => {
const resp = await es.indices.exists({
const { body: resp } = await es.indices.exists({
index: 'kibana_sample_data_flights',
});
expect(resp).to.be(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
* Public License, v 1.
*/

export default function ({ loadTestFile }) {
import { FtrProviderContext } from '../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('apis', () => {
loadTestFile(require.resolve('./core'));
loadTestFile(require.resolve('./general'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
* Public License, v 1.
*/

export default function ({ loadTestFile }) {
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('KQL', () => {
loadTestFile(require.resolve('./kql_telemetry'));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
import expect from '@kbn/expect';
import Bluebird from 'bluebird';
import { get } from 'lodash';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService }) {
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');
const es = getService('legacyEs');
const es = getService('es');

describe('telemetry API', () => {
before(() => esArchiver.load('saved_objects/basic'));
Expand All @@ -31,7 +32,7 @@ export default function ({ getService }) {
index: '.kibana',
q: 'type:kql-telemetry',
})
.then((response) => {
.then(({ body: response }) => {
const kqlTelemetryDoc = get(response, 'hits.hits[0]._source.kql-telemetry');
expect(kqlTelemetryDoc.optInCount).to.be(1);
});
Expand All @@ -49,7 +50,7 @@ export default function ({ getService }) {
index: '.kibana',
q: 'type:kql-telemetry',
})
.then((response) => {
.then(({ body: response }) => {
const kqlTelemetryDoc = get(response, 'hits.hits[0]._source.kql-telemetry');
expect(kqlTelemetryDoc.optOutCount).to.be(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService }) {
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const es = getService('legacyEs');
const es = getService('es');
const esArchiver = getService('esArchiver');

const BULK_REQUESTS = [
Expand Down Expand Up @@ -74,11 +75,10 @@ export default function ({ getService }) {
it('should not return raw id when object id is unspecified', async () =>
await supertest
.post(`/api/saved_objects/_bulk_create`)
// eslint-disable-next-line no-unused-vars
.send(BULK_REQUESTS.map(({ id, ...rest }) => rest))
.expect(200)
.then((resp) => {
resp.body.saved_objects.map(({ id }) =>
resp.body.saved_objects.map(({ id }: { id: string }) =>
expect(id).not.match(/visualization|dashboard/)
);
}));
Expand All @@ -88,10 +88,7 @@ export default function ({ getService }) {
before(
async () =>
// just in case the kibana server has recreated it
await es.indices.delete({
index: '.kibana',
ignore: [404],
})
await es.indices.delete({ index: '.kibana' }, { ignore: [404] })
);

it('should return 200 with individual responses', async () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService }) {
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const es = getService('legacyEs');
const es = getService('es');
const esArchiver = getService('esArchiver');

const BULK_REQUESTS = [
Expand Down Expand Up @@ -98,10 +99,7 @@ export default function ({ getService }) {
before(
async () =>
// just in case the kibana server has recreated it
await es.indices.delete({
index: '.kibana',
ignore: [404],
})
await es.indices.delete({ index: '.kibana' }, { ignore: [404] })
);

it('should return 200 with individual responses', async () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

import expect from '@kbn/expect';
import _ from 'lodash';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService }) {
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const es = getService('legacyEs');
const es = getService('es');
const esArchiver = getService('esArchiver');

describe('bulkUpdate', () => {
Expand Down Expand Up @@ -234,10 +235,7 @@ export default function ({ getService }) {
before(
async () =>
// just in case the kibana server has recreated it
await es.indices.delete({
index: '.kibana',
ignore: [404],
})
await es.indices.delete({ index: '.kibana' }, { ignore: [404] })
);

it('should return generic 404', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService }) {
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const es = getService('legacyEs');
const es = getService('es');
const esArchiver = getService('esArchiver');

describe('create', () => {
Expand Down Expand Up @@ -58,10 +59,7 @@ export default function ({ getService }) {
before(
async () =>
// just in case the kibana server has recreated it
await es.indices.delete({
index: '.kibana',
ignore: [404],
})
await es.indices.delete({ index: '.kibana' }, { ignore: [404] })
);

it('should return 200 and create kibana index', async () => {
Expand Down Expand Up @@ -99,7 +97,7 @@ export default function ({ getService }) {
expect(resp.body.migrationVersion).to.be.ok();
});

expect(await es.indices.exists({ index: '.kibana' })).to.be(true);
expect((await es.indices.exists({ index: '.kibana' })).body).to.be(true);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService }) {
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const es = getService('legacyEs');
const es = getService('es');
const esArchiver = getService('esArchiver');

describe('delete', () => {
Expand Down Expand Up @@ -43,10 +44,7 @@ export default function ({ getService }) {
before(
async () =>
// just in case the kibana server has recreated it
await es.indices.delete({
index: '.kibana',
ignore: [404],
})
await es.indices.delete({ index: '.kibana' }, { ignore: [404] })
);

it('returns generic 404 when kibana index is missing', async () =>
Expand Down
7 changes: 2 additions & 5 deletions test/api_integration/apis/saved_objects/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function ndjsonToObject(input: string) {
}
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const es = getService('legacyEs');
const es = getService('es');
const esArchiver = getService('esArchiver');

describe('export', () => {
Expand Down Expand Up @@ -524,10 +524,7 @@ export default function ({ getService }: FtrProviderContext) {
before(
async () =>
// just in case the kibana server has recreated it
await es.indices.delete({
index: '.kibana',
ignore: [404],
})
await es.indices.delete({ index: '.kibana' }, { ignore: [404] })
);

it('should return empty response', async () => {
Expand Down
Loading

0 comments on commit 9f98ea9

Please sign in to comment.