mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Fix issue with flaky sample data API integration test (#165328)
## Summary
Closes;
- https://github.com/elastic/kibana/issues/164568
- https://github.com/elastic/kibana/issues/121883
## Context;
This issue is caused by inconsistencies in timestamp format existing in
the [sample data for
flights](https://github.com/elastic/kibana/blob/8.10/src/plugins/home/server/services/sample_data/data_sets/flights/flights.json.gz).
See screenshot;
<img width="1020" alt="Screenshot 2023-09-06 at 09 45 18"
src="e358eb2d
-dc92-4e0d-b697-e362e2dbd33b">
When the flight sample data is being installed, on encountering any one
of these data points with a timestamp that's not a valid representation
for a date ISOString, it results in the [computation of a
value](https://github.com/elastic/kibana/blame/v8.9.1/src/plugins/home/server/services/sample_data/lib/translate_timestamp.ts#L46)
that can not be parsed as a valid date, this is verifiable taking a look
at the result of a failed flaky test run
[here](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3037#018a5164-27e7-45d9-897c-56f34fe2bfc3/288-1243)
logging the documents returned that the test would run against, one
would note that the timestamp value for the first document is
`2000-01-15T` which computes to `NaN` when parsed which further cascades
into other parts of the test, causing it to fail eventually.
This PR removes the data points with the invalid timestamps and modifies
the tests to match the new expectation for the number of documents that
should have been indexed. This change set was also ran through the
[flaky test
runner](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3077)
with success.
### Checklist
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
This commit is contained in:
parent
9a798c7969
commit
92fcfa9747
2 changed files with 9 additions and 10 deletions
Binary file not shown.
|
@ -17,7 +17,11 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
|
||||
const MILLISECOND_IN_WEEK = 1000 * 60 * 60 * 24 * 7;
|
||||
const SPACES = ['default', 'other'];
|
||||
const FLIGHTS_OVERVIEW_DASHBOARD_ID = '7adfa750-4c81-11e8-b3d7-01146121b73d'; // default ID of the flights overview dashboard
|
||||
/**
|
||||
* default ID of the flights overview dashboard
|
||||
* @see src/plugins/home/server/services/sample_data/data_sets/flights/index.ts
|
||||
*/
|
||||
const FLIGHTS_OVERVIEW_DASHBOARD_ID = '7adfa750-4c81-11e8-b3d7-01146121b73d';
|
||||
const FLIGHTS_CANVAS_APPLINK_PATH =
|
||||
'/app/canvas#/workpad/workpad-a474e74b-aedc-47c3-894a-db77e62c41e0'; // includes default ID of the flights canvas applink path
|
||||
|
||||
|
@ -25,8 +29,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
return appLinks.some((item) => item.path === path);
|
||||
};
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/164568
|
||||
describe.skip('sample data apis', () => {
|
||||
describe('sample data apis', () => {
|
||||
before(async () => {
|
||||
await esArchiver.emptyKibanaIndex();
|
||||
});
|
||||
|
@ -64,7 +67,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
.expect(200);
|
||||
|
||||
expect(resp.body).to.eql({
|
||||
elasticsearchIndicesCreated: { kibana_sample_data_flights: 13059 },
|
||||
elasticsearchIndicesCreated: { kibana_sample_data_flights: 13014 },
|
||||
kibanaSavedObjectsLoaded: 8,
|
||||
});
|
||||
});
|
||||
|
@ -73,9 +76,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
it('should load elasticsearch index containing sample data with dates relative to current time', async () => {
|
||||
const resp = await es.search<{ timestamp: string }>({
|
||||
index: 'kibana_sample_data_flights',
|
||||
body: {
|
||||
sort: [{ timestamp: { order: 'desc' } }],
|
||||
},
|
||||
sort: [{ timestamp: { order: 'desc' } }],
|
||||
});
|
||||
|
||||
const doc = resp.hits.hits[0];
|
||||
|
@ -91,9 +92,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
|
||||
const resp = await es.search<{ timestamp: string }>({
|
||||
index: 'kibana_sample_data_flights',
|
||||
body: {
|
||||
sort: [{ timestamp: { order: 'desc' } }],
|
||||
},
|
||||
sort: [{ timestamp: { order: 'desc' } }],
|
||||
});
|
||||
|
||||
const doc = resp.hits.hits[0];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue