From 92bb1096f9a3efe51bc265594074b3be23262bea Mon Sep 17 00:00:00 2001 From: John Dorlus Date: Fri, 2 Oct 2020 21:35:26 -0400 Subject: [PATCH 1/3] removed .only for testing --- x-pack/test/functional/apps/rollup_job/rollup_jobs.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/x-pack/test/functional/apps/rollup_job/rollup_jobs.js b/x-pack/test/functional/apps/rollup_job/rollup_jobs.js index 5b6484d7184f3..9131c6c0839a5 100644 --- a/x-pack/test/functional/apps/rollup_job/rollup_jobs.js +++ b/x-pack/test/functional/apps/rollup_job/rollup_jobs.js @@ -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), @@ -20,6 +21,7 @@ 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 = [ @@ -27,6 +29,10 @@ export default function ({ getService, getPageObjects }) { datemath.parse('now-2d', { forceNow: now }), datemath.parse('now-3d', { forceNow: now }), ]; + before(async () => { + await security.testUser.setRoles(['manage_rollups_role', 'kibana_user']); + await PageObjects.common.navigateToApp('rollupJob'); + }); it('create new rollup job', async () => { const interval = '1000ms'; @@ -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, @@ -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(); }); }); } From 11469256bdd5e8b8576d759c28024eaf361bad8a Mon Sep 17 00:00:00 2001 From: John Dorlus Date: Mon, 5 Oct 2020 17:00:05 -0400 Subject: [PATCH 2/3] Added config with minimum permissions. --- x-pack/test/functional/config.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index 2072f4aa1c571..01833d1f32ec7 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -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: { From 8714340874439f2bf2b9e1ef72a98b4aaa56e0a2 Mon Sep 17 00:00:00 2001 From: John Dorlus Date: Thu, 3 Dec 2020 13:41:42 -0500 Subject: [PATCH 3/3] Removed kibana user role. I removed the kibana user role to remove redundancy. --- x-pack/test/functional/apps/rollup_job/rollup_jobs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/rollup_job/rollup_jobs.js b/x-pack/test/functional/apps/rollup_job/rollup_jobs.js index 9131c6c0839a5..f7f92e6955799 100644 --- a/x-pack/test/functional/apps/rollup_job/rollup_jobs.js +++ b/x-pack/test/functional/apps/rollup_job/rollup_jobs.js @@ -30,7 +30,7 @@ export default function ({ getService, getPageObjects }) { datemath.parse('now-3d', { forceNow: now }), ]; before(async () => { - await security.testUser.setRoles(['manage_rollups_role', 'kibana_user']); + await security.testUser.setRoles(['manage_rollups_role']); await PageObjects.common.navigateToApp('rollupJob'); });