Skip to content

Commit

Permalink
updated the test to use kbnArchiver to load the data and also the tes…
Browse files Browse the repository at this point in the history
…t uses minimal set of roles-permissions for the test-user

lint errors

lint errors
  • Loading branch information
rashmivkulkarni committed Aug 5, 2021
1 parent ee6ffc0 commit 2207166
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 4 deletions.
18 changes: 14 additions & 4 deletions x-pack/test/functional/apps/rollup_job/tsvb.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import mockRolledUpData from './hybrid_index_helper';

export default function ({ getService, getPageObjects }) {
const es = getService('es');
const esArchiver = getService('esArchiver');
const retry = getService('retry');
const security = getService('security');
const kibanaServer = getService('kibanaServer');
const esDeleteAllIndices = getService('esDeleteAllIndices');
const PageObjects = getPageObjects([
'common',
Expand All @@ -26,7 +27,7 @@ export default function ({ getService, getPageObjects }) {
//we add the Date.now() to avoid name collision if you run the tests locally back to back.
const rollupJobName = `tsvb-test-rollup-job-${Date.now()}`;
const rollupSourceIndexName = 'rollup-source-data';
const rollupTargetIndexName = `rollup-target-data`;
const rollupTargetIndexName = 'rollup-target-data';
const pastDates = [
new Date('October 15, 2019 05:35:32'),
new Date('October 15, 2019 05:34:32'),
Expand All @@ -35,7 +36,13 @@ export default function ({ getService, getPageObjects }) {

before(async () => {
// load visualize to have an index pattern ready, otherwise visualize will redirect
await esArchiver.load('x-pack/test/functional/es_archives/visualize/default');
await security.testUser.setRoles(['global_visualize_all', 'test_rollup_reader']);
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/rollup/rollup.json'
);
await kibanaServer.uiSettings.replace({
defaultIndex: 'rollup',
});
});

it('create rollup tsvb', async () => {
Expand Down Expand Up @@ -100,7 +107,10 @@ export default function ({ getService, getPageObjects }) {
});

await esDeleteAllIndices([rollupTargetIndexName, rollupSourceIndexName]);
await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana');
await kibanaServer.importExport.unload(
'x-pack/test/functional/fixtures/kbn_archiver/rollup/rollup.json'
);
await security.testUser.restoreDefaults();
});
});
}
11 changes: 11 additions & 0 deletions x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,17 @@ export default async function ({ readConfigFile }) {
],
},

test_rollup_reader: {
elasticsearch: {
indices: [
{
names: ['rollup-*'],
privileges: ['read', 'view_index_metadata'],
},
],
},
},

//Kibana feature privilege isn't specific to advancedSetting. It can be anything. https://github.com/elastic/kibana/issues/35965
test_api_keys: {
elasticsearch: {
Expand Down
39 changes: 39 additions & 0 deletions x-pack/test/functional/fixtures/kbn_archiver/rollup/rollup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"attributes": {
"accessibility:disableAnimations": true,
"buildNum": 9007199254740991,
"dateFormat:tz": "UTC",
"defaultIndex": "rollup",
"visualization:visualize:legacyChartsLibrary": true,
"visualization:visualize:legacyPieChartsLibrary": true
},
"coreMigrationVersion": "7.15.0",
"id": "7.15.0",
"migrationVersion": {
"config": "7.13.0"
},
"references": [],
"type": "config",
"updated_at": "2021-08-04T23:35:47.992Z",
"version": "WzQwLDFd"
}

{
"attributes": {
"fieldAttrs": "{}",
"fields": "[]",
"runtimeFieldMap": "{}",
"timeFieldName": "@timestamp.date_histogram.timestamp",
"title": "rollup*",
"typeMeta": "{}"
},
"coreMigrationVersion": "7.15.0",
"id": "rollup",
"migrationVersion": {
"index-pattern": "7.11.0"
},
"references": [],
"type": "index-pattern",
"updated_at": "2021-08-04T23:22:14.902Z",
"version": "WzIyLDFd"
}

0 comments on commit 2207166

Please sign in to comment.