Skip to content

Commit

Permalink
[7.10] Changed rollup tests to use test user rather than elastic supe…
Browse files Browse the repository at this point in the history
…r user. (#79567) (#85096)

* Changed rollup tests to use test user rather than elastic super user. (#79567)

* removed .only for testing

* Added config with minimum permissions.

* Removed kibana user role. 

I removed the kibana user role to remove redundancy.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

* Update rollup_jobs.js

Made fix to the test to stop page from refreshing after role is added.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
John Dorlus and kibanamachine authored Dec 8, 2020
1 parent 1118e9d commit d868116
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
10 changes: 8 additions & 2 deletions x-pack/test/functional/apps/rollup_job/rollup_jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { mockIndices } from './hybrid_index_helper';
export default function ({ getService, getPageObjects }) {
const es = getService('legacyEs');
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['rollup', 'common']);
const PageObjects = getPageObjects(['rollup', 'common', 'security']);
const security = getService('security');

describe('rollup job', function () {
//Since rollups can only be created once with the same name (even if you delete it),
Expand All @@ -20,13 +21,18 @@ export default function ({ getService, getPageObjects }) {
const targetIndexName = 'rollup-to-be';
const rollupSourceIndexPattern = 'to-be*';
const rollupSourceDataPrepend = 'to-be';

//make sure all dates have the same concept of "now"
const now = new Date();
const pastDates = [
datemath.parse('now-1d', { forceNow: now }),
datemath.parse('now-2d', { forceNow: now }),
datemath.parse('now-3d', { forceNow: now }),
];
before(async () => {
await security.testUser.setRoles(['manage_rollups_role'], false);
await PageObjects.common.navigateToApp('rollupJob');
});

it('create new rollup job', async () => {
const interval = '1000ms';
Expand All @@ -35,7 +41,6 @@ export default function ({ getService, getPageObjects }) {
await es.index(mockIndices(day, rollupSourceDataPrepend));
}

await PageObjects.common.navigateToApp('rollupJob');
await PageObjects.rollup.createNewRollUpJob(
rollupJobName,
rollupSourceIndexPattern,
Expand Down Expand Up @@ -66,6 +71,7 @@ export default function ({ getService, getPageObjects }) {
await es.indices.delete({ index: targetIndexName });
await es.indices.delete({ index: rollupSourceIndexPattern });
await esArchiver.load('empty_kibana');
await security.testUser.restoreDefaults();
});
});
}
19 changes: 19 additions & 0 deletions x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,25 @@ export default async function ({ readConfigFile }) {
},
],
},
manage_rollups_role: {
elasticsearch: {
cluster: ['manage', 'manage_rollup'],
indices: [
{
names: ['*'],
privileges: ['read', 'delete', 'create_index', 'view_index_metadata'],
},
],
},
kibana: [
{
feature: {
discover: ['read'],
},
spaces: ['*'],
},
],
},

//Kibana feature privilege isn't specific to advancedSetting. It can be anything. https://github.com/elastic/kibana/issues/35965
test_api_keys: {
Expand Down

0 comments on commit d868116

Please sign in to comment.