mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Infra] Limit the number of metrics accepted by Snapshot API (#188181)
part of [3628](https://github.com/elastic/observability-dev/issues/3628) - private ## Summary After adding 20 items, users can no longer add more metrics and will see the "Add metric" button disabled with a tooltip <img width="1713" alt="image" src="https://github.com/user-attachments/assets/c784b08b-e118-4491-b53d-46bfde898216"> ### How to test - Start a local Kibana instance pointing to an oblt cluster - Navigate to Infrastructure - Try to add more than 20 metrics in the Metrics dropdown.
This commit is contained in:
parent
ccfdd69223
commit
f2d1a8b6d2
9 changed files with 236 additions and 113 deletions
|
@ -555,6 +555,39 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should not allow adding more than 20 custom metrics', async () => {
|
||||
// open
|
||||
await pageObjects.infraHome.clickCustomMetricDropdown();
|
||||
|
||||
const fields = [
|
||||
'process.cpu.pct',
|
||||
'process.memory.pct',
|
||||
'system.core.total.pct',
|
||||
'system.core.user.pct',
|
||||
'system.core.nice.pct',
|
||||
'system.core.idle.pct',
|
||||
'system.core.iowait.pct',
|
||||
'system.core.irq.pct',
|
||||
'system.core.softirq.pct',
|
||||
'system.core.steal.pct',
|
||||
'system.cpu.nice.pct',
|
||||
'system.cpu.idle.pct',
|
||||
'system.cpu.iowait.pct',
|
||||
'system.cpu.irq.pct',
|
||||
];
|
||||
|
||||
for (const field of fields) {
|
||||
await pageObjects.infraHome.addCustomMetric(field);
|
||||
}
|
||||
const metricsCount = await pageObjects.infraHome.getMetricsContextMenuItemsCount();
|
||||
// there are 6 default metrics in the context menu for hosts
|
||||
expect(metricsCount).to.eql(20);
|
||||
|
||||
await pageObjects.infraHome.ensureCustomMetricAddButtonIsDisabled();
|
||||
// close
|
||||
await pageObjects.infraHome.clickCustomMetricDropdown();
|
||||
});
|
||||
});
|
||||
|
||||
describe('alerts flyouts', () => {
|
||||
|
|
|
@ -482,5 +482,27 @@ export function InfraHomePageProvider({ getService, getPageObjects }: FtrProvide
|
|||
async clickCloseFlyoutButton() {
|
||||
return testSubjects.click('euiFlyoutCloseButton');
|
||||
},
|
||||
|
||||
async clickCustomMetricDropdown() {
|
||||
await testSubjects.click('infraInventoryMetricDropdown');
|
||||
},
|
||||
|
||||
async addCustomMetric(field: string) {
|
||||
await testSubjects.click('infraModeSwitcherAddMetricButton');
|
||||
const groupByCustomField = await testSubjects.find('infraCustomMetricFieldSelect');
|
||||
await comboBox.setElement(groupByCustomField, field);
|
||||
await testSubjects.click('infraCustomMetricFormSaveButton');
|
||||
},
|
||||
|
||||
async getMetricsContextMenuItemsCount() {
|
||||
const contextMenu = await testSubjects.find('infraInventoryMetricsContextMenu');
|
||||
const menuItems = await contextMenu.findAllByCssSelector('button.euiContextMenuItem');
|
||||
return menuItems.length;
|
||||
},
|
||||
|
||||
async ensureCustomMetricAddButtonIsDisabled() {
|
||||
const button = await testSubjects.find('infraModeSwitcherAddMetricButton');
|
||||
expect(await button.getAttribute('disabled')).to.be('true');
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue