mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
Delete 'ServiceEntityStoreEnabled' Flag usages (#211066)
## Summary This PR deletes all usages of ServiceEntityStoreEnabled feature flag. The feature flag itself has been left in `experimental_features.ts` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
08400b1f42
commit
745784f32a
10 changed files with 12 additions and 69 deletions
|
@ -21,40 +21,18 @@ describe('utils', () => {
|
|||
});
|
||||
|
||||
describe('getDisabledEntityTypes', () => {
|
||||
it('should return disabled entity types when serviceEntityStoreEnabled is false', () => {
|
||||
const experimentalFeatures: ExperimentalFeatures = {
|
||||
...mockedExperimentalFeatures,
|
||||
serviceEntityStoreEnabled: false,
|
||||
assetInventoryStoreEnabled: true,
|
||||
};
|
||||
const disabledEntityTypes = getDisabledEntityTypes(experimentalFeatures);
|
||||
expect(disabledEntityTypes).toEqual([EntityType.service]);
|
||||
});
|
||||
|
||||
it('should return disabled entity types when assetInventoryStoreEnabled is false', () => {
|
||||
const experimentalFeatures: ExperimentalFeatures = {
|
||||
...mockedExperimentalFeatures,
|
||||
serviceEntityStoreEnabled: true,
|
||||
assetInventoryStoreEnabled: false,
|
||||
};
|
||||
const disabledEntityTypes = getDisabledEntityTypes(experimentalFeatures);
|
||||
expect(disabledEntityTypes).toEqual([EntityType.universal]);
|
||||
});
|
||||
|
||||
it('should return both disabled entity types when both features are false', () => {
|
||||
const experimentalFeatures: ExperimentalFeatures = {
|
||||
...mockedExperimentalFeatures,
|
||||
serviceEntityStoreEnabled: false,
|
||||
assetInventoryStoreEnabled: false,
|
||||
};
|
||||
const disabledEntityTypes = getDisabledEntityTypes(experimentalFeatures);
|
||||
expect(disabledEntityTypes).toEqual([EntityType.service, EntityType.universal]);
|
||||
});
|
||||
|
||||
it('should return no disabled entity types when both features are true', () => {
|
||||
const experimentalFeatures: ExperimentalFeatures = {
|
||||
...mockedExperimentalFeatures,
|
||||
serviceEntityStoreEnabled: true,
|
||||
assetInventoryStoreEnabled: true,
|
||||
};
|
||||
const disabledEntityTypes = getDisabledEntityTypes(experimentalFeatures);
|
||||
|
|
|
@ -13,13 +13,8 @@ export const getDisabledEntityTypes = (
|
|||
experimentalFeatures: ExperimentalFeatures
|
||||
): EntityType[] => {
|
||||
const disabledEntityTypes: EntityType[] = [];
|
||||
const isServiceEntityStoreEnabled = experimentalFeatures.serviceEntityStoreEnabled;
|
||||
const isUniversalEntityStoreEnabled = experimentalFeatures.assetInventoryStoreEnabled;
|
||||
|
||||
if (!isServiceEntityStoreEnabled) {
|
||||
disabledEntityTypes.push(EntityType.service);
|
||||
}
|
||||
|
||||
if (!isUniversalEntityStoreEnabled) {
|
||||
disabledEntityTypes.push(EntityType.universal);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ const mockedUseKibana = mockUseKibana();
|
|||
const mockedTelemetry = createTelemetryServiceMock();
|
||||
|
||||
jest.mock('../../../common/hooks/use_experimental_features', () => ({
|
||||
useEnableExperimental: () => ({ ...mockedExperimentalFeatures, serviceEntityStoreEnabled: true }),
|
||||
useEnableExperimental: () => ({ ...mockedExperimentalFeatures }),
|
||||
}));
|
||||
|
||||
jest.mock('../../../common/lib/kibana', () => {
|
||||
|
|
|
@ -16,7 +16,7 @@ import { mockGlobalState } from '../../../../common/mock';
|
|||
|
||||
const mockedExperimentalFeatures = mockGlobalState.app.enableExperimental;
|
||||
jest.mock('../../../../common/hooks/use_experimental_features', () => ({
|
||||
useEnableExperimental: () => ({ ...mockedExperimentalFeatures, serviceEntityStoreEnabled: true }),
|
||||
useEnableExperimental: () => ({ ...mockedExperimentalFeatures }),
|
||||
}));
|
||||
jest.mock('../../../../common/hooks/use_global_filter_query');
|
||||
|
||||
|
|
|
@ -316,10 +316,6 @@ export class EntityStoreDataClient {
|
|||
throw new Error('Universal entity store is not enabled');
|
||||
}
|
||||
|
||||
if (entityType === EntityType.service && !experimentalFeatures.serviceEntityStoreEnabled) {
|
||||
throw new Error('Service entity store is not enabled');
|
||||
}
|
||||
|
||||
if (!this.options.taskManager) {
|
||||
throw new Error('Task Manager is not available');
|
||||
}
|
||||
|
|
|
@ -204,30 +204,6 @@ describe('calculateRiskScores()', () => {
|
|||
expect(response.scores.service).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('calculates risk score for service when the experimental flag is enabled', async () => {
|
||||
const response = await calculateRiskScores({
|
||||
...params,
|
||||
experimentalFeatures: {
|
||||
...mockGlobalState.app.enableExperimental,
|
||||
serviceEntityStoreEnabled: true,
|
||||
},
|
||||
});
|
||||
|
||||
expect(response.scores.service).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('does NOT calculates risk score for service when the experimental flag is disabled', async () => {
|
||||
const response = await calculateRiskScores({
|
||||
...params,
|
||||
experimentalFeatures: {
|
||||
...mockGlobalState.app.enableExperimental,
|
||||
serviceEntityStoreEnabled: false,
|
||||
},
|
||||
});
|
||||
|
||||
expect(response.scores.service).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('returns scores in the expected format', async () => {
|
||||
const {
|
||||
scores: { host: hostScores },
|
||||
|
|
|
@ -311,9 +311,7 @@ export const calculateRiskScores = async ({
|
|||
|
||||
const userBuckets = response.aggregations.user?.buckets ?? [];
|
||||
const hostBuckets = response.aggregations.host?.buckets ?? [];
|
||||
const serviceBuckets = experimentalFeatures.serviceEntityStoreEnabled
|
||||
? response.aggregations.service?.buckets ?? []
|
||||
: [];
|
||||
const serviceBuckets = response.aggregations.service?.buckets ?? [];
|
||||
|
||||
const afterKeys = {
|
||||
host: response.aggregations.host?.after_key,
|
||||
|
|
|
@ -348,10 +348,16 @@ describe('Risk Scoring Task', () => {
|
|||
// add additional mock responses for the additional identifier calls
|
||||
mockRiskScoreService.calculateAndPersistScores
|
||||
.mockResolvedValueOnce({
|
||||
// first call - host entity type
|
||||
after_keys: { host: { 'user.name': 'value' } },
|
||||
scores_written: 5,
|
||||
errors: [],
|
||||
})
|
||||
}) // second call - user entity type
|
||||
.mockResolvedValueOnce({
|
||||
after_keys: {},
|
||||
scores_written: 5,
|
||||
errors: [],
|
||||
}) // third call - service entity type
|
||||
.mockResolvedValueOnce({
|
||||
after_keys: {},
|
||||
scores_written: 5,
|
||||
|
@ -369,7 +375,7 @@ describe('Risk Scoring Task', () => {
|
|||
entityAnalyticsConfig,
|
||||
experimentalFeatures: mockExperimentalFeatures,
|
||||
});
|
||||
expect(mockRiskScoreService.calculateAndPersistScores).toHaveBeenCalledTimes(4);
|
||||
expect(mockRiskScoreService.calculateAndPersistScores).toHaveBeenCalledTimes(5);
|
||||
|
||||
expect(mockRiskScoreService.calculateAndPersistScores).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
|
|
|
@ -15,12 +15,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|||
...functionalConfig.getAll(),
|
||||
kbnTestServer: {
|
||||
...functionalConfig.get('kbnTestServer'),
|
||||
serverArgs: [
|
||||
...functionalConfig.get('kbnTestServer.serverArgs'),
|
||||
`--xpack.securitySolution.enableExperimental=${JSON.stringify([
|
||||
'serviceEntityStoreEnabled',
|
||||
])}`,
|
||||
],
|
||||
serverArgs: [...functionalConfig.get('kbnTestServer.serverArgs')],
|
||||
},
|
||||
testFiles: [require.resolve('..')],
|
||||
junit: {
|
||||
|
|
|
@ -9,7 +9,6 @@ import { createTestConfig } from '../../../../../config/serverless/config.base';
|
|||
|
||||
export default createTestConfig({
|
||||
kbnTestServerArgs: [
|
||||
`--xpack.securitySolution.enableExperimental=${JSON.stringify(['serviceEntityStoreEnabled'])}`,
|
||||
`--xpack.securitySolutionServerless.productTypes=${JSON.stringify([
|
||||
{ product_line: 'security', product_tier: 'complete' },
|
||||
{ product_line: 'endpoint', product_tier: 'complete' },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue