From f3fc995e2befa75b6266e8f970ee4589bac32572 Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Tue, 20 Oct 2020 11:56:40 -0700 Subject: [PATCH 1/4] 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 b3fd1e255c330c587bb9a112e7bc302da0d30328 Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Thu, 19 Nov 2020 11:59:04 -0800 Subject: [PATCH 2/4] fixing maps tests -small fix to remove unloading of data for the subsequent tests to pass --- .../test/functional/apps/maps/feature_controls/maps_security.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts b/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts index b6b38b840677f..0bb1c82ff8e94 100644 --- a/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts +++ b/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts @@ -23,7 +23,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); after(async () => { - await esArchiver.unload('maps/kibana'); // logout, so the other tests don't accidentally run as the custom users we're testing below await PageObjects.security.forceLogout(); }); From b6b1a2d5283ae7017853f2ed543d67931bc319de Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Thu, 19 Nov 2020 14:43:28 -0800 Subject: [PATCH 3/4] changes to how we load/unload data --- .../functional/apps/maps/feature_controls/maps_security.ts | 6 ------ .../functional/apps/maps/feature_controls/maps_spaces.ts | 5 +---- x-pack/test/functional/apps/maps/index.js | 4 ++++ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts b/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts index 0bb1c82ff8e94..1da696c30dfb7 100644 --- a/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts +++ b/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts @@ -7,7 +7,6 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getPageObjects, getService }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); const security = getService('security'); const PageObjects = getPageObjects(['common', 'error', 'maps', 'settings', 'security']); const appsMenu = getService('appsMenu'); @@ -17,11 +16,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const savedQueryManagementComponent = getService('savedQueryManagementComponent'); describe('maps security feature controls', () => { - before(async () => { - await esArchiver.loadIfNeeded('maps/data'); - await esArchiver.load('maps/kibana'); - }); - after(async () => { // logout, so the other tests don't accidentally run as the custom users we're testing below await PageObjects.security.forceLogout(); diff --git a/x-pack/test/functional/apps/maps/feature_controls/maps_spaces.ts b/x-pack/test/functional/apps/maps/feature_controls/maps_spaces.ts index 11b87469e4993..98f91705f0c1e 100644 --- a/x-pack/test/functional/apps/maps/feature_controls/maps_spaces.ts +++ b/x-pack/test/functional/apps/maps/feature_controls/maps_spaces.ts @@ -7,7 +7,6 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getPageObjects, getService }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); const spacesService = getService('spaces'); const PageObjects = getPageObjects(['common', 'maps', 'security']); const appsMenu = getService('appsMenu'); @@ -15,13 +14,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { // FLAKY: https://github.com/elastic/kibana/issues/38414 describe.skip('spaces feature controls', () => { before(async () => { - await esArchiver.loadIfNeeded('maps/data'); - await esArchiver.load('maps/kibana'); PageObjects.maps.setBasePath('/s/custom_space'); }); after(async () => { - await esArchiver.unload('maps/kibana'); + await PageObjects.security.forceLogout(); PageObjects.maps.setBasePath(''); }); diff --git a/x-pack/test/functional/apps/maps/index.js b/x-pack/test/functional/apps/maps/index.js index 2d2d2f9d3cf9b..5e6592fa2c675 100644 --- a/x-pack/test/functional/apps/maps/index.js +++ b/x-pack/test/functional/apps/maps/index.js @@ -15,6 +15,10 @@ export default function ({ loadTestFile, getService }) { before(async () => { await esArchiver.loadIfNeeded('logstash_functional'); await esArchiver.load('maps/data'); + }); + + // The data in the before() doesn't get changed inside the test, but the kibana index starting point should be the same for each individual test + beforeEach(async () => { await esArchiver.load('maps/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: 'c698b940-e149-11e8-a35a-370a8516603a', From 183ae81b5ea3a1a6a64629ff90a9bee11bf09faa Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Fri, 20 Nov 2020 13:03:12 -0800 Subject: [PATCH 4/4] modified index.js file again to fit the needs --- x-pack/test/functional/apps/maps/index.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/x-pack/test/functional/apps/maps/index.js b/x-pack/test/functional/apps/maps/index.js index 5e6592fa2c675..a3cf85fd00d8e 100644 --- a/x-pack/test/functional/apps/maps/index.js +++ b/x-pack/test/functional/apps/maps/index.js @@ -15,10 +15,6 @@ export default function ({ loadTestFile, getService }) { before(async () => { await esArchiver.loadIfNeeded('logstash_functional'); await esArchiver.load('maps/data'); - }); - - // The data in the before() doesn't get changed inside the test, but the kibana index starting point should be the same for each individual test - beforeEach(async () => { await esArchiver.load('maps/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: 'c698b940-e149-11e8-a35a-370a8516603a', @@ -31,7 +27,7 @@ export default function ({ loadTestFile, getService }) { await esArchiver.unload('maps/kibana'); }); - describe('', function () { + describe('', async function () { this.tags('ciGroup9'); loadTestFile(require.resolve('./documents_source')); loadTestFile(require.resolve('./blended_vector_layer'));