mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Add getActionsHealth method to return permanent encryption key existence (#140535)
* add getActionsHealth method to return permanent encryption key existence
This commit is contained in:
parent
02e1d7f2e0
commit
42e92926fe
3 changed files with 26 additions and 0 deletions
|
@ -28,6 +28,7 @@ const createSetupMock = () => {
|
|||
isPreconfiguredConnector: jest.fn(),
|
||||
getSubActionConnectorClass: jest.fn(),
|
||||
getCaseConnectorClass: jest.fn(),
|
||||
getActionsHealth: jest.fn(),
|
||||
};
|
||||
return mock;
|
||||
};
|
||||
|
|
|
@ -472,5 +472,24 @@ describe('Actions Plugin', () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getActionsHealth()', () => {
|
||||
it('should return hasPermanentEncryptionKey false if canEncrypt of encryptedSavedObjects is false', async () => {
|
||||
// coreMock.createSetup doesn't support Plugin generics
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const pluginSetup = await plugin.setup(coreSetup as any, pluginsSetup);
|
||||
expect(pluginSetup.getActionsHealth()).toEqual({ hasPermanentEncryptionKey: false });
|
||||
});
|
||||
it('should return hasPermanentEncryptionKey true if canEncrypt of encryptedSavedObjects is true', async () => {
|
||||
const pluginSetup = await plugin.setup(coreSetup, {
|
||||
...pluginsSetup,
|
||||
encryptedSavedObjects: {
|
||||
...pluginsSetup.encryptedSavedObjects,
|
||||
canEncrypt: true,
|
||||
},
|
||||
});
|
||||
expect(pluginSetup.getActionsHealth()).toEqual({ hasPermanentEncryptionKey: true });
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -121,6 +121,7 @@ export interface PluginSetupContract {
|
|||
isPreconfiguredConnector(connectorId: string): boolean;
|
||||
getSubActionConnectorClass: <Config, Secrets>() => IServiceAbstract<Config, Secrets>;
|
||||
getCaseConnectorClass: <Config, Secrets>() => IServiceAbstract<Config, Secrets>;
|
||||
getActionsHealth: () => { hasPermanentEncryptionKey: boolean };
|
||||
}
|
||||
|
||||
export interface PluginStartContract {
|
||||
|
@ -375,6 +376,11 @@ export class ActionsPlugin implements Plugin<PluginSetupContract, PluginStartCon
|
|||
},
|
||||
getSubActionConnectorClass: () => SubActionConnector,
|
||||
getCaseConnectorClass: () => CaseConnector,
|
||||
getActionsHealth: () => {
|
||||
return {
|
||||
hasPermanentEncryptionKey: plugins.encryptedSavedObjects.canEncrypt,
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue