mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Fleet] Add unit test for fleet agent id verification config flag (#155720)
This commit is contained in:
parent
6ec97802d9
commit
5e713fb225
1 changed files with 30 additions and 3 deletions
|
@ -17,6 +17,10 @@ import { appContextService } from '../../..';
|
|||
import type { RegistryDataStream } from '../../../../types';
|
||||
import { processFields } from '../../fields/field';
|
||||
import type { Field } from '../../fields/field';
|
||||
import {
|
||||
FLEET_COMPONENT_TEMPLATES,
|
||||
FLEET_GLOBALS_COMPONENT_TEMPLATE_NAME,
|
||||
} from '../../../../constants';
|
||||
|
||||
import {
|
||||
generateMappings,
|
||||
|
@ -26,7 +30,9 @@ import {
|
|||
updateCurrentWriteIndices,
|
||||
} from './template';
|
||||
|
||||
const FLEET_COMPONENT_TEMPLATES = ['.fleet_globals-1', '.fleet_agent_id_verification-1'];
|
||||
const FLEET_COMPONENT_TEMPLATES_NAMES = FLEET_COMPONENT_TEMPLATES.map(
|
||||
(componentTemplate) => componentTemplate.name
|
||||
);
|
||||
|
||||
// Add our own serialiser to just do JSON.stringify
|
||||
expect.addSnapshotSerializer({
|
||||
|
@ -69,7 +75,28 @@ describe('EPM template', () => {
|
|||
});
|
||||
expect(template.composed_of).toStrictEqual([
|
||||
...composedOfTemplates,
|
||||
...FLEET_COMPONENT_TEMPLATES,
|
||||
...FLEET_COMPONENT_TEMPLATES_NAMES,
|
||||
]);
|
||||
});
|
||||
|
||||
it('does not create fleet agent id verification component template if agentIdVerification is disabled', () => {
|
||||
appContextService.start(
|
||||
createAppContextStartContractMock({
|
||||
agentIdVerificationEnabled: false,
|
||||
})
|
||||
);
|
||||
const composedOfTemplates = ['component1', 'component2'];
|
||||
|
||||
const template = getTemplate({
|
||||
templateIndexPattern: 'name-*',
|
||||
packageName: 'nginx',
|
||||
composedOfTemplates,
|
||||
templatePriority: 200,
|
||||
mappings: { properties: [] },
|
||||
});
|
||||
expect(template.composed_of).toStrictEqual([
|
||||
...composedOfTemplates,
|
||||
FLEET_GLOBALS_COMPONENT_TEMPLATE_NAME,
|
||||
]);
|
||||
});
|
||||
|
||||
|
@ -83,7 +110,7 @@ describe('EPM template', () => {
|
|||
templatePriority: 200,
|
||||
mappings: { properties: [] },
|
||||
});
|
||||
expect(template.composed_of).toStrictEqual(FLEET_COMPONENT_TEMPLATES);
|
||||
expect(template.composed_of).toStrictEqual(FLEET_COMPONENT_TEMPLATES_NAMES);
|
||||
});
|
||||
|
||||
it('adds hidden field correctly', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue