mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* Use _source value of timestamp for search_after since ES allows this now * Unskip functional tests * Remove unused convertIsoToNanosAsStr
This commit is contained in:
parent
8656901b29
commit
8aac010a75
4 changed files with 63 additions and 19 deletions
|
@ -31,15 +31,6 @@ export function extractNanos(timeFieldValue: string = ''): string {
|
|||
return fractionSeconds.length !== 9 ? fractionSeconds.padEnd(9, '0') : fractionSeconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* extract the nanoseconds as string of a given ISO formatted timestamp
|
||||
*/
|
||||
export function convertIsoToNanosAsStr(isoValue: string): string {
|
||||
const nanos = extractNanos(isoValue);
|
||||
const millis = convertIsoToMillis(isoValue);
|
||||
return `${millis}${nanos.substr(3, 6)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert an iso formatted string to number of milliseconds since
|
||||
* 1970-01-01T00:00:00.000Z
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { convertIsoToNanosAsStr } from './date_conversion';
|
||||
import { SurrDocType, EsHitRecordList, EsHitRecord } from '../context';
|
||||
|
||||
export type EsQuerySearchAfter = [string | number, string | number];
|
||||
|
@ -38,15 +37,10 @@ export function getEsQuerySearchAfter(
|
|||
// already surrounding docs -> first or last record is used
|
||||
const afterTimeRecIdx = type === 'successors' && documents.length ? documents.length - 1 : 0;
|
||||
const afterTimeDoc = documents[afterTimeRecIdx];
|
||||
const afterTimeValue = nanoSeconds
|
||||
? convertIsoToNanosAsStr(afterTimeDoc._source[timeFieldName])
|
||||
: afterTimeDoc.sort[0];
|
||||
const afterTimeValue = nanoSeconds ? afterTimeDoc._source[timeFieldName] : afterTimeDoc.sort[0];
|
||||
return [afterTimeValue, afterTimeDoc.sort[1]];
|
||||
}
|
||||
// if data_nanos adapt timestamp value for sorting, since numeric value was rounded by browser
|
||||
// ES search_after also works when number is provided as string
|
||||
return [
|
||||
nanoSeconds ? convertIsoToNanosAsStr(anchor._source[timeFieldName]) : anchor.sort[0],
|
||||
anchor.sort[1],
|
||||
];
|
||||
return [nanoSeconds ? anchor._source[timeFieldName] : anchor.sort[0], anchor.sort[1]];
|
||||
}
|
||||
|
|
|
@ -30,8 +30,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const PageObjects = getPageObjects(['common', 'context', 'timePicker', 'discover']);
|
||||
const esArchiver = getService('esArchiver');
|
||||
|
||||
// FLAKY/FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/58815
|
||||
describe.skip('context view for date_nanos', () => {
|
||||
describe('context view for date_nanos', () => {
|
||||
before(async function () {
|
||||
await security.testUser.setRoles(['kibana_admin', 'kibana_date_nanos']);
|
||||
await esArchiver.loadIfNeeded('date_nanos');
|
||||
|
|
60
test/functional/apps/context/_date_nanos_custom_timestamp.js
Normal file
60
test/functional/apps/context/_date_nanos_custom_timestamp.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
|
||||
const TEST_INDEX_PATTERN = 'date_nanos_custom_timestamp';
|
||||
const TEST_DEFAULT_CONTEXT_SIZE = 1;
|
||||
const TEST_STEP_SIZE = 3;
|
||||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const docTable = getService('docTable');
|
||||
const security = getService('security');
|
||||
const PageObjects = getPageObjects(['common', 'context', 'timePicker', 'discover']);
|
||||
const esArchiver = getService('esArchiver');
|
||||
|
||||
describe('context view for date_nanos with custom timestamp', () => {
|
||||
before(async function () {
|
||||
await security.testUser.setRoles(['kibana_admin', 'kibana_date_nanos_custom']);
|
||||
await esArchiver.loadIfNeeded('date_nanos_custom');
|
||||
await kibanaServer.uiSettings.replace({ defaultIndex: TEST_INDEX_PATTERN });
|
||||
await kibanaServer.uiSettings.update({
|
||||
'context:defaultSize': `${TEST_DEFAULT_CONTEXT_SIZE}`,
|
||||
'context:step': `${TEST_STEP_SIZE}`,
|
||||
});
|
||||
});
|
||||
|
||||
it('displays predessors - anchor - successors in right order ', async function () {
|
||||
await PageObjects.context.navigateTo(TEST_INDEX_PATTERN, '1');
|
||||
const actualRowsText = await docTable.getRowsText();
|
||||
const expectedRowsText = [
|
||||
'Oct 21, 2019 @ 08:30:04.828733000 -',
|
||||
'Oct 21, 2019 @ 00:30:04.828740000 -',
|
||||
'Oct 21, 2019 @ 00:30:04.828723000 -',
|
||||
];
|
||||
expect(actualRowsText).to.eql(expectedRowsText);
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
await security.testUser.restoreDefaults();
|
||||
await esArchiver.unload('date_nanos_custom');
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue