From b794e7b7ca567e8f51955416d2cae1ffd9766981 Mon Sep 17 00:00:00 2001 From: Tim Sullivan Date: Tue, 6 Jul 2021 12:01:27 -0700 Subject: [PATCH] [Reporting] Add warning logs about CSV export type being deprecated (#104025) * add deprecation logging to csv export type * fix payload.isDeprecated Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- x-pack/plugins/reporting/common/types.ts | 2 + .../server/export_types/csv/create_job.ts | 4 + .../reporting/server/routes/lib/jobs_query.ts | 6 +- x-pack/plugins/reporting/server/types.ts | 1 + .../reporting_without_security/index.ts | 3 +- .../reporting_without_security/job_apis.ts | 119 -------- .../job_apis_csv.ts | 256 ++++++++++++++++++ .../job_apis_csv_deprecated.ts | 207 ++++++++++++++ 8 files changed, 476 insertions(+), 122 deletions(-) delete mode 100644 x-pack/test/reporting_api_integration/reporting_without_security/job_apis.ts create mode 100644 x-pack/test/reporting_api_integration/reporting_without_security/job_apis_csv.ts create mode 100644 x-pack/test/reporting_api_integration/reporting_without_security/job_apis_csv_deprecated.ts diff --git a/x-pack/plugins/reporting/common/types.ts b/x-pack/plugins/reporting/common/types.ts index 6efaf42a5ad14..193f3f2a971ea 100644 --- a/x-pack/plugins/reporting/common/types.ts +++ b/x-pack/plugins/reporting/common/types.ts @@ -65,6 +65,7 @@ export interface ReportSource { objectType: string; title: string; layout?: LayoutParams; + isDeprecated?: boolean; }; meta: { objectType: string; layout?: string }; browser_type: string; @@ -128,6 +129,7 @@ export interface ReportApiJSON { layout?: LayoutParams; title: string; browserTimezone?: string; + isDeprecated?: boolean; }; meta: { layout?: string; diff --git a/x-pack/plugins/reporting/server/export_types/csv/create_job.ts b/x-pack/plugins/reporting/server/export_types/csv/create_job.ts index 876d190c9eee8..56d6facea9212 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/create_job.ts +++ b/x-pack/plugins/reporting/server/export_types/csv/create_job.ts @@ -20,6 +20,9 @@ export const createJobFnFactory: CreateJobFnFactory< const crypto = cryptoFactory(config.get('encryptionKey')); return async function createJob(jobParams, context, request) { + logger.warn( + `The "/generate/csv" endpoint is deprecated and will be removed in Kibana 8.0. Please recreate the POST URL used to automate this CSV export.` + ); const serializedEncryptedHeaders = await crypto.encrypt(request.headers); const savedObjectsClient = context.core.savedObjects.client; @@ -29,6 +32,7 @@ export const createJobFnFactory: CreateJobFnFactory< )) as unknown) as IndexPatternSavedObjectDeprecatedCSV; return { + isDeprecated: true, headers: serializedEncryptedHeaders, spaceId: reporting.getSpaceId(request, logger), indexPatternSavedObject, diff --git a/x-pack/plugins/reporting/server/routes/lib/jobs_query.ts b/x-pack/plugins/reporting/server/routes/lib/jobs_query.ts index 1db62f818216a..2fec34470ff1f 100644 --- a/x-pack/plugins/reporting/server/routes/lib/jobs_query.ts +++ b/x-pack/plugins/reporting/server/routes/lib/jobs_query.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { UnwrapPromise } from '@kbn/utility-types'; -import { i18n } from '@kbn/i18n'; import { ResponseError } from '@elastic/elasticsearch/lib/errors'; +import { i18n } from '@kbn/i18n'; +import { UnwrapPromise } from '@kbn/utility-types'; import { ElasticsearchClient } from 'src/core/server'; import { ReportingCore } from '../../'; import { ReportDocument } from '../../lib/store'; @@ -87,6 +87,7 @@ export function jobsQueryFactory(reportingCore: ReportingCore) { elasticsearchClient.search({ body, index: getIndex() }) ); + // FIXME: return the info in ReportApiJSON format; return response?.body.hits?.hits ?? []; }, @@ -139,6 +140,7 @@ export function jobsQueryFactory(reportingCore: ReportingCore) { return; } + // FIXME: return the info in ReportApiJSON format; return response.body.hits.hits[0] as ReportDocument; }, diff --git a/x-pack/plugins/reporting/server/types.ts b/x-pack/plugins/reporting/server/types.ts index 7df1dce597d56..da228b09f79d2 100644 --- a/x-pack/plugins/reporting/server/types.ts +++ b/x-pack/plugins/reporting/server/types.ts @@ -62,6 +62,7 @@ export { BaseParams }; export interface BasePayload extends BaseParams { headers: string; spaceId?: string; + isDeprecated?: boolean; } // default fn type for CreateJobFnFactory diff --git a/x-pack/test/reporting_api_integration/reporting_without_security/index.ts b/x-pack/test/reporting_api_integration/reporting_without_security/index.ts index fed842427ab90..5d3854a17e6e6 100644 --- a/x-pack/test/reporting_api_integration/reporting_without_security/index.ts +++ b/x-pack/test/reporting_api_integration/reporting_without_security/index.ts @@ -11,7 +11,8 @@ import { FtrProviderContext } from '../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('Reporting API Integration Tests with Security disabled', function () { this.tags('ciGroup13'); - loadTestFile(require.resolve('./job_apis')); + loadTestFile(require.resolve('./job_apis_csv')); + loadTestFile(require.resolve('./job_apis_csv_deprecated')); loadTestFile(require.resolve('./ilm_migration_apis')); }); } diff --git a/x-pack/test/reporting_api_integration/reporting_without_security/job_apis.ts b/x-pack/test/reporting_api_integration/reporting_without_security/job_apis.ts deleted file mode 100644 index 4c64176dacc8b..0000000000000 --- a/x-pack/test/reporting_api_integration/reporting_without_security/job_apis.ts +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import expect from '@kbn/expect'; -import { forOwn } from 'lodash'; -import { JOB_PARAMS_RISON_CSV_DEPRECATED } from '../services/fixtures'; -import { FtrProviderContext } from '../ftr_provider_context'; - -// eslint-disable-next-line import/no-default-export -export default function ({ getService }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); - const supertestNoAuth = getService('supertestWithoutAuth'); - const reportingAPI = getService('reportingAPI'); - - describe('Job Listing APIs', () => { - before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/reporting/logs'); - await esArchiver.load('x-pack/test/functional/es_archives/logstash_functional'); - }); - - after(async () => { - await esArchiver.unload('x-pack/test/functional/es_archives/reporting/logs'); - await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); - }); - - afterEach(async () => { - await reportingAPI.deleteAllReports(); - }); - - it('Posted CSV job is visible in the job count', async () => { - const { status: resStatus, text: resText } = await supertestNoAuth - .post(`/api/reporting/generate/csv`) - .set('kbn-xsrf', 'xxx') - .send({ jobParams: JOB_PARAMS_RISON_CSV_DEPRECATED }); - - expect(resStatus).to.be(200); - - const { job: resJob } = JSON.parse(resText); - const expectedResJob: Record = { - attempts: 0, - created_by: false, - jobtype: 'csv', - status: 'pending', - }; - forOwn(expectedResJob, (value: any, key: string) => { - expect(resJob[key]).to.eql(value, key); - }); - - // call the job count api - const { text: countText } = await supertestNoAuth - .get(`/api/reporting/jobs/count`) - .set('kbn-xsrf', 'xxx'); - - const countResult = JSON.parse(countText); - expect(countResult).to.be(1); - }); - - it('Posted CSV job is visible in the status check', async () => { - const { status: resStatus, text: resText } = await supertestNoAuth - .post(`/api/reporting/generate/csv`) - .set('kbn-xsrf', 'xxx') - .send({ jobParams: JOB_PARAMS_RISON_CSV_DEPRECATED }); - - expect(resStatus).to.be(200); - - const { job: resJob } = JSON.parse(resText); - // call the single job listing api (status check) - const { text: listText } = await supertestNoAuth - .get(`/api/reporting/jobs/list?page=0&ids=${resJob.id}`) - .set('kbn-xsrf', 'xxx'); - - const listingJobs = JSON.parse(listText); - - const expectedListJob: Record = { - attempts: 0, - created_by: false, - jobtype: 'csv', - }; - forOwn(expectedListJob, (value: any, key: string) => { - expect(listingJobs[0]._source[key]).to.eql(value, key); - }); - - expect(listingJobs.length).to.be(1); - expect(listingJobs[0]._id).to.be(resJob.id); - }); - - it('Posted CSV job is visible in the first page of jobs listing', async () => { - const { status: resStatus, text: resText } = await supertestNoAuth - .post(`/api/reporting/generate/csv`) - .set('kbn-xsrf', 'xxx') - .send({ jobParams: JOB_PARAMS_RISON_CSV_DEPRECATED }); - - expect(resStatus).to.be(200); - - const { job: resJob } = JSON.parse(resText); - // call the ALL job listing api - const { text: listText } = await supertestNoAuth - .get(`/api/reporting/jobs/list?page=0`) - .set('kbn-xsrf', 'xxx'); - - const listingJobs = JSON.parse(listText); - const expectedListJob: Record = { - attempts: 0, - created_by: false, - jobtype: 'csv', - }; - forOwn(expectedListJob, (value: any, key: string) => { - expect(listingJobs[0]._source[key]).to.eql(value, key); - }); - - expect(listingJobs.length).to.be(1); - expect(listingJobs[0]._id).to.be(resJob.id); - }); - }); -} diff --git a/x-pack/test/reporting_api_integration/reporting_without_security/job_apis_csv.ts b/x-pack/test/reporting_api_integration/reporting_without_security/job_apis_csv.ts new file mode 100644 index 0000000000000..577afb200d4a1 --- /dev/null +++ b/x-pack/test/reporting_api_integration/reporting_without_security/job_apis_csv.ts @@ -0,0 +1,256 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import { pick } from 'lodash'; +import { + ReportApiJSON, + ReportDocument, + ReportSource, +} from '../../../plugins/reporting/common/types'; +import { FtrProviderContext } from '../ftr_provider_context'; + +const apiResponseFields = [ + 'attempts', + 'created_by', + 'jobtype', + 'max_attempts', + 'meta', + 'payload.isDeprecated', + 'payload.title', + 'payload.type', + 'status', +]; + +// TODO: clean up the /list and /info endpoints to return ReportApiJSON interface data +const documentResponseFields = [ + '_source.attempts', + '_source.created_by', + '_source.jobtype', + '_source.max_attempts', + '_source.meta', + '_source.payload.isDeprecated', + '_source.payload.title', + '_source.payload.type', + '_source.status', +]; + +// eslint-disable-next-line import/no-default-export +export default function ({ getService }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const supertestNoAuth = getService('supertestWithoutAuth'); + const reportingAPI = getService('reportingAPI'); + + const postJobCSV = async () => { + const jobParams = + `(browserTimezone:UTC,columns:!('@timestamp',clientip,extension),` + + `objectType:search,searchSource:(fields:!((field:'*',include_unmapped:true)),filter:!((meta:(index:'logstash-*',params:()),` + + `range:('@timestamp':(format:strict_date_optional_time,gte:'2006-06-21T22:00:57.631Z',lte:'2021-06-21T22:00:57.631Z')))),` + + `index:'logstash-*',parent:(filter:!(('$state':(store:appState),meta:(alias:datefilter🥜,disabled:!f,index:'logstash-*',` + + `key:'@timestamp',negate:!f,params:(gte:'2015-09-20T10:19:40.307Z',lt:'2015-09-20T10:26:56.221Z'),type:range),` + + `range:('@timestamp':(gte:'2015-09-20T10:19:40.307Z',lt:'2015-09-20T10:26:56.221Z')))),highlightAll:!t,index:'logstash-*',` + + `query:(language:kuery,query:''),version:!t),sort:!(('@timestamp':desc)),trackTotalHits:!t,version:!t),title:'A Saved Search With a DATE FILTER')`; + const { status: resStatus, text: resText } = await supertestNoAuth + .post(`/api/reporting/generate/csv_searchsource?jobParams=${encodeURI(jobParams)}`) + .set('kbn-xsrf', 'xxx'); + expect(resStatus).to.be(200); + + const result: { job: ReportApiJSON; path: string } = JSON.parse(resText); + expect(result.job.payload.isDeprecated).to.not.be(true); + + return result; + }; + + describe('Job Listing APIs', () => { + before(async () => { + await esArchiver.load('x-pack/test/functional/es_archives/reporting/logs'); + await esArchiver.load('x-pack/test/functional/es_archives/logstash_functional'); + }); + + after(async () => { + await esArchiver.unload('x-pack/test/functional/es_archives/reporting/logs'); + await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); + }); + + afterEach(async () => { + await reportingAPI.deleteAllReports(); + }); + + it('Posted CSV job is visible in the job count', async () => { + const { job, path }: { job: ReportApiJSON; path: string } = await postJobCSV(); + expectSnapshot(pick(job, apiResponseFields)).toMatchInline(` + Object { + "attempts": 0, + "created_by": false, + "jobtype": "csv_searchsource", + "max_attempts": 1, + "meta": Object { + "objectType": "search", + }, + "payload": Object { + "title": "A Saved Search With a DATE FILTER", + }, + "status": "pending", + } + `); + + // call the job count api + const { text: countText } = await supertestNoAuth + .get(`/api/reporting/jobs/count`) + .set('kbn-xsrf', 'xxx'); + expect(countText).to.be('1'); + + // clean up + await reportingAPI.waitForJobToFinish(path); + }); + + it('Posted CSV job is visible in the status check', async () => { + // post a job + const { job, path }: { job: ReportApiJSON; path: string } = await postJobCSV(); + expectSnapshot(pick(job, apiResponseFields)).toMatchInline(` + Object { + "attempts": 0, + "created_by": false, + "jobtype": "csv_searchsource", + "max_attempts": 1, + "meta": Object { + "objectType": "search", + }, + "payload": Object { + "title": "A Saved Search With a DATE FILTER", + }, + "status": "pending", + } + `); + + // call the listing api + const { text: listText } = await supertestNoAuth + .get(`/api/reporting/jobs/list?page=0&ids=${job.id}`) + .set('kbn-xsrf', 'xxx'); + + // verify the top item in the list + const listingJobs: ReportDocument[] = JSON.parse(listText); + expect(listingJobs[0]._id).to.be(job.id); + expectSnapshot(listingJobs.map((j) => pick(j, documentResponseFields))).toMatchInline(` + Array [ + Object { + "_source": Object { + "attempts": 0, + "created_by": false, + "jobtype": "csv_searchsource", + "max_attempts": 1, + "meta": Object { + "objectType": "search", + }, + "payload": Object { + "title": "A Saved Search With a DATE FILTER", + }, + "status": "pending", + }, + }, + ] + `); + + // clean up + await reportingAPI.waitForJobToFinish(path); + }); + + it('Posted CSV job is visible in the first page of jobs listing', async () => { + // post a job + const { job, path }: { job: ReportApiJSON; path: string } = await postJobCSV(); + expectSnapshot(pick(job, apiResponseFields)).toMatchInline(` + Object { + "attempts": 0, + "created_by": false, + "jobtype": "csv_searchsource", + "max_attempts": 1, + "meta": Object { + "objectType": "search", + }, + "payload": Object { + "title": "A Saved Search With a DATE FILTER", + }, + "status": "pending", + } + `); + + // call the listing api + const { text: listText } = await supertestNoAuth + .get(`/api/reporting/jobs/list?page=0`) + .set('kbn-xsrf', 'xxx'); + + // verify the top item in the list + const listingJobs: ReportDocument[] = JSON.parse(listText); + expect(listingJobs[0]._id).to.be(job.id); + expectSnapshot(listingJobs.map((j) => pick(j, documentResponseFields))).toMatchInline(` + Array [ + Object { + "_source": Object { + "attempts": 0, + "created_by": false, + "jobtype": "csv_searchsource", + "max_attempts": 1, + "meta": Object { + "objectType": "search", + }, + "payload": Object { + "title": "A Saved Search With a DATE FILTER", + }, + "status": "pending", + }, + }, + ] + `); + + // clean up + await reportingAPI.waitForJobToFinish(path); + }); + + it('Posted CSV job details are visible in the info API', async () => { + // post a job + const { job, path }: { job: ReportApiJSON; path: string } = await postJobCSV(); + expectSnapshot(pick(job, apiResponseFields)).toMatchInline(` + Object { + "attempts": 0, + "created_by": false, + "jobtype": "csv_searchsource", + "max_attempts": 1, + "meta": Object { + "objectType": "search", + }, + "payload": Object { + "title": "A Saved Search With a DATE FILTER", + }, + "status": "pending", + } + `); + + const { text: infoText } = await supertestNoAuth + .get(`/api/reporting/jobs/info/${job.id}`) + .set('kbn-xsrf', 'xxx'); + + const info: ReportSource = JSON.parse(infoText); + expectSnapshot(pick(info, apiResponseFields)).toMatchInline(` + Object { + "attempts": 0, + "created_by": false, + "jobtype": "csv_searchsource", + "max_attempts": 1, + "meta": Object { + "objectType": "search", + }, + "payload": Object { + "title": "A Saved Search With a DATE FILTER", + }, + "status": "pending", + } + `); + + await reportingAPI.waitForJobToFinish(path); + }); + }); +} diff --git a/x-pack/test/reporting_api_integration/reporting_without_security/job_apis_csv_deprecated.ts b/x-pack/test/reporting_api_integration/reporting_without_security/job_apis_csv_deprecated.ts new file mode 100644 index 0000000000000..5aafcfb9d29a1 --- /dev/null +++ b/x-pack/test/reporting_api_integration/reporting_without_security/job_apis_csv_deprecated.ts @@ -0,0 +1,207 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import { pick } from 'lodash'; +import { + ReportApiJSON, + ReportDocument, + ReportSource, +} from '../../../plugins/reporting/common/types'; +import { FtrProviderContext } from '../ftr_provider_context'; +import { JOB_PARAMS_RISON_CSV_DEPRECATED } from '../services/fixtures'; + +const apiResponseFields = [ + 'attempts', + 'created_by', + 'jobtype', + 'max_attempts', + 'meta', + 'payload.isDeprecated', + 'payload.title', + 'payload.type', + 'status', +]; + +// TODO: clean up the /list and /info endpoints to return ReportApiJSON interface data +const documentResponseFields = [ + '_source.attempts', + '_source.created_by', + '_source.jobtype', + '_source.max_attempts', + '_source.meta', + '_source.payload.isDeprecated', + '_source.payload.title', + '_source.payload.type', + '_source.status', +]; + +// eslint-disable-next-line import/no-default-export +export default function ({ getService }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const supertestNoAuth = getService('supertestWithoutAuth'); + const reportingAPI = getService('reportingAPI'); + + describe('Job Listing APIs: Deprecated CSV Export', () => { + before(async () => { + await esArchiver.load('x-pack/test/functional/es_archives/reporting/logs'); + await esArchiver.load('x-pack/test/functional/es_archives/logstash_functional'); + }); + + after(async () => { + await esArchiver.unload('x-pack/test/functional/es_archives/reporting/logs'); + await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional'); + }); + + afterEach(async () => { + await reportingAPI.deleteAllReports(); + }); + + it('Posted CSV job is visible in the job count', async () => { + const { status: resStatus, text: resText } = await supertestNoAuth + .post(`/api/reporting/generate/csv`) + .set('kbn-xsrf', 'xxx') + .send({ jobParams: JOB_PARAMS_RISON_CSV_DEPRECATED }); + expect(resStatus).to.be(200); + + const { job, path }: { job: ReportApiJSON; path: string } = JSON.parse(resText); + expectSnapshot(pick(job, apiResponseFields)).toMatchInline(` + Object { + "attempts": 0, + "created_by": false, + "jobtype": "csv", + "max_attempts": 1, + "meta": Object {}, + "payload": Object { + "isDeprecated": true, + "title": "A Saved Search With a DATE FILTER", + "type": "search", + }, + "status": "pending", + } + `); + + // call the job count api + const { text: countText } = await supertestNoAuth + .get(`/api/reporting/jobs/count`) + .set('kbn-xsrf', 'xxx'); + + const countResult = JSON.parse(countText); + expect(countResult).to.be(1); + + await reportingAPI.waitForJobToFinish(path); + }); + + it('Posted CSV job is visible in the status check', async () => { + const { status: resStatus, text: resText } = await supertestNoAuth + .post(`/api/reporting/generate/csv`) + .set('kbn-xsrf', 'xxx') + .send({ jobParams: JOB_PARAMS_RISON_CSV_DEPRECATED }); + expect(resStatus).to.be(200); + + const { job, path }: { job: ReportApiJSON; path: string } = JSON.parse(resText); + // call the single job listing api (status check) + const { text: listText } = await supertestNoAuth + .get(`/api/reporting/jobs/list?page=0&ids=${job.id}`) + .set('kbn-xsrf', 'xxx'); + + const listingJobs: ReportDocument[] = JSON.parse(listText); + expect(listingJobs[0]._id).to.be(job.id); + expectSnapshot(listingJobs.map((j) => pick(j, documentResponseFields))).toMatchInline(` + Array [ + Object { + "_source": Object { + "attempts": 0, + "created_by": false, + "jobtype": "csv", + "max_attempts": 1, + "meta": Object {}, + "payload": Object { + "isDeprecated": true, + "title": "A Saved Search With a DATE FILTER", + "type": "search", + }, + "status": "pending", + }, + }, + ] + `); + + await reportingAPI.waitForJobToFinish(path); + }); + + it('Posted CSV job is visible in the first page of jobs listing', async () => { + const { status: resStatus, text: resText } = await supertestNoAuth + .post(`/api/reporting/generate/csv`) + .set('kbn-xsrf', 'xxx') + .send({ jobParams: JOB_PARAMS_RISON_CSV_DEPRECATED }); + expect(resStatus).to.be(200); + + const { job, path }: { job: ReportApiJSON; path: string } = JSON.parse(resText); + // call the ALL job listing api + const { text: listText } = await supertestNoAuth + .get(`/api/reporting/jobs/list?page=0`) + .set('kbn-xsrf', 'xxx'); + + const listingJobs: ReportDocument[] = JSON.parse(listText); + expect(listingJobs[0]._id).to.eql(job.id); + expectSnapshot(listingJobs.map((j) => pick(j, documentResponseFields))).toMatchInline(` + Array [ + Object { + "_source": Object { + "attempts": 0, + "created_by": false, + "jobtype": "csv", + "max_attempts": 1, + "meta": Object {}, + "payload": Object { + "isDeprecated": true, + "title": "A Saved Search With a DATE FILTER", + "type": "search", + }, + "status": "pending", + }, + }, + ] + `); + + await reportingAPI.waitForJobToFinish(path); + }); + + it('Posted CSV job details are visible in the info API', async () => { + const { status: resStatus, text: resText } = await supertestNoAuth + .post(`/api/reporting/generate/csv`) + .set('kbn-xsrf', 'xxx') + .send({ jobParams: JOB_PARAMS_RISON_CSV_DEPRECATED }); + expect(resStatus).to.be(200); + + const { job, path }: { job: ReportApiJSON; path: string } = JSON.parse(resText); + const { text: infoText } = await supertestNoAuth + .get(`/api/reporting/jobs/info/${job.id}`) + .set('kbn-xsrf', 'xxx'); + + const info: ReportSource = JSON.parse(infoText); + expectSnapshot(pick(info, apiResponseFields)).toMatchInline(` + Object { + "attempts": 0, + "created_by": false, + "jobtype": "csv", + "max_attempts": 1, + "meta": Object {}, + "payload": Object { + "isDeprecated": true, + "title": "A Saved Search With a DATE FILTER", + "type": "search", + }, + "status": "pending", + } + `); + + await reportingAPI.waitForJobToFinish(path); + }); + }); +}