Skip to content

Commit

Permalink
Add test for metricbeat monitoring for ES (#77768)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
marius-dr and elasticmachine committed Sep 21, 2020
1 parent 8347fd0 commit ba8213c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
});
});
};

0 comments on commit ba8213c

Please sign in to comment.