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,7 @@ export class IndexPatternsService {

return !hasFieldCaps || !hasDocValuesFlag;
});
return isFieldRefreshRequired;
}

/**
Expand All @@ -217,12 +218,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 Down Expand Up @@ -276,22 +278,28 @@ 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]);
} catch (err) {
// eslint-disable-next-line no-console
console.log('refreshFieldSpecMap ERROR');
if (err instanceof IndexPatternMissingIndices) {
this.onNotification({ title: (err as any).message, color: 'danger', iconType: 'alert' });
return {};
}
const msg = i18n.translate('data.indexPatterns.fetchFieldErrorTitle', {
defaultMessage: 'Error fetching fields for index pattern {title} (ID: {id})',
values: { id, title },
});

this.onError(err, {
kertal marked this conversation as resolved.
Show resolved Hide resolved
title: i18n.translate('data.indexPatterns.fetchFieldErrorTitle', {
defaultMessage: 'Error fetching fields for index pattern {title} (ID: {id})',
values: { id, title },
}),
title: msg,
});
throw new Error(msg);
}
return fields;
};
Expand Down Expand Up @@ -389,6 +397,8 @@ export class IndexPatternsService {
iconType: 'alert',
});
} else {
// eslint-disable-next-line no-console
console.error('fields fetching not possible');
this.onError(err, {
title: i18n.translate('data.indexPatterns.fetchFieldErrorTitle', {
defaultMessage: 'Error fetching fields for index pattern {title} (ID: {id})',
Expand Down Expand Up @@ -420,7 +430,6 @@ export class IndexPatternsService {
});
}
}

indexPattern.resetOriginalSavedObjectBody();
return indexPattern;
};
Expand Down Expand Up @@ -517,6 +526,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
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ export class IndexPatternsApiClient implements IIndexPatternsApiClient {
query,
})
.catch((resp: any) => {
// eslint-disable-next-line no-console
console.error('IndexPatternsApiClient ERROR');
// eslint-disable-next-line no-console
console.error('IndexPatternsApiClient ERROR DEBUG', JSON.stringify(resp));

kertal marked this conversation as resolved.
Show resolved Hide resolved
if (resp.body.statusCode === 404 && resp.body.attributes?.code === 'no_matching_indices') {
throw new IndexPatternMissingIndices(resp.body.message);
}
Expand Down Expand Up @@ -80,7 +85,23 @@ export class IndexPatternsApiClient implements IIndexPatternsApiClient {
meta_fields: metaFields,
};
}
// eslint-disable-next-line no-console
console.log('API client url', url);
// eslint-disable-next-line no-console
console.log('API client query', JSON.stringify(query));

return this._request(url, query).then((resp: any) => resp.fields);
return this._request(url, query)
.then((resp: any) => {
// eslint-disable-next-line no-console
console.log('API client url response', JSON.stringify(resp));
return resp.fields;
})
.catch((e) => {
// eslint-disable-next-line no-console
console.error('API client Error Message', e.message);
// eslint-disable-next-line no-console
console.error('API client Error', JSON.stringify(e));
throw new Error('API client ERROR');
});
}
}
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