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] Unskip date_nanos and shard links functional tests #82878

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export class IndexPatternsService {
return true;
}

return Object.values(specs).every((spec) => {
const isFieldRefreshRequired = Object.values(specs).every((spec) => {
// See https://github.com/elastic/kibana/pull/8421
const hasFieldCaps = 'aggregatable' in spec && 'searchable' in spec;

Expand All @@ -209,6 +209,11 @@ export class IndexPatternsService {

return !hasFieldCaps || !hasDocValuesFlag;
});
if (isFieldRefreshRequired) {
// eslint-disable-next-line no-console
console.log('isFieldRefreshRequired == true for specs', JSON.stringify(specs));
}
return isFieldRefreshRequired;
}

/**
Expand All @@ -217,12 +222,13 @@ export class IndexPatternsService {
*/
getFieldsForWildcard = async (options: GetFieldsOptions = {}) => {
const metaFields = await this.config.get(UI_SETTINGS.META_FIELDS);
return this.apiClient.getFieldsForWildcard({
const result = this.apiClient.getFieldsForWildcard({
pattern: options.pattern,
metaFields,
type: options.type,
params: options.params || {},
});
return result;
};

/**
Expand All @@ -247,6 +253,8 @@ export class IndexPatternsService {
refreshFields = async (indexPattern: IndexPattern) => {
try {
const fields = await this.getFieldsForIndexPattern(indexPattern);
// eslint-disable-next-line no-console
console.log('refreshFields returns', JSON.stringify(fields));
const scripted = indexPattern.getScriptedFields().map((field) => field.spec);
indexPattern.fields.replaceAll([...fields, ...scripted]);
} catch (err) {
Expand Down Expand Up @@ -276,11 +284,20 @@ export class IndexPatternsService {
title: string,
options: GetFieldsOptions
) => {
// eslint-disable-next-line no-console
console.log('refreshFieldSpecMap start');
const scriptdFields = Object.values(fields).filter((field) => field.scripted);
try {
const newFields = await this.getFieldsForWildcard(options);
kertal marked this conversation as resolved.
Show resolved Hide resolved
return this.fieldArrayToMap([...newFields, ...scriptdFields]);
// eslint-disable-next-line no-console
console.log('getFieldsForWildcard returns', JSON.stringify(newFields));
const result = this.fieldArrayToMap([...newFields, ...scriptdFields]);
// eslint-disable-next-line no-console
console.log('fieldArrayToMap returns', JSON.stringify(result));
return result;
} catch (err) {
// eslint-disable-next-line no-console
console.log('refreshFieldSpecMap ERROR', JSON.stringify(err));
kertal marked this conversation as resolved.
Show resolved Hide resolved
if (err instanceof IndexPatternMissingIndices) {
this.onNotification({ title: (err as any).message, color: 'danger', iconType: 'alert' });
return {};
Expand Down Expand Up @@ -380,15 +397,23 @@ export class IndexPatternsService {
params: typeMeta && typeMeta.params,
})
: spec.fields;
if (isFieldRefreshRequired) {
// eslint-disable-next-line no-console
console.log('fields fetched', JSON.stringify(spec.fields));
}
} catch (err) {
isSaveRequired = false;
if (err instanceof IndexPatternMissingIndices) {
// eslint-disable-next-line no-console
console.error('index pattern missing', JSON.stringify(err));
this.onNotification({
title: (err as any).message,
color: 'danger',
iconType: 'alert',
});
} else {
// eslint-disable-next-line no-console
console.error('fields fetching not possible', JSON.stringify(err));
this.onError(err, {
title: i18n.translate('data.indexPatterns.fetchFieldErrorTitle', {
defaultMessage: 'Error fetching fields for index pattern {title} (ID: {id})',
Expand All @@ -406,6 +431,8 @@ export class IndexPatternsService {
indexPatternCache.set(id, indexPattern);
if (isSaveRequired) {
try {
// eslint-disable-next-line no-console
console.error('updateSavedObject starts', JSON.stringify(spec.fields));
this.updateSavedObject(indexPattern);
} catch (err) {
this.onError(err, {
Expand All @@ -420,7 +447,10 @@ export class IndexPatternsService {
});
}
}

if (isFieldRefreshRequired) {
// eslint-disable-next-line no-console
console.error('resetOriginalSavedObjectBode', JSON.stringify(spec.fields));
}
indexPattern.resetOriginalSavedObjectBody();
return indexPattern;
};
Expand Down Expand Up @@ -517,6 +547,8 @@ export class IndexPatternsService {
.then((resp) => {
indexPattern.id = resp.id;
indexPattern.version = resp.version;
// eslint-disable-next-line no-console
console.error('index pattern saved successfully');
})
.catch(async (err) => {
if (err?.res?.status === 409 && saveAttempts++ < MAX_ATTEMPTS_TO_RESOLVE_CONFLICTS) {
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_date_nanos.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export default function ({ getService, getPageObjects }) {
const toTime = 'Sep 23, 2019 @ 03:31:44.000';

// Failing: See https://github.com/elastic/kibana/issues/82035
describe.skip('date_nanos', function () {

describe('date_nanos', function () {
before(async function () {
await esArchiver.loadIfNeeded('date_nanos');
await kibanaServer.uiSettings.replace({ defaultIndex: 'date-nanos' });
Expand Down
14 changes: 9 additions & 5 deletions test/functional/apps/discover/_discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,14 @@ export default function ({ getService, getPageObjects }) {

const getRequestTimestamp = async () => {
const requestStats = await inspector.getTableData();
const requestTimestamp = requestStats.filter((r) =>
r[0].includes('Request timestamp')
)[0][1];
return requestTimestamp;
const requestStatsRow = requestStats.filter(
(r) => r && r[0] && r[0].includes('Request timestamp')
);
if (!requestStatsRow || !requestStatsRow[0] || !requestStatsRow[0][1]) {
return '';
}

return requestStatsRow[0][1];
};

const requestTimestampBefore = await getRequestTimestamp();
Expand All @@ -316,7 +320,7 @@ export default function ({ getService, getPageObjects }) {
log.debug(
`Timestamp before: ${requestTimestampBefore}, Timestamp after: ${requestTimestampAfter}`
);
return requestTimestampBefore !== requestTimestampAfter;
return requestTimestampAfter && requestTimestampBefore !== requestTimestampAfter;
});
});

Expand Down
6 changes: 2 additions & 4 deletions test/functional/apps/discover/_doc_navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ export default function ({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const retry = getService('retry');

// FLAKY: https://github.com/elastic/kibana/issues/78373
describe.skip('doc link in discover', function contextSize() {
describe('doc link in discover', function contextSize() {
beforeEach(async function () {
log.debug('load kibana index with default index pattern');
await esArchiver.loadIfNeeded('discover');

await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.loadIfNeeded('discover');
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.waitForDocTableLoadingComplete();
Expand Down
3 changes: 1 addition & 2 deletions test/functional/apps/discover/_field_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export default function ({ getService, getPageObjects }) {
const queryBar = getService('queryBar');
const PageObjects = getPageObjects(['common', 'header', 'discover', 'visualize', 'timePicker']);

// FLAKY: https://github.com/elastic/kibana/issues/78689
describe.skip('discover tab', function describeIndexTests() {
describe('discover tab', function describeIndexTests() {
this.tags('includeFirefox');
before(async function () {
await esArchiver.loadIfNeeded('logstash_functional');
Expand Down
3 changes: 1 addition & 2 deletions test/functional/apps/discover/_inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ export default function ({ getService, getPageObjects }) {
return hitsCountStatsRow[STATS_ROW_VALUE_INDEX];
}

// FLAKY: https://github.com/elastic/kibana/issues/39842
describe.skip('inspect', () => {
describe('inspect', () => {
before(async () => {
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.load('discover');
Expand Down
3 changes: 1 addition & 2 deletions test/functional/apps/discover/_shared_links.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export default function ({ getService, getPageObjects }) {
const browser = getService('browser');
const toasts = getService('toasts');

// FLAKY: https://github.com/elastic/kibana/issues/80104
describe.skip('shared links', function describeIndexTests() {
describe('shared links', function describeIndexTests() {
let baseUrl;

async function setup({ storeStateInSessionStorage }) {
Expand Down