Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discover] Context unskip date nanos functional tests #73781

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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