mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Fleet] Fix invalid permission entry if the elastic agent package is not installed (#125447)
This commit is contained in:
parent
09ff04db09
commit
d383bda82e
2 changed files with 17 additions and 0 deletions
|
@ -43,6 +43,15 @@ describe('getMonitoringPermissions', () => {
|
|||
);
|
||||
expect(permissions).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should an empty valid permission entry if neither metrics and logs are enabled', async () => {
|
||||
const permissions = await getMonitoringPermissions(
|
||||
savedObjectsClientMock.create(),
|
||||
{ logs: false, metrics: false },
|
||||
'testnamespace123'
|
||||
);
|
||||
expect(permissions).toEqual({ _elastic_agent_monitoring: { indices: [] } });
|
||||
});
|
||||
});
|
||||
|
||||
describe('With elastic agent package installed', () => {
|
||||
|
|
|
@ -30,6 +30,14 @@ function buildDefault(enabled: { logs: boolean; metrics: boolean }, namespace: s
|
|||
);
|
||||
}
|
||||
|
||||
if (names.length === 0) {
|
||||
return {
|
||||
_elastic_agent_monitoring: {
|
||||
indices: [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
_elastic_agent_monitoring: {
|
||||
indices: [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue