Skip to content

Commit

Permalink
add test to switch layer from regular index to rollup index (#88651)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 authored Jan 20, 2021
1 parent dd9e367 commit af3ea4d
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 2 deletions.
23 changes: 22 additions & 1 deletion x-pack/test/functional/apps/lens/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['visualize', 'lens']);
const PageObjects = getPageObjects(['visualize', 'lens', 'header']);
const find = getService('find');
const listingTable = getService('listingTable');
const esArchiver = getService('esArchiver');
Expand Down Expand Up @@ -71,5 +71,26 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(await PageObjects.lens.getDatatableHeaderText()).to.eql('Sum of bytes');
expect(await PageObjects.lens.getDatatableCellText(0, 0)).to.eql('16,788');
});

it('should allow to switch from regular index to rollup index retaining config', async () => {
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickVisType('lens');
await PageObjects.lens.goToTimeRange();
await PageObjects.lens.switchDataPanelIndexPattern('lens_regular_data');
await PageObjects.lens.switchToVisualization('lnsMetric');
await PageObjects.lens.configureDimension({
dimension: 'lns-empty-dimension',
operation: 'sum',
field: 'bytes',
});
await PageObjects.header.waitUntilLoadingHasFinished();

await PageObjects.lens.assertMetric('Sum of bytes', '16,788');

await PageObjects.lens.switchFirstLayerIndexPattern('lens_rolled_up_data');
await PageObjects.header.waitUntilLoadingHasFinished();

await PageObjects.lens.assertMetric('Sum of bytes', '16,788');
});
});
}
24 changes: 23 additions & 1 deletion x-pack/test/functional/es_archives/lens/rollup/config/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,28 @@
}
}

{
"type": "doc",
"value": {
"id": "index-pattern:lens-regular-data",
"index": ".kibana_1",
"source": {
"index-pattern" : {
"title" : "lens_regular_data",
"timeFieldName" : "@timestamp",
"fields" : "[]"
},
"type" : "index-pattern",
"references" : [ ],
"migrationVersion" : {
"index-pattern" : "7.6.0"
},
"updated_at" : "2020-08-19T08:39:09.998Z"
},
"type": "_doc"
}
}

{
"type": "doc",
"value": {
Expand All @@ -54,7 +76,7 @@
"accessibility:disableAnimations": true,
"buildNum": 9007199254740991,
"dateFormat:tz": "UTC",
"defaultIndex": "logstash-*"
"defaultIndex": "lens-rolled-up-data"
},
"references": [],
"type": "config",
Expand Down
12 changes: 12 additions & 0 deletions x-pack/test/functional/es_archives/lens/rollup/data/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,16 @@
"_rollup.id": "lens_rolled_up_data"
}
}
}

{
"type": "doc",
"value": {
"index": "lens_regular_data",
"id": "1",
"source": {
"@timestamp": "2015-09-20T02:00:00.000Z",
"bytes": 16788
}
}
}
23 changes: 23 additions & 0 deletions x-pack/test/functional/es_archives/lens/rollup/data/mappings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
{
"type": "index",
"value": {
"index": "lens_regular_data",
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
},
"bytes": {
"type": "float"
}
}
},
"settings": {
"index": {
"number_of_shards": "1",
"number_of_replicas": "0"
}
}
}
}

{
"type": "index",
"value": {
Expand Down

0 comments on commit af3ea4d

Please sign in to comment.