From f3fc995e2befa75b6266e8f970ee4589bac32572 Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Tue, 20 Oct 2020 11:56:40 -0700 Subject: [PATCH 1/3] fixes https://github.com/elastic/kibana/issues/74449 --- .../apps/management/_create_index_pattern_wizard.js | 5 +++++ test/functional/config.js | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/test/functional/apps/management/_create_index_pattern_wizard.js b/test/functional/apps/management/_create_index_pattern_wizard.js index 8b11a02099f61..90838ecc1f6fb 100644 --- a/test/functional/apps/management/_create_index_pattern_wizard.js +++ b/test/functional/apps/management/_create_index_pattern_wizard.js @@ -24,6 +24,7 @@ export default function ({ getService, getPageObjects }) { const testSubjects = getService('testSubjects'); const es = getService('legacyEs'); const PageObjects = getPageObjects(['settings', 'common']); + const security = getService('security'); describe('"Create Index Pattern" wizard', function () { before(async function () { @@ -51,6 +52,9 @@ export default function ({ getService, getPageObjects }) { }); describe('index alias', () => { + before(async function () { + await security.testUser.setRoles(['kibana_admin', 'test_alias1_reader']); + }); it('can be an index pattern', async () => { await es.transport.request({ path: '/blogs/_doc', @@ -77,6 +81,7 @@ export default function ({ getService, getPageObjects }) { path: '/blogs', method: 'DELETE', }); + await security.testUser.restoreDefaults(); }); }); }); diff --git a/test/functional/config.js b/test/functional/config.js index 6081810d41272..e465937aff0e5 100644 --- a/test/functional/config.js +++ b/test/functional/config.js @@ -288,6 +288,18 @@ export default async function ({ readConfigFile }) { }, kibana: [], }, + + test_alias1_reader: { + elasticsearch: { + cluster: [], + indices: [ + { + names: ['alias1'], + privileges: ['read', 'view_index_metadata'], + }, + ], + }, + }, }, defaultRoles: ['test_logstash_reader', 'kibana_admin'], }, From d16592e569b8c7bd3219f5b165ab652b4a6b5a00 Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Fri, 22 Jan 2021 15:49:10 -0800 Subject: [PATCH 2/3] watcher test with specific permissions --- x-pack/test/functional/apps/watcher/watcher_test.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/x-pack/test/functional/apps/watcher/watcher_test.js b/x-pack/test/functional/apps/watcher/watcher_test.js index 1dd3fb6bbcc3d..d1038f3e8865e 100644 --- a/x-pack/test/functional/apps/watcher/watcher_test.js +++ b/x-pack/test/functional/apps/watcher/watcher_test.js @@ -15,16 +15,15 @@ export default function ({ getService, getPageObjects }) { const retry = getService('retry'); const testSubjects = getService('testSubjects'); const log = getService('log'); + const security = getService('security'); const esSupertest = getService('esSupertest'); const PageObjects = getPageObjects(['security', 'common', 'header', 'settings', 'watcher']); - // Still flaky test :c - // https://github.com/elastic/kibana/pull/56361 - // https://github.com/elastic/kibana/pull/56304 - describe.skip('watcher_test', function () { + describe('watcher_test', function () { before('initialize tests', async () => { // There may be system watches if monitoring was previously enabled // These cannot be deleted via the UI, so we need to delete via the API + await security.testUser.setRoles(['kibana_admin', 'watcher_admin']); const watches = await esSupertest.get('/.watches/_search'); if (watches.status === 200) { @@ -56,6 +55,10 @@ export default function ({ getService, getPageObjects }) { }); }); + after(async () => { + await security.testUser.restoreDefaults(); + }); + it('create and save a new watch', async () => { await PageObjects.watcher.createWatch(watchID, watchName); const watch = await PageObjects.watcher.getWatch(watchID); From a00c508af80cceaff46af67ca4861b3aee57e67e Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Mon, 25 Jan 2021 11:51:48 -0800 Subject: [PATCH 3/3] adding the false parameter --- x-pack/test/functional/apps/watcher/watcher_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/watcher/watcher_test.js b/x-pack/test/functional/apps/watcher/watcher_test.js index d1038f3e8865e..2525f4d8f9621 100644 --- a/x-pack/test/functional/apps/watcher/watcher_test.js +++ b/x-pack/test/functional/apps/watcher/watcher_test.js @@ -23,7 +23,7 @@ export default function ({ getService, getPageObjects }) { before('initialize tests', async () => { // There may be system watches if monitoring was previously enabled // These cannot be deleted via the UI, so we need to delete via the API - await security.testUser.setRoles(['kibana_admin', 'watcher_admin']); + await security.testUser.setRoles(['kibana_admin', 'watcher_admin'], false); const watches = await esSupertest.get('/.watches/_search'); if (watches.status === 200) {