Skip to content

Commit

Permalink
[Discover] Context unskip date nanos functional tests (#73781)
Browse files Browse the repository at this point in the history
* Use _source value of timestamp for search_after since ES allows this now

* Unskip functional tests

* Remove unused convertIsoToNanosAsStr
  • Loading branch information
kertal committed Jul 31, 2020
1 parent 145f2ee commit 10f8bea
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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.fields[timeFieldName][0])
: 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.fields[timeFieldName][0]) : anchor.sort[0],
anchor.sort[1],
];
return [nanoSeconds ? anchor._source[timeFieldName] : anchor.sort[0], anchor.sort[1]];
}
3 changes: 1 addition & 2 deletions test/functional/apps/context/_date_nanos.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
5 changes: 1 addition & 4 deletions test/functional/apps/context/_date_nanos_custom_timestamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['common', 'context', 'timePicker', 'discover']);
const esArchiver = getService('esArchiver');

// skipped due to a recent change in ES that caused search_after queries with data containing
// custom timestamp formats like in the testdata to fail
// https://github.com/elastic/kibana/issues/58815
describe.skip('context view for date_nanos with custom timestamp', () => {
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');
Expand Down

0 comments on commit 10f8bea

Please sign in to comment.