Skip to content

Commit

Permalink
[data.indexPatterns] Fix broken rollup index pattern creation (elasti…
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeelmers committed Sep 3, 2020
1 parent d915d82 commit 56cdd71
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
}

Expand Down
8 changes: 6 additions & 2 deletions test/functional/page_objects/settings_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 10 additions & 0 deletions x-pack/test/functional/apps/rollup_job/hybrid_index_pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down Expand Up @@ -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 () => {
Expand Down

0 comments on commit 56cdd71

Please sign in to comment.