Skip to content

Commit 10f8bea

Browse files
authored
[Discover] Context unskip date nanos functional tests (#73781)
* Use _source value of timestamp for search_after since ES allows this now * Unskip functional tests * Remove unused convertIsoToNanosAsStr
1 parent 145f2ee commit 10f8bea

File tree

4 files changed

+4
-23
lines changed

4 files changed

+4
-23
lines changed

src/plugins/discover/public/application/angular/context/api/utils/date_conversion.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,6 @@ export function extractNanos(timeFieldValue: string = ''): string {
3131
return fractionSeconds.length !== 9 ? fractionSeconds.padEnd(9, '0') : fractionSeconds;
3232
}
3333

34-
/**
35-
* extract the nanoseconds as string of a given ISO formatted timestamp
36-
*/
37-
export function convertIsoToNanosAsStr(isoValue: string): string {
38-
const nanos = extractNanos(isoValue);
39-
const millis = convertIsoToMillis(isoValue);
40-
return `${millis}${nanos.substr(3, 6)}`;
41-
}
42-
4334
/**
4435
* convert an iso formatted string to number of milliseconds since
4536
* 1970-01-01T00:00:00.000Z

src/plugins/discover/public/application/angular/context/api/utils/get_es_query_search_after.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
import { convertIsoToNanosAsStr } from './date_conversion';
2019
import { SurrDocType, EsHitRecordList, EsHitRecord } from '../context';
2120

2221
export type EsQuerySearchAfter = [string | number, string | number];
@@ -38,15 +37,10 @@ export function getEsQuerySearchAfter(
3837
// already surrounding docs -> first or last record is used
3938
const afterTimeRecIdx = type === 'successors' && documents.length ? documents.length - 1 : 0;
4039
const afterTimeDoc = documents[afterTimeRecIdx];
41-
const afterTimeValue = nanoSeconds
42-
? convertIsoToNanosAsStr(afterTimeDoc.fields[timeFieldName][0])
43-
: afterTimeDoc.sort[0];
40+
const afterTimeValue = nanoSeconds ? afterTimeDoc._source[timeFieldName] : afterTimeDoc.sort[0];
4441
return [afterTimeValue, afterTimeDoc.sort[1]];
4542
}
4643
// if data_nanos adapt timestamp value for sorting, since numeric value was rounded by browser
4744
// ES search_after also works when number is provided as string
48-
return [
49-
nanoSeconds ? convertIsoToNanosAsStr(anchor.fields[timeFieldName][0]) : anchor.sort[0],
50-
anchor.sort[1],
51-
];
45+
return [nanoSeconds ? anchor._source[timeFieldName] : anchor.sort[0], anchor.sort[1]];
5246
}

test/functional/apps/context/_date_nanos.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ export default function ({ getService, getPageObjects }) {
3030
const PageObjects = getPageObjects(['common', 'context', 'timePicker', 'discover']);
3131
const esArchiver = getService('esArchiver');
3232

33-
// FLAKY/FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/58815
34-
describe.skip('context view for date_nanos', () => {
33+
describe('context view for date_nanos', () => {
3534
before(async function () {
3635
await security.testUser.setRoles(['kibana_admin', 'kibana_date_nanos']);
3736
await esArchiver.loadIfNeeded('date_nanos');

test/functional/apps/context/_date_nanos_custom_timestamp.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ export default function ({ getService, getPageObjects }) {
3030
const PageObjects = getPageObjects(['common', 'context', 'timePicker', 'discover']);
3131
const esArchiver = getService('esArchiver');
3232

33-
// skipped due to a recent change in ES that caused search_after queries with data containing
34-
// custom timestamp formats like in the testdata to fail
35-
// https://github.com/elastic/kibana/issues/58815
36-
describe.skip('context view for date_nanos with custom timestamp', () => {
33+
describe('context view for date_nanos with custom timestamp', () => {
3734
before(async function () {
3835
await security.testUser.setRoles(['kibana_admin', 'kibana_date_nanos_custom']);
3936
await esArchiver.loadIfNeeded('date_nanos_custom');

0 commit comments

Comments
 (0)