mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* add functional tests for metricbeat monitoring
* change test for specific beats
* remove extra comments and normalize test names
* remove extra comment
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 2f9b75c65e
)
Co-authored-by: Marius Dragomir <marius-dr@users.noreply.github.com>
Co-authored-by: Spencer <spencer@elastic.co>
This commit is contained in:
parent
1d0448b27e
commit
2ce3717047
1 changed files with 65 additions and 19 deletions
|
@ -4,41 +4,87 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import expect from '@kbn/expect';
|
||||
|
||||
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');
|
||||
const clusterOverview = getService('monitoringClusterOverview');
|
||||
const find = getService('find');
|
||||
|
||||
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 browser.setWindowSize(1200, 1200);
|
||||
await PageObjects.common.navigateToApp('monitoring', { insertTimestamp: false });
|
||||
await clusterOverview.acceptAlertsModal();
|
||||
});
|
||||
|
||||
it('should have Monitoring already enabled', async () => {
|
||||
beforeEach(async () => {
|
||||
await PageObjects.common.navigateToApp('monitoring', { insertTimestamp: false });
|
||||
await find.clickByLinkText('elasticsearch');
|
||||
// this is a workaround for https://github.com/elastic/kibana/issues/130029
|
||||
});
|
||||
it('Elasticsearch should have at least 1 document', async () => {
|
||||
// Looking at various ES metrics in the ES overview page
|
||||
await testSubjects.click('esOverview');
|
||||
const docCountText = await testSubjects.getVisibleText('documentCount');
|
||||
//the slice is due to the fact that the data is as a string with the description in front. example: "Documents Count \n 1241"
|
||||
const docCount = parseInt(docCountText.slice(10), 10);
|
||||
expect(docCount).to.be.greaterThan(0);
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
if (process.env.SECURITY === 'YES' && !isSaml) {
|
||||
await PageObjects.security.forceLogout(isSaml);
|
||||
}
|
||||
it('Elasticsearch should have at least 1 index', async () => {
|
||||
await testSubjects.click('esOverview');
|
||||
const indCountText = await testSubjects.getVisibleText('indicesCount');
|
||||
const indCount = parseInt(indCountText.slice(8), 10);
|
||||
expect(indCount).to.be.greaterThan(0);
|
||||
});
|
||||
it('Kibana should have 1 instance', async () => {
|
||||
// Looking at various Kibana metrics in the Kibana overview page
|
||||
await testSubjects.click('kbnOverview');
|
||||
const instances = await testSubjects.getVisibleText('instances');
|
||||
expect(instances).to.eql('Instances\n1');
|
||||
});
|
||||
it('Kibana should have at least 1 request', async () => {
|
||||
await testSubjects.click('kbnOverview');
|
||||
const conCountText = await testSubjects.getVisibleText('requests');
|
||||
const conCount = parseInt(conCountText.slice(9), 10);
|
||||
expect(conCount).to.be.greaterThan(0);
|
||||
});
|
||||
it('Logstash should have 1 node', async () => {
|
||||
// Looking at various Logstash metrics in the Logstash overview page
|
||||
await testSubjects.click('lsOverview');
|
||||
const nodes = await testSubjects.getVisibleText('node_count');
|
||||
expect(nodes).to.eql('Nodes\n1');
|
||||
});
|
||||
it('Logstash should have at least 1 event received', async () => {
|
||||
await testSubjects.click('lsOverview');
|
||||
const eventsCountText = await testSubjects.getVisibleText('events_in_total');
|
||||
const eventsCount = parseInt(eventsCountText.slice(16, -1), 10);
|
||||
expect(eventsCount).to.be.greaterThan(0);
|
||||
});
|
||||
it('Beats should have the correct number of total beats', async () => {
|
||||
//Checking the total number of Beats reporting against how many beats we have configured in the integration test
|
||||
await testSubjects.click('beatsOverview');
|
||||
const totalCountText = await testSubjects.getVisibleText('totalBeats');
|
||||
const beatsCount = parseInt(totalCountText.slice(12), 10);
|
||||
const beatsList = process.env.BEATS;
|
||||
expect(beatsCount).to.eql(beatsList.replace('elastic-agent ', '').trim().split(/\s+/).length);
|
||||
});
|
||||
const installedBeats = process.env.BEATS;
|
||||
installedBeats
|
||||
.replace('elastic-agent ', '')
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.forEach(function (beat) {
|
||||
it(beat + ' should be in the list of beats in the header', async () => {
|
||||
//Checking the total number of Beats reporting against how many beats we have configured in the integration test
|
||||
await testSubjects.click('beatsOverview');
|
||||
await testSubjects.click('beatsListingPage');
|
||||
await testSubjects.click('beatLink-' + beat);
|
||||
const eventsTotalText = await testSubjects.getVisibleText('eventsTotal');
|
||||
const eventsTotal = parseInt(eventsTotalText.slice(13), 10);
|
||||
expect(eventsTotal).to.be.greaterThan(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue