From c6e73b89be34088c1b90b2c1e26616201009ca38 Mon Sep 17 00:00:00 2001 From: Marius Dragomir Date: Mon, 21 Sep 2020 16:10:18 +0200 Subject: [PATCH] Add test for metricbeat monitoring for ES (#77768) (#77999) Co-authored-by: Elastic Machine Co-authored-by: Elastic Machine --- .../configs/tests_list.js | 6 ++- .../apps/monitoring/_monitoring_metricbeat.js | 39 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 x-pack/test/stack_functional_integration/test/functional/apps/monitoring/_monitoring_metricbeat.js diff --git a/x-pack/test/stack_functional_integration/configs/tests_list.js b/x-pack/test/stack_functional_integration/configs/tests_list.js index ff68cb6285965d..0d91a078b73fdf 100644 --- a/x-pack/test/stack_functional_integration/configs/tests_list.js +++ b/x-pack/test/stack_functional_integration/configs/tests_list.js @@ -46,10 +46,14 @@ export default (envObj) => { if (envObj.XPACK === 'YES' && ['TRIAL', 'GOLD', 'PLATINUM'].includes(envObj.LICENSE)) { // we can't test enabling monitoring on this config because we already enable it through cluster settings for both clusters. - if (envObj.VM !== 'ubuntu16_tar_ccs') { + if (envObj.VM !== 'ubuntu16_tar_ccs' && envObj.VM !== 'centos7_rpm') { // monitoring is last because we switch to the elastic superuser here xs.push('monitoring'); } + if (envObj.VM === 'centos7_rpm') { + // monitoring is last because we switch to the elastic superuser here + xs.push('monitoring/_monitoring_metricbeat'); + } } return xs; diff --git a/x-pack/test/stack_functional_integration/test/functional/apps/monitoring/_monitoring_metricbeat.js b/x-pack/test/stack_functional_integration/test/functional/apps/monitoring/_monitoring_metricbeat.js new file mode 100644 index 00000000000000..c11a1baed717c3 --- /dev/null +++ b/x-pack/test/stack_functional_integration/test/functional/apps/monitoring/_monitoring_metricbeat.js @@ -0,0 +1,39 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export default ({ getService, getPageObjects }) => { + describe('monitoring app - stack functional integration - suite', () => { + const browser = getService('browser'); + const PageObjects = getPageObjects(['security', 'monitoring', 'common']); + const log = getService('log'); + const testSubjects = getService('testSubjects'); + const isSaml = !!process.env.VM.includes('saml') || !!process.env.VM.includes('oidc'); + + before(async () => { + await browser.setWindowSize(1200, 800); + if (process.env.SECURITY === 'YES' && !isSaml) { + await PageObjects.security.logout(); + log.debug('### log in as elastic superuser to enable monitoring'); + // Tests may be running as a non-superuser like `power` but that user + // doesn't have the cluster privs to enable monitoring. + // On the SAML config, this will fail, but the test recovers on the next + // navigate and logs in as the saml user. + } + // navigateToApp without a username and password will default to the superuser + await PageObjects.common.navigateToApp('monitoring', { insertTimestamp: false }); + }); + + it('should have Monitoring already enabled', async () => { + await testSubjects.click('esOverview'); + }); + + after(async () => { + if (process.env.SECURITY === 'YES' && !isSaml) { + await PageObjects.security.forceLogout(isSaml); + } + }); + }); +};