Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] Add data tags to agent policy APIs #183563

Merged
merged 28 commits into from
May 29, 2024
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
15749db
feature(179915): updated saved objects and index mapping to add globa…
kaanyalti May 14, 2024
45a31b5
feature(179915): updated agent policy models
kaanyalti May 15, 2024
8046938
feature(179915): updated package policy to input conversion to includ…
kaanyalti May 15, 2024
ddf5bc1
feature(179915): updated agent_policy and agent_policy_create_request…
kaanyalti May 16, 2024
9a6efd2
feature(179915): bundled open api spec and validated
kaanyalti May 17, 2024
6c31ece
feature(179915): added custom validation for agent policy request bod…
kaanyalti May 17, 2024
58aab2c
feature(179915): formatted global_data_tags_exclude constans
kaanyalti May 17, 2024
50df4ff
feature(179915): updated excluded inputs, updated validation error me…
kaanyalti May 17, 2024
39115b9
feature(179915): update storedPackagePolicyToAgentInputs to add add_f…
kaanyalti May 17, 2024
9cc6d30
feature(179915): updated input validation
kaanyalti May 17, 2024
57c79db
feature(179915): added global_data_tags to copy policy endpoint
kaanyalti May 17, 2024
58206b8
feature(179915): updated mappings
kaanyalti May 20, 2024
b33b44c
feature(179915): added unit tests
kaanyalti May 20, 2024
a63fd01
feature(179915): updated unit tests
kaanyalti May 20, 2024
f33303a
feature(179915): added integration tests
kaanyalti May 22, 2024
7821821
feature(179915): updated integration tests
kaanyalti May 23, 2024
67f0bfe
feature(179914): remove unnecessary comment
kaanyalti May 23, 2024
127ec26
feature(179915): removed only from tests
kaanyalti May 23, 2024
69541ad
feature(179915): moved excluded input strings
kaanyalti May 24, 2024
57c090a
feature(179915): added unit tests for global data tag input validatio…
kaanyalti May 24, 2024
f5dbdd1
feature(179915): replaced nested data type with flattened for global_…
kaanyalti May 24, 2024
c77b4b1
feature(179915): removed validation tests from integration tests, rem…
kaanyalti May 24, 2024
fcbffa5
feature(179915): added comments
kaanyalti May 24, 2024
3c2cd1d
feature(179915): udpate imports
kaanyalti May 24, 2024
a781dbd
feature(179915): updated integration test equal assertions
kaanyalti May 25, 2024
7c101f0
[CI] Auto-commit changed files from 'node scripts/check_mappings_upda…
kibanamachine May 24, 2024
42adabd
[CI] Auto-commit changed files from 'node scripts/jest_integration -u…
kibanamachine May 24, 2024
93b384a
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine May 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feature(179915): updated unit tests
kaanyalti committed May 28, 2024
commit a63fd018ec84c7fbb8cdc783dca12ef63f5f835a
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@
* 2.0.
*/

import { GLOBAL_DATA_TAG_EXCLUDED_INPUTS } from '../../../common/constants/global_data_tags_exclude';

import type { PackagePolicy, PackagePolicyInput } from '../../types';

import { storedPackagePoliciesToAgentInputs } from './package_policies_to_agent_inputs';
@@ -739,6 +741,44 @@ describe.only('Fleet - storedPackagePoliciesToAgentInputs', () => {
});

it('returns agent inputs with add fields process if global data tags are defined', async () => {
const excludedInputs: PackagePolicyInput[] = [];
const expectedExcluded = []

for (const input of GLOBAL_DATA_TAG_EXCLUDED_INPUTS) {
excludedInputs.push({
type: input,
enabled: true,
vars: {
inputVar: { value: 'input-value' },
inputVar2: { value: undefined },
inputVar3: {
type: 'yaml',
value: 'testField: test',
},
inputVar4: { value: '' },
},
streams: [],
});

expectedExcluded.push({
data_stream: {
namespace: 'default',
},
id: `${input}-some-uuid`,
meta: {
package: {
name: 'mock_package',
version: '0.0.0',
},
},
name: 'mock_package-policy',
package_policy_id: 'some-uuid',
revision: 1,
type: input,
use_output: 'default',
})
}

expect(
await storedPackagePoliciesToAgentInputs(
[
@@ -750,6 +790,7 @@ describe.only('Fleet - storedPackagePoliciesToAgentInputs', () => {
version: '0.0.0',
},
inputs: [
...excludedInputs,
{
...mockInput,
compiled_input: {
@@ -770,9 +811,13 @@ describe.only('Fleet - storedPackagePoliciesToAgentInputs', () => {
packageInfoCache,
undefined,
undefined,
[{ name: 'testName', value: 'testValue'}, { name: 'testName2', value: 'testValue2'}]
[
{ name: 'testName', value: 'testValue' },
{ name: 'testName2', value: 'testValue2' },
]
)
).toEqual([
...expectedExcluded,
{
id: 'test-logs-some-uuid',
name: 'mock_package-policy',