mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* Functional tests to add index alias reference (#17343) Test to make sure Kibana handles index alias reference.
This commit is contained in:
parent
1ab16f3518
commit
544c26b659
7 changed files with 320 additions and 3 deletions
|
@ -1,11 +1,12 @@
|
|||
<div class="col-md-2 sidebar-container" role="region" aria-label="Index patterns">
|
||||
<div class="sidebar-list">
|
||||
<div class="sidebar-item-title full-title">
|
||||
<h5>
|
||||
<h5 data-test-subj="createIndexPatternParent">
|
||||
<a
|
||||
ng-if="editingId"
|
||||
href="#/management/kibana/index"
|
||||
class="kuiButton kuiButton--primary kuiButton--small"
|
||||
data-test-subj="createIndexPatternButton"
|
||||
>
|
||||
<span aria-hidden="true" class="kuiIcon fa-plus"></span>
|
||||
<span>Create Index Pattern</span>
|
||||
|
|
77
test/functional/apps/management/_handle_alias.js
Normal file
77
test/functional/apps/management/_handle_alias.js
Normal file
|
@ -0,0 +1,77 @@
|
|||
import expect from 'expect.js';
|
||||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const es = getService('es');
|
||||
const retry = getService('retry');
|
||||
const PageObjects = getPageObjects(['common', 'home', 'settings', 'discover', 'header']);
|
||||
|
||||
describe('Index patterns on aliases', function () {
|
||||
before(async function () {
|
||||
await esArchiver.loadIfNeeded('alias');
|
||||
await esArchiver.load('empty_kibana');
|
||||
await es.indices.updateAliases({
|
||||
body: {
|
||||
actions: [
|
||||
{ 'add': { 'index': 'test1', 'alias': 'alias1' } },
|
||||
{ 'add': { 'index': 'test2', 'alias': 'alias1' } },
|
||||
{ 'add': { 'index': 'test3', 'alias': 'alias1' } },
|
||||
{ 'add': { 'index': 'test4', 'alias': 'alias1' } },
|
||||
{ 'add': { 'index': 'test5', 'alias': 'alias2' } },
|
||||
{ 'add': { 'index': 'test6', 'alias': 'alias2' } },
|
||||
{ 'add': { 'index': 'test7', 'alias': 'alias2' } },
|
||||
{ 'add': { 'index': 'test8', 'alias': 'alias2' } },
|
||||
{ 'add': { 'index': 'test9', 'alias': 'alias2' } }
|
||||
]
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to create index pattern without time field', async function () {
|
||||
await PageObjects.settings.navigateTo();
|
||||
await PageObjects.settings.createIndexPattern('alias1', null);
|
||||
const indexPageHeading = await PageObjects.settings.getIndexPageHeading();
|
||||
const patternName = await indexPageHeading.getVisibleText();
|
||||
expect(patternName).to.be('alias1*');
|
||||
});
|
||||
|
||||
it('should be able to discover and verify no of hits for alias1', async function () {
|
||||
const expectedHitCount = '4';
|
||||
await PageObjects.common.navigateToApp('discover');
|
||||
await retry.try(async function () {
|
||||
expect(await PageObjects.discover.getHitCount()).to.be(expectedHitCount);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should be able to create index pattern with timefield', async function () {
|
||||
await PageObjects.settings.navigateTo();
|
||||
await PageObjects.settings.createIndexPattern('alias2', 'date');
|
||||
const indexPageHeading = await PageObjects.settings.getIndexPageHeading();
|
||||
const patternName = await indexPageHeading.getVisibleText();
|
||||
expect(patternName).to.be('alias2*');
|
||||
});
|
||||
|
||||
|
||||
it('should be able to discover and verify no of hits for alias2', async function () {
|
||||
const expectedHitCount = '5';
|
||||
const fromTime = '2016-11-12 05:00:00.000';
|
||||
const toTime = '2016-11-19 05:00:00.000';
|
||||
|
||||
await PageObjects.common.navigateToApp('discover');
|
||||
await PageObjects.discover.selectIndexPattern('alias2');
|
||||
await PageObjects.header.setAbsoluteRange(fromTime, toTime);
|
||||
|
||||
await retry.try(async function () {
|
||||
expect(await PageObjects.discover.getHitCount()).to.be(expectedHitCount);
|
||||
});
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await esArchiver.unload('alias');
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
|
@ -25,6 +25,7 @@ export default function ({ getService, loadTestFile }) {
|
|||
loadTestFile(require.resolve('./_scripted_fields_filter'));
|
||||
loadTestFile(require.resolve('./_import_objects'));
|
||||
loadTestFile(require.resolve('./_test_huge_fields'));
|
||||
loadTestFile(require.resolve('./_handle_alias'));
|
||||
});
|
||||
|
||||
}
|
||||
|
|
BIN
test/functional/fixtures/es_archiver/alias/data.json.gz
Normal file
BIN
test/functional/fixtures/es_archiver/alias/data.json.gz
Normal file
Binary file not shown.
221
test/functional/fixtures/es_archiver/alias/mappings.json
Normal file
221
test/functional/fixtures/es_archiver/alias/mappings.json
Normal file
|
@ -0,0 +1,221 @@
|
|||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"index": "test3",
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_shards": "5",
|
||||
"number_of_replicas": "1"
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"doc": {
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"index": "test9",
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_shards": "5",
|
||||
"number_of_replicas": "1"
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"doc": {
|
||||
"properties": {
|
||||
"date": {
|
||||
"type": "date"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"index": "test4",
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_shards": "5",
|
||||
"number_of_replicas": "1"
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"doc": {
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"index": "test2",
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_shards": "5",
|
||||
"number_of_replicas": "1"
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"doc": {
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"index": "test7",
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_shards": "5",
|
||||
"number_of_replicas": "1"
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"doc": {
|
||||
"properties": {
|
||||
"date": {
|
||||
"type": "date"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"index": "test6",
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_shards": "5",
|
||||
"number_of_replicas": "1"
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"doc": {
|
||||
"properties": {
|
||||
"date": {
|
||||
"type": "date"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"index": "test8",
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_shards": "5",
|
||||
"number_of_replicas": "1"
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"doc": {
|
||||
"properties": {
|
||||
"date": {
|
||||
"type": "date"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"index": "test5",
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_shards": "5",
|
||||
"number_of_replicas": "1"
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"doc": {
|
||||
"properties": {
|
||||
"date": {
|
||||
"type": "date"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"index": "test1",
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_shards": "5",
|
||||
"number_of_replicas": "1"
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"doc": {
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -286,6 +286,11 @@ export function DiscoverPageProvider({ getService, getPageObjects }) {
|
|||
.click();
|
||||
}
|
||||
|
||||
async selectIndexPattern(indexPattern) {
|
||||
await getRemote().findByClassName('index-pattern-selection').click();
|
||||
await getRemote().findByClassName('ui-select-search').type(indexPattern + '\n');
|
||||
}
|
||||
|
||||
async removeAllFilters() {
|
||||
await testSubjects.click('showFilterActions');
|
||||
await testSubjects.click('removeAllFilters');
|
||||
|
|
|
@ -252,7 +252,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
|
|||
.getVisibleText();
|
||||
|
||||
await remote.setFindTimeout(defaultFindTimeout)
|
||||
.findAllByCssSelector(`table.euiTable tbody tr.euiTableRow:nth-child(${tableFields.indexOf(name) + 1})
|
||||
.findAllByCssSelector(`table.euiTable tbody tr.euiTableRow:nth-child(${tableFields.indexOf(name) + 1})
|
||||
td:last-child button`)
|
||||
.click();
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
|
|||
.getVisibleText();
|
||||
|
||||
await remote.setFindTimeout(defaultFindTimeout)
|
||||
.findAllByCssSelector(`div.euiPopover .euiContextMenuPanel
|
||||
.findAllByCssSelector(`div.euiPopover .euiContextMenuPanel
|
||||
button.euiContextMenuItem:nth-child(${sizeButtons.indexOf(size + ' rows') + 1})`)
|
||||
.click();
|
||||
} catch(e) {
|
||||
|
@ -305,6 +305,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
|
|||
await retry.try(async () => {
|
||||
await this.navigateTo();
|
||||
await this.clickKibanaIndices();
|
||||
await this.clickOptionalAddNewButton();
|
||||
await this.setIndexPatternField(indexPatternName);
|
||||
await PageObjects.common.sleep(2000);
|
||||
await (await this.getCreateIndexPatternGoToStep2Button()).click();
|
||||
|
@ -328,6 +329,17 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
|
|||
return await this.getIndexPatternIdFromUrl();
|
||||
}
|
||||
|
||||
//adding a method to check if the create index pattern button is visible(while adding more than 1 index pattern)
|
||||
|
||||
async clickOptionalAddNewButton() {
|
||||
const buttonParent = await testSubjects.find('createIndexPatternParent');
|
||||
const buttonVisible = (await buttonParent.getProperty('innerHTML')).includes('createIndexPatternButton');
|
||||
log.debug('found the button ' + buttonVisible);
|
||||
if(buttonVisible) {
|
||||
await testSubjects.click('createIndexPatternButton');
|
||||
}
|
||||
}
|
||||
|
||||
async getIndexPatternIdFromUrl() {
|
||||
const currentUrl = await remote.getCurrentUrl();
|
||||
const indexPatternId = currentUrl.match(/.*\/(.*)/)[1];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue