From 56cdd7188b19d4f35237f8ef2ed76c5faa539e80 Mon Sep 17 00:00:00 2001 From: Luke Elmers Date: Thu, 3 Sep 2020 08:13:33 -0600 Subject: [PATCH] [data.indexPatterns] Fix broken rollup index pattern creation (#76593) --- .../index_patterns/index_patterns/index_pattern.ts | 2 +- test/functional/page_objects/settings_page.ts | 8 ++++++-- .../functional/apps/rollup_job/hybrid_index_pattern.js | 10 ++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts index bbe16afca2fa3..bcb3c1538e7e9 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts @@ -542,7 +542,7 @@ export class IndexPattern implements IIndexPattern { fields: this.mapping.fields._serialize!(this.fields), fieldFormatMap: this.mapping.fieldFormatMap._serialize!(this.fieldFormatMap), type: this.type, - typeMeta: this.mapping.typeMeta._serialize!(this.mapping), + typeMeta: this.mapping.typeMeta._serialize!(this.typeMeta), }; } diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index a4285a5f94d51..43e58a0a2e58d 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -282,11 +282,15 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider await PageObjects.header.waitUntilLoadingHasFinished(); } - async clickIndexPatternLogstash() { - const indexLink = await find.byXPath(`//a[descendant::*[text()='logstash-*']]`); + async clickIndexPatternByName(name: string) { + const indexLink = await find.byXPath(`//a[descendant::*[text()='${name}']]`); await indexLink.click(); } + async clickIndexPatternLogstash() { + await this.clickIndexPatternByName('logstash-*'); + } + async getIndexPatternList() { await testSubjects.existOrFail('indexPatternTable', { timeout: 5000 }); return await find.allByCssSelector( diff --git a/x-pack/test/functional/apps/rollup_job/hybrid_index_pattern.js b/x-pack/test/functional/apps/rollup_job/hybrid_index_pattern.js index d6ed6ce13391e..b4eaff7f3ddcf 100644 --- a/x-pack/test/functional/apps/rollup_job/hybrid_index_pattern.js +++ b/x-pack/test/functional/apps/rollup_job/hybrid_index_pattern.js @@ -11,6 +11,7 @@ import mockRolledUpData, { mockIndices } from './hybrid_index_helper'; export default function ({ getService, getPageObjects }) { const es = getService('legacyEs'); const esArchiver = getService('esArchiver'); + const find = getService('find'); const retry = getService('retry'); const PageObjects = getPageObjects(['common', 'settings']); @@ -88,6 +89,15 @@ export default function ({ getService, getPageObjects }) { (i) => i.includes(rollupIndexPatternName) && i.includes('Rollup') ); expect(filteredIndexPatternNames.length).to.be(1); + + // make sure there are no toasts which might be showing unexpected errors + const toastShown = await find.existsByCssSelector('.euiToast'); + expect(toastShown).to.be(false); + + // ensure all fields are available + await PageObjects.settings.clickIndexPatternByName(rollupIndexPatternName); + const fields = await PageObjects.settings.getFieldNames(); + expect(fields).to.eql(['_source', '_id', '_type', '_index', '_score', '@timestamp']); }); after(async () => {