forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reporting API test expansion and clean up (elastic#18986)
* Update & expand reporting API tests * remove xpack stuff from oss archive * wrap "it"s so they are in expected order. * Update expected recent stats * url was pointing to a visualization not a csv * Move comment around * Merging with changes on master renaming stats to usage * fix reference to old stats file. * bad merge
- Loading branch information
1 parent
742f9b5
commit fbcee4e
Showing
21 changed files
with
730 additions
and
686 deletions.
There are no files selected for viewing
Binary file modified
BIN
+840 Bytes
(110%)
test/functional/fixtures/es_archiver/dashboard/current/kibana/data.json.gz
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -271,4 +271,4 @@ | |
} | ||
} | ||
} | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
x-pack/test/api_integration/apis/reporting/bwc_existing_indexes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import * as GenerationUrls from './generation_urls'; | ||
|
||
|
||
/** | ||
* This file tests the situation when a reporting index spans releases. By default reporting indexes are created | ||
* on a weekly basis, but this is configurable so it is possible a user has this set to yearly. In that event, it | ||
* is possible report data is getting posted to an index that was created by a very old version. We don't have a | ||
* reporting index migration plan, so this test is important to ensure BWC, or that in the event we decide to make | ||
* a major change in a major release, we handle it properly. | ||
*/ | ||
|
||
export default function ({ getService }) { | ||
const esArchiver = getService('esArchiver'); | ||
const reportingAPI = getService('reportingAPI'); | ||
const usageAPI = getService('usageAPI'); | ||
|
||
describe('BWC report generation into existing indexes', async () => { | ||
let expectedCompletedReportCount; | ||
let cleanupIndexAlias; | ||
|
||
describe('existing 6_2 index', () => { | ||
before('load data and add index alias', async () => { | ||
await reportingAPI.deleteAllReportingIndexes(); | ||
await esArchiver.load('reporting/bwc/6_2'); | ||
|
||
// The index name in the 6_2 archive. | ||
const ARCHIVED_REPORTING_INDEX = '.reporting-2018.03.11'; | ||
cleanupIndexAlias = await reportingAPI.coerceReportsIntoExistingIndex(ARCHIVED_REPORTING_INDEX); | ||
|
||
const stats = await usageAPI.getUsageStats(); | ||
expectedCompletedReportCount = await reportingAPI.getCompletedReportCount(stats); | ||
}); | ||
|
||
after('remove index alias', async () => { | ||
await cleanupIndexAlias(); | ||
}); | ||
|
||
// Might not be great test practice to lump all these jobs together but reporting takes awhile and it'll be | ||
// more efficient to post them all up front, then sequentially. | ||
it('multiple jobs posted', async () => { | ||
const reportPaths = []; | ||
reportPaths.push(await reportingAPI.postJob(GenerationUrls.CSV_DISCOVER_KUERY_AND_FILTER_6_3)); | ||
reportPaths.push(await reportingAPI.postJob(GenerationUrls.PDF_PRESERVE_DASHBOARD_FILTER_6_3)); | ||
reportPaths.push(await reportingAPI.postJob(GenerationUrls.PDF_PRESERVE_PIE_VISUALIZATION_6_3)); | ||
reportPaths.push(await reportingAPI.postJob(GenerationUrls.PDF_PRINT_DASHBOARD_6_3)); | ||
reportPaths.push(await reportingAPI.postJob( | ||
GenerationUrls.PDF_PRINT_PIE_VISUALIZATION_FILTER_AND_SAVED_SEARCH_6_3)); | ||
|
||
await reportingAPI.expectAllJobsToFinishSuccessfully(reportPaths); | ||
}).timeout(1540000); | ||
|
||
it('jobs completed successfully', async () => { | ||
const stats = await usageAPI.getUsageStats(); | ||
expectedCompletedReportCount += 5; | ||
reportingAPI.expectCompletedReportCount(stats, expectedCompletedReportCount); | ||
}); | ||
}); | ||
}); | ||
} |
39 changes: 39 additions & 0 deletions
39
x-pack/test/api_integration/apis/reporting/bwc_generation_urls.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import * as GenerationUrls from './generation_urls'; | ||
|
||
export default function ({ getService }) { | ||
const reportingAPI = getService('reportingAPI'); | ||
const usageAPI = getService('usageAPI'); | ||
|
||
describe('BWC report generation urls', () => { | ||
describe('6_2', () => { | ||
before(async () => { | ||
await reportingAPI.deleteAllReportingIndexes(); | ||
}); | ||
|
||
// Might not be great test practice to lump all these jobs together but reporting takes awhile and it'll be | ||
// more efficient to post them all up front, then sequentially. | ||
it('multiple jobs posted', async () => { | ||
const reportPaths = []; | ||
reportPaths.push(await reportingAPI.postJob(GenerationUrls.PDF_PRINT_DASHBOARD_6_2)); | ||
reportPaths.push(await reportingAPI.postJob(GenerationUrls.PDF_PRESERVE_VISUALIZATION_6_2)); | ||
reportPaths.push(await reportingAPI.postJob(GenerationUrls.CSV_DISCOVER_FILTER_QUERY_6_2)); | ||
|
||
await reportingAPI.expectAllJobsToFinishSuccessfully(reportPaths); | ||
}).timeout(1540000); | ||
|
||
it('jobs completed successfully', async () => { | ||
const stats = await usageAPI.getUsageStats(); | ||
reportingAPI.expectCompletedReportCount(stats, 3); | ||
}); | ||
}); | ||
|
||
// 6.3 urls currently being tested as part of the "bwc_existing_indexes" test suite. Reports are time consuming, | ||
// don't replicate tests if we don't need to, so no specific 6_3 url tests here. | ||
}); | ||
} |
Oops, something went wrong.